MeasurementModel_RngBrg::MeasurementModel_RngBrg(Eigen::Matrix2d &covZ){ setNoise(covZ); config.probabilityOfDetection_ = 0.95; config.uniformClutterIntensity_ = 0.1; config.rangeLimMax_ = 5; config.rangeLimMin_ = 0.3; config.rangeLimBuffer_ = 0.25; }
MeasurementModel_RngBrg::MeasurementModel_RngBrg(double Sr, double Sb){ Eigen::Matrix2d covZ; covZ << Sr, 0, 0, Sb; setNoise(covZ); config.probabilityOfDetection_ = 0.95; config.uniformClutterIntensity_ = 0.1; config.rangeLimMax_ = 5; config.rangeLimMin_ = 0.3; config.rangeLimBuffer_ = 0.25; }
void YMVoice::handleCC(byte number, byte value) { //Handle the Control Changes for YM2149 switch (number) { case 2: YM2149::setEnvelopeCONT(value); break; case 3: YM2149::setEnvelopeATT(value); break; case 4: YM2149::setEnvelopeALT(value); break; case 5: YM2149::setEnvelopeHOLD(value); break; case 6: setNoise(value); break; case 7: setTone(value); break; case 8: setEnvelope(value); break; case 71: setVolume(value/8); break; case 74: YM2149::setNoiseFrequency(value); break; case 75: YM2149::setEnvelopeFrequencyLo(value << 1); break; case 76: YM2149::setEnvelopeFrequencyHi(value << 1); break; default: return; break; } }
void Cloud::makeFunky() { setNoise(map32); loopForever(); char texture[256][256][3]; for(unsigned int i = 0; i < 256; ++i) { for(unsigned int j = 0; j < 256; ++j) { float color = map256[i*256+j]; texture[i][j][0]=color; texture[i][j][1]=color; texture[i][j][2]=color; } } unsigned int ID; glGenTextures(1, &ID); glBindTexture(GL_TEXTURE_2D,ID); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, texture); glMatrixMode(GL_TEXTURE); static float x; x+=0.01f; glTranslatef(x,0,0); //draw the actual cloud texture glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2d(1,1); glVertex3f(0.5f, 0.5f, 0.); glTexCoord2d(0,1); glVertex3f(-0.5f, 0.5f, 0.); glTexCoord2d(0,0); glVertex3f(-0.5f, -0.5f, 0.); glTexCoord2d(1,0); glVertex3f(0.5f, -0.5f, 0.); glEnd(); glMatrixMode(GL_MODELVIEW); }
////////////////////////////////////////////////////////////////////// // constructor ////////////////////////////////////////////////////////////////////// WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, int init_fire, int init_colors) { // if noise magnitude is below this threshold, its contribution // is negilgible, so stop evaluating new octaves _cullingThreshold = 1e-3; // factor by which to increase the simulation resolution _amplify = amplify; // manually adjust the overall amount of turbulence // DG - RNA-fied _strength = 2.; // add the corresponding octaves of noise _octaves = (int)(log((float)_amplify) / log(2.0f) + 0.5); // XXX DEBUG/ TODO: int casting correct? - dg // noise resolution _xResBig = _amplify * xResSm; _yResBig = _amplify * yResSm; _zResBig = _amplify * zResSm; _resBig = Vec3Int(_xResBig, _yResBig, _zResBig); _invResBig = Vec3(1./(float)_resBig[0], 1./(float)_resBig[1], 1./(float)_resBig[2]); _slabSizeBig = _xResBig*_yResBig; _totalCellsBig = _slabSizeBig * _zResBig; // original / small resolution _xResSm = xResSm; _yResSm = yResSm; _zResSm = zResSm; _resSm = Vec3Int(xResSm, yResSm, zResSm); _invResSm = Vec3(1./(float)_resSm[0], 1./(float)_resSm[1], 1./(float)_resSm[2] ); _slabSizeSm = _xResSm*_yResSm; _totalCellsSm = _slabSizeSm * _zResSm; // allocate high resolution density field _totalStepsBig = 0; _densityBig = new float[_totalCellsBig]; _densityBigOld = new float[_totalCellsBig]; for(int i = 0; i < _totalCellsBig; i++) { _densityBig[i] = _densityBigOld[i] = 0.; } /* fire */ _flameBig = _fuelBig = _fuelBigOld = NULL; _reactBig = _reactBigOld = NULL; if (init_fire) { initFire(); } /* colors */ _color_rBig = _color_rBigOld = NULL; _color_gBig = _color_gBigOld = NULL; _color_bBig = _color_bBigOld = NULL; if (init_colors) { initColors(0.0f, 0.0f, 0.0f); } // allocate & init texture coordinates _tcU = new float[_totalCellsSm]; _tcV = new float[_totalCellsSm]; _tcW = new float[_totalCellsSm]; _tcTemp = new float[_totalCellsSm]; // map all const float dx = 1./(float)(_resSm[0]); const float dy = 1./(float)(_resSm[1]); const float dz = 1./(float)(_resSm[2]); int index = 0; for (int z = 0; z < _zResSm; z++) for (int y = 0; y < _yResSm; y++) for (int x = 0; x < _xResSm; x++, index++) { _tcU[index] = x*dx; _tcV[index] = y*dy; _tcW[index] = z*dz; _tcTemp[index] = 0.; } // noise tiles _noiseTile = new float[noiseTileSize * noiseTileSize * noiseTileSize]; /* std::string noiseTileFilename = std::string("noise.wavelets"); generateTile_WAVELET(_noiseTile, noiseTileFilename); */ setNoise(noisetype); /* std::string noiseTileFilename = std::string("noise.fft"); generatTile_FFT(_noiseTile, noiseTileFilename); */ }