double bin_search(double inf, double sup) { //printf("inf = %lf sup = %lf\n", inf, sup ); double base = b + (B-b)/H*(inf+sup)/2; //printf(">> %lf\n", base ); //printf("h = %lf volume = %lf\n", (inf+sup)/2,volume(b, base, (inf+sup)/2) ); //printf("\n"); if(volume(b, base, (inf+sup)/2) > l/n - 0.0000001 && volume(b, base, (inf+sup)/2) < l/n + 0.0000001 ) { return (inf + sup)/2; } else if(volume(b, base, (inf+sup)/2) > l/n) { return bin_search(inf, (inf+sup)/2); } else if(volume(b, base, (inf+sup)/2) < l/n) { return bin_search((inf+sup)/2, sup); } }
void ACubiquityVolume::PostActorCreated() { loadVolume(); const auto eyePosition = eyePositionInVolumeSpace(); //while (!volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, 0.0)) { /*Keep calling update until it returns true*/ } volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold); createOctree(); Super::PostActorCreated(); }
CLHEP::Hep3Vector tubeDimensions(uint64_t aVolumeId) { DD4hep::Geometry::VolumeManager volMgr = DD4hep::Geometry::LCDD::getInstance().volumeManager(); auto pvol = volMgr.lookupPlacement(aVolumeId); auto solid = pvol.volume().solid(); // get the envelope of the shape TGeoConeSeg* tube = (dynamic_cast<TGeoConeSeg*>(solid.ptr())); if (tube == nullptr) { return CLHEP::Hep3Vector(0, 0, 0); } // get half-widths return CLHEP::Hep3Vector(tube->GetRmin1(), tube->GetRmax1(), tube->GetDZ()); }
/** * @brief receiving data main method * * Initialize and open a port, wait for input from input bottle, and print positive message if successful */ int main(int argc, char *argv[]) { yarp::os::Network yarp; taylortrack::utils::ConfigParser config("../conf/real_config.conf"); taylortrack::utils::CommunicationSettings out; out = config.get_audio_communication_out(); taylortrack::sim::DataReceiver<yarp::os::Bottle> rec; bool data_receiver_initialized = rec.init(config.get_audio_communication_in()); if(data_receiver_initialized) { taylortrack::utils::AudioSettings audio = config.get_audio_configuration(); taylortrack::localization::SrpPhat algorithm;// = taylortrack::localization::SrpPhat(audio.sample_rate, audio.mic_x, audio.mic_y, audio.grid_x, audio.grid_y, audio.interval, (int) audio.frame_size, audio.beta); algorithm.set_config(config); int microphones = static_cast<int>(audio.mic_x.size()); yarp::os::BufferedPort<yarp::os::Bottle> outport; outport.open(out.port); //yarp.connect(outport.getName(),yarp::os::ConstString(config.get_visualizer_communication_in().port)); yarp.connect(outport.getName(),yarp::os::ConstString(config.get_audio_communication_destination().port)); while (true) { std::vector<taylortrack::utils::RArray> signals; yarp::os::Bottle *new_data = rec.read_data(true); for (int i = 0; i < microphones; ++i) { taylortrack::utils::RArray volume(static_cast<size_t>(new_data->size()) / microphones); int c = 0; for (int j = i; j < new_data->size(); j += microphones) { volume[c] = new_data->get(j).asDouble(); ++c; } signals.push_back(volume); } taylortrack::utils::VadSimple test_vad = taylortrack::utils::VadSimple(0.0000007); if(test_vad.detect(signals[0])) { algorithm.calculate_position_and_distribution(signals); taylortrack::utils::RArray result = algorithm.get_last_distribution(); yarp::os::Bottle& bottle = outport.prepare(); bottle.clear(); for (int k = 0; k < static_cast<int>(result.size()); ++k) { bottle.addDouble(result[k]); } outport.write(true); } else { std::cout << "No voice activity detected." << std::endl; } } } else { std::cout << "Error initializing incoming communication..." << std::endl; return EXIT_FAILURE; } }
int main() { float raio, resultado; printf("Digite o raio: \n"); scanf("%f", &raio); printf("resultado: %.2f\n\n", volume(raio)); return 0; }
bool DeskbarView::_EntryInTrash(const entry_ref* ref) { BEntry entry(ref); BVolume volume(ref->device); BPath path; if (volume.InitCheck() != B_OK || find_directory(B_TRASH_DIRECTORY, &path, false, &volume) != B_OK) return false; BDirectory trash(path.Path()); return trash.Contains(&entry); }
const Kernel::FT volume( const Geometry& g ) { if ( g.isEmpty() ) { return 0; } SFCGAL_ASSERT_GEOMETRY_VALIDITY( g ); switch ( g.geometryTypeId() ) { case TYPE_POINT: case TYPE_LINESTRING: case TYPE_POLYGON: case TYPE_TRIANGLE: case TYPE_MULTIPOINT: case TYPE_MULTILINESTRING: case TYPE_MULTIPOLYGON: case TYPE_TRIANGULATEDSURFACE: case TYPE_POLYHEDRALSURFACE: return 0; case TYPE_SOLID: return volume( g.as<Solid>(), NoValidityCheck() ); case TYPE_MULTISOLID: case TYPE_GEOMETRYCOLLECTION: Kernel::FT v=0; const GeometryCollection& c = g.as<GeometryCollection>(); for ( size_t i=0; i<c.numGeometries(); i++ ) { if ( c.geometryN( i ).is<Solid>() ) { v = v + volume( c.geometryN( i ).as<Solid>(), NoValidityCheck() ); } } return v; } BOOST_THROW_EXCEPTION( Exception( ( boost::format( "volume( %s ) is not defined" ) % g.geometryType() ).str() ) ); return 0; // to avoid warning }
void AdvectionManager::init(const Domain &domain, const Mesh &mesh, const ConfigManager &configManager, const TimeManager &timeManager) { this->domain = &domain; this->mesh = &mesh; io.init(timeManager); string output_prefix; if (configManager.hasKey("tspas", "output_prefix")) { configManager.getValue("tspas", "output_prefix", output_prefix); } else { output_prefix = "tspas."+ boost::lexical_cast<string>(mesh.getNumGrid(0, FULL))+"x"+ boost::lexical_cast<string>(mesh.getNumGrid(1, FULL)); } outputFileIdx = io.registerOutputFile(mesh, output_prefix, IOFrequencyUnit::STEPS, 10); Qstar.create("qstar", "N/A", "intermediate tracer density", mesh, CENTER); FX.create("fx", "N/A", "flux along x direction", mesh, X_FACE); FY.create("fy", "N/A", "flux along y direction", mesh, Y_FACE); A.create("a", "N/A", "shape-preserving judger", mesh, CENTER); B.create("b", "N/A", "beta", mesh, CENTER); volume.create("volume", "m2 or m3", "the volume of grid cells", mesh, CENTER); io.file(outputFileIdx).registerOutputField<double, 1, FULL_DIMENSION>(1, &volume); int js = 0, jn = mesh.getNumGrid(1, FULL)-1; for (int i = 0; i < mesh.getTotalNumGrid(CENTER); ++i) { volume(i) = mesh.getCellVolume(i); } dlon.resize(mesh.getNumGrid(0, HALF)); for (int i = 0; i < mesh.getNumGrid(0, HALF); ++i) { dlon[i] = mesh.getGridInterval(0, FULL, i); // this is correct } dlat.resize(mesh.getNumGrid(1, HALF)); for (int j = 0; j < mesh.getNumGrid(1, HALF); ++j) { dlat[j] = mesh.getGridInterval(1, FULL, j); // this is correct } cosLatFull.set_size(mesh.getNumGrid(1, FULL)); for (int j = 0; j < mesh.getNumGrid(1, FULL); ++j) { cosLatFull[j] = mesh.getCosLat(FULL, j); } cosLatFull[js] = 0; cosLatFull[jn] = 0; cosLatHalf.set_size(mesh.getNumGrid(1, HALF)); for (int j = 0; j < mesh.getNumGrid(1, HALF); ++j) { cosLatHalf[j] = mesh.getCosLat(HALF, j); } }
// ---------------------------------------------------------------------------- // test the volume setting page creation api. // ---------------------------------------------------------------------------- // void CTestVolumeSettingPage::TestL() { TInt volume(KBCTestVolumeDefaultVolumeLevel); CAknVolumeSettingPage* volumeSettingPage = new( ELeave ) CAknVolumeSettingPage( R_BCTESTVOLUME_SETTING_PAGE_VOLUME_INDICATOR, volume ); AssertNotNullL(volumeSettingPage, _L("create volume setting page.")); AssertTrueL( volumeSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ), _L("setting page executed.")); }
/*************************************************************** * * setAscentRate: * This function takes the previous two points and calculates * the ascent rate * ***************************************************************/ void Predictor::setAscentRatePre( ) { double airDen = air ( _balloon->getLatestPoint().getAlt() ); double vol = volume ( _balloon->getLatestPoint().getAlt() ); double totMass = ( _balloon->getMassPayload() + _balloon->getMassBalloon() ); double areaBalloon = area( _balloon->getLatestPoint().getAlt() ); totMass *= GRAVITY; double top = 2.0 * .85 * airDen * vol * GRAVITY; top = top - 2.0 * totMass; double bottom = _balloon->getDragBalloon() * areaBalloon * airDen; top = top / bottom; _ascentRate = sqrt ( top ); }
void CGameListCtrl::OnExportSave(wxCommandEvent& WXUNUSED (event)) { const GameListItem* iso = GetSelectedISO(); if (!iso) return; u64 title_id; std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(iso->GetFileName())); if (volume && volume->GetTitleID(&title_id)) { CWiiSaveCrypted::ExportWiiSave(title_id); } }
int Find() { for (int i = 2; i < n; i++) { Point ndir = (info[0] - info[i]).cross(info[1] - info[i]); if (ndir == Point()) continue; swap(info[i], info[2]); for (int j = i + 1; j < n; j++) if (Sign(volume(0, 1, 2, j)) != 0) { swap(info[j], info[3]); insert(0, 1, 2); insert(0, 2, 1); return 1; } } return 0; }
void KNMusicStandardBackend::smartVolumeOn() { //If the origial volume is not -1, means smart volume has been turned on. if(m_originalVolume!=-1) { return; } //Backup the original volume. m_originalVolume=m_main->volume()==0?volume():m_main->volume(); //Set the preview as the full volume. m_preview->setVolume(m_originalVolume); //Set the main volume as the 1/8 of the full volume. m_main->setVolume(m_originalVolume>8?m_originalVolume/8:0); }
// Make a random box inside the World Box with the given percentage Volume void Box::randomBox(const Box& world, const float percentageVolume,Box& random) { bigSpaceUnit newVolume = volume(world)*percentageVolume/100; spaceUnit dimensionInc = pow(newVolume,1.0/3.0) /2; for (size_t i = 0; i < DIMENSION; i++) { boost::uniform_real<> uni_dist (world.low.Vector[i],world.high.Vector[i]); boost::variate_generator<boost::mt11213b &,boost::uniform_real<> > uni(generator, uni_dist); float center = uni(); random.low.Vector[i] = center-dimensionInc; random.high.Vector[i] = center+dimensionInc; } }
void MusicPlayer::setMusicEnhanced(Enhanced type) { m_musicEnhanced = type; if(m_musicEnhanced == Music3D) { m_volumeMusic3D = volume(); } else { m_music->setVolume(m_volumeMusic3D, m_volumeMusic3D); setMusicEnhancedCase(); } }
StorageChunk StorageChunk::new_from_buffer(const Vec3i &location, const Vector<uint8_t> &contents, Error *err) { if (contents.length() < 4 || slice_cast<const char>(contents.sub(0, 4)) != "NGSC") { err->set("Bad magic, NGSC expected"); return StorageChunk(location); } ByteReader br(contents.sub(4)); Vec3i chunk_size, storage_chunk_size; chunk_size.x = br.read_int32(err); chunk_size.y = br.read_int32(err); chunk_size.z = br.read_int32(err); if (*err) return StorageChunk(location); if (chunk_size != CHUNK_SIZE) { err->set("Mismatching chunk sizes, file: (%d %d %d), expected: (%d %d %d)", VEC3(chunk_size), VEC3(CHUNK_SIZE)); return StorageChunk(location); } storage_chunk_size.x = br.read_int32(err); storage_chunk_size.y = br.read_int32(err); storage_chunk_size.z = br.read_int32(err); if (*err) return StorageChunk(location); if (storage_chunk_size != STORAGE_CHUNK_SIZE) { err->set("Mismatching storage chunk sizes, file: (%d %d %d), expected: (%d %d %d)", VEC3(storage_chunk_size), VEC3(STORAGE_CHUNK_SIZE)); return StorageChunk(location); } auto tmp = br.read_compressed(err); if (*err) return StorageChunk(location); StorageChunk msc(location); br = ByteReader(tmp); for (int i = 0, n = volume(storage_chunk_size); i < n; i++) { Chunk &c = msc.chunks[i]; c.lods[0].deserialize(&br, CHUNK_SIZE + Vec3i(1), err); if (*err) return StorageChunk(location); } return msc; }
void ACubiquityVolume::PostLoad() { //In here, we are loading an existing volume. We should initialise all the Cubiquity stuff by loading the filename from the UProperty //It seems too early to spawn actors as the World doesn't exist yet. //Actors in the tree will have been serialised anyway so should be loaded. loadVolume(); const auto eyePosition = eyePositionInVolumeSpace(); //while (!volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, 0.0)) { /*Keep calling update until it returns true*/ } volume()->update({ eyePosition.X, eyePosition.Y, eyePosition.Z }, lodThreshold); Super::PostLoad(); }
/* main loop */ int main(void) { input_line = (char *)malloc(6 * sizeof(char)); led_setperm(); set_time = 200000; while (strncmp(input_line, "quit", 4) != 0) { input_line = readline("Led Control> "); /* I know instruction parsing is really lame :/ */ if (!strncmp(input_line, "help", 4)) help(); if (!strncmp(input_line, "ledon", 5)) ledon(); if (!strncmp(input_line, "ledoff", 6)) ledoff(); if (!strncmp(input_line, "settime", 7)) settime(); if (!strncmp(input_line, "volume", 6)) volume(); if (!strncmp(input_line, "bin", 3)) bin(); if (!strncmp(input_line, "slide", 5)) slide(); if (!strncmp(input_line, "blink", 5)) blink(); if (!strncmp(input_line, "bislide", 7)) bislide(); if (!strncmp(input_line, "biblink", 7)) biblink(); if (!strncmp(input_line, "grow", 4)) grow(); if (!strncmp(input_line, "center", 6)) center(); if (!strncmp(input_line, "side", 4)) side(); if (!strncmp(input_line, "biside", 6)) biside(); if (!strncmp(input_line, "demo", 4)) demo(); } led_off_all(); exit(0); }
int _tmain(int argc, _TCHAR* argv[]) { std::vector<unsigned int> vinput; get_input(vinput); size_t volume(0); if(vinput.empty() || vinput.size() == 1) { // volume = 0 return 0; } size_t vis = vinput.size(); size_t idxfwd(0), idxbwd(vis - 1); std::vector<unsigned int> output; output.resize(vis, UINT_MAX); // initial value for array unsigned int mvalfwd = vinput[idxfwd]; unsigned int mvalbwd = vinput[idxbwd]; unsigned s; while(idxbwd) { // check forward iterators s = check_val(output[idxfwd], vinput[idxfwd], mvalfwd); if(UINT_MAX != output[idxfwd]) // check with initial value! { volume += std::min(s, output[idxfwd]); } output[idxfwd] = s; idxfwd++; // check backward iterator s = check_val(output[idxbwd], vinput[idxbwd], mvalbwd); if(UINT_MAX != output[idxbwd]) // check with initial value! { volume += std::min(s, output[idxbwd]); } output[idxbwd] = s; idxbwd--; } // volume = sum of all elements in output // volume contain value already! return 0; }
void ViStreamInput::mute(bool value) { if(value) { mMuteVolume = volume(); setVolume(0); mIsMute = true; } else { mIsMute = false; setVolume(mMuteVolume); } }
void FiniteStrainMaterial::computeStrain() { //Method from Rashid, 1993 std::vector<RankTwoTensor> Fhat; Fhat.resize(_qrule->n_points()); RankTwoTensor ave_Fhat; Real volume(0); Real ave_dfgrd_det; ave_dfgrd_det=0.0; for (_qp = 0; _qp < _qrule->n_points(); ++_qp) { //Deformation gradient RankTwoTensor A(_grad_disp_x[_qp], _grad_disp_y[_qp], _grad_disp_z[_qp]); //Deformation gradient RankTwoTensor Fbar(_grad_disp_x_old[_qp], _grad_disp_y_old[_qp], _grad_disp_z_old[_qp]); //Old Deformation gradient _dfgrd[_qp] = A; _dfgrd[_qp].addIa(1.0);//Gauss point deformation gradient A -= Fbar; //A = gradU - gradUold Fbar.addIa(1.0); //Fbar = ( I + gradUold) //Incremental deformation gradient Fhat = I + A Fbar^-1 Fhat[_qp] = A * Fbar.inverse(); Fhat[_qp].addIa(1.0); //Calculate average Fhat for volumetric locking correction ave_Fhat += Fhat[_qp] * _JxW[_qp]; volume += _JxW[_qp]; ave_dfgrd_det += _dfgrd[_qp].det() * _JxW[_qp]; //Average deformation gradient } ave_Fhat /= volume; //This is needed for volumetric locking correction ave_dfgrd_det /=volume; //Average deformation gradient for (_qp = 0; _qp < _qrule->n_points(); ++_qp) { Real factor( std::pow( ave_Fhat.det() / Fhat[_qp].det(), 1.0/3.0)); Fhat[_qp] *= factor; //Finalize volumetric locking correction computeQpStrain(Fhat[_qp]); factor = std::pow(ave_dfgrd_det / _dfgrd[_qp].det(), 1.0/3.0);//Volumetric locking correction _dfgrd[_qp] *= factor;//Volumetric locking correction } }
bool remove(int p, int b, int a) { int f = bf[b][a]; face_t ff; if (fc[f].vis) { if (dblcmp(volume(pt[p], pt[fc[f].a], pt[fc[f].b], pt[fc[f].c])) >= 0) { return true; } else { ff.a = a, ff.b = b, ff.c = p; bf[ff.a][ff.b] = bf[ff.b][ff.c] = bf[ff.c][ff.a] = ++fcnt; ff.vis = true; fc[fcnt] = ff; } } return false; }
void vol_meter() { int vol = volume(); int length = 16 * (float)num_panels * ((float)vol / (float)600); clear_scr(); for (int x = 0; x < length; x ++) { for (int y = 0; y < 8;y++) { picture[x][y] = red; } } }
GameFile::GameFile(const std::string& path) : m_file_path(path), m_region(DiscIO::Region::Unknown), m_country(DiscIO::Country::Unknown) { { std::string name, extension; SplitPath(m_file_path, nullptr, &name, &extension); m_file_name = name + extension; std::unique_ptr<DiscIO::Volume> volume(DiscIO::CreateVolumeFromFilename(m_file_path)); if (volume != nullptr) { m_platform = volume->GetVolumeType(); m_short_names = volume->GetShortNames(); m_long_names = volume->GetLongNames(); m_short_makers = volume->GetShortMakers(); m_long_makers = volume->GetLongMakers(); m_descriptions = volume->GetDescriptions(); m_region = volume->GetRegion(); m_country = volume->GetCountry(); m_blob_type = volume->GetBlobType(); m_file_size = volume->GetRawSize(); m_volume_size = volume->GetSize(); m_internal_name = volume->GetInternalName(); m_game_id = volume->GetGameID(); m_gametdb_id = volume->GetGameTDBID(); m_title_id = volume->GetTitleID().value_or(0); m_maker_id = volume->GetMakerID(); m_revision = volume->GetRevision().value_or(0); m_disc_number = volume->GetDiscNumber().value_or(0); m_apploader_date = volume->GetApploaderDate(); m_volume_banner.buffer = volume->GetBanner(&m_volume_banner.width, &m_volume_banner.height); m_valid = true; } } if (!IsValid() && IsElfOrDol()) { m_valid = true; m_file_size = m_volume_size = File::GetSize(m_file_path); m_platform = DiscIO::Platform::ELFOrDOL; m_blob_type = DiscIO::BlobType::DIRECTORY; } }
QDomElement SMActionVideoNative::createDomElement(QDomDocument& document) { QDomElement element = SMAction::createDomElement(document); //repeat QDomElement repeatElement = document.createElement("repeat"); repeatElement.appendChild(document.createTextNode(QString::number(repeat()))); element.appendChild(repeatElement); //volume QDomElement volumeElement = document.createElement("volume"); volumeElement.appendChild(document.createTextNode(QString::number(volume()))); element.appendChild(volumeElement); return element; }
typename viennagrid::result_of::coord< MeshSegmentHandleType >::type volume_mesh(MeshSegmentHandleType const & mesh_obj) { typedef typename viennagrid::result_of::const_element_range<MeshSegmentHandleType, ElementTOrTag>::type CellContainer; typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator; typename viennagrid::result_of::coord< MeshSegmentHandleType >::type new_volume = 0; CellContainer new_cells = viennagrid::elements<ElementTOrTag>(mesh_obj); for (CellIterator new_cit = new_cells.begin(); new_cit != new_cells.end(); ++new_cit) { new_volume += volume( default_point_accessor(mesh_obj), *new_cit); } return new_volume; }
/* greebo: This gets called by the SelectObserver if the user drags a box and holds down * any of the selection modifiers. Possible selection candidates are determined and selected/deselected */ void RadiantSelectionSystem::SelectArea(const View& view, const Vector2& device_point, const Vector2& device_delta, SelectionSystem::EModifier modifier, bool face) { // If we are in replace mode, deselect all the components or previous selections if (modifier == SelectionSystem::eReplace) { if (face) { setSelectedAllComponents(false); } else { deselectAll(); } } { // Construct the selection test according to the area the user covered with his drag View scissored(view); ConstructSelectionTest(scissored, Rectangle::ConstructFromArea(device_point, device_delta)); SelectionVolume volume(scissored); // The posssible candidates go here SelectionPool pool; SelectablesList candidates; if (face) { ComponentSelector selectionTester(pool, volume, eFace); GlobalSceneGraph().foreachVisibleNodeInVolume(scissored, selectionTester); // Load them all into the vector for (SelectionPool::iterator i = pool.begin(); i != pool.end(); ++i) { candidates.push_back(i->second); } } else { testSelectScene(candidates, volume, scissored, Mode(), ComponentMode()); } // Cycle through the selection pool and toggle the candidates, but only if we are in toggle mode for (SelectablesList::iterator i = candidates.begin(); i != candidates.end(); i++) { (*i)->setSelected(!(modifier == SelectionSystem::eToggle && (*i)->isSelected())); } } }
void ConsoleCommands::registerCommands(Console& console, AppService& appService, Menu& menu, GameSettings& gameSettings) { SDL_version sdlVersion; std::string verStr = D6_L("version"); // Print application info console.printLine(D6_L("\n===Application information===")); console.printLine(Format("{0} {1}: {2}") << APP_NAME << verStr << APP_VERSION); SDL_GetVersion(&sdlVersion); console.printLine(Format("SDL {0}: {1}.{2}.{3}") << verStr << sdlVersion.major << sdlVersion.minor << sdlVersion.patch); const SDL_version* mixVersion = Mix_Linked_Version(); console.printLine(Format("SDL_mixer {0}: {1}.{2}.{3}") << verStr << mixVersion->major << mixVersion->minor << mixVersion->patch); console.printLine(D6_L("Language: english")); // Set some console functions console.setLast(15); console.registerCommand("switch_render_mode", [&gameSettings](Console& con, const Console::Arguments& args) { toggleRenderMode(con, args, gameSettings); }); console.registerCommand("show_fps", [&gameSettings](Console& con, const Console::Arguments& args) { toggleShowFps(con, args, gameSettings); }); console.registerCommand("gl_info", openGLInfo); console.registerCommand("lang", language); console.registerCommand("volume", [&appService](Console& con, const Console::Arguments& args) { volume(con, args, appService.getSound()); }); console.registerCommand("rounds", [&gameSettings](Console& con, const Console::Arguments& args) { maxRounds(con, args, gameSettings); }); console.registerCommand("ghosts", [&gameSettings](Console& con, const Console::Arguments& args) { ghostMode(con, args, gameSettings); }); console.registerCommand("music", [&menu](Console& con, const Console::Arguments& args) { musicOnOff(con, args, menu); }); console.registerCommand("joy_scan", [&menu](Console& con, const Console::Arguments& args) { joyScan(con, args, menu); }); console.registerCommand("skin", [&menu](Console& con, const Console::Arguments& args) { loadSkin(con, args, menu); }); console.registerCommand("gun", enableWeapon); console.registerCommand("start_ammo_range", [&gameSettings](Console& con, const Console::Arguments& args) { ammoRange(con, args, gameSettings); }); }
int RawConverter::RawToRawPlusDerivativesConverter( const string& src, const string& dst ) { unsigned w, h, d; //read header { string configFileName = src; hFile info( fopen( configFileName.append( ".vhf" ).c_str(), "rb" ) ); FILE* file = info.f; if( file==NULL ) return lFailed( "Can't open header file" ); readDimensionsFromSav( file, w, h, d ); } std::cout << "Creating derivatives for raw model: " << src << " " << w << " x " << h << " x " << d << endl; //read model vector<unsigned char> volume( w*h*d, 0 ); std::cout << "Reading model" << endl; { ifstream file( src.c_str(), ifstream::in | ifstream::binary | ifstream::ate ); if( !file.is_open() ) return lFailed( "Can't open volume file" ); ifstream::pos_type size; size = min( (int)file.tellg(), (int)volume.size() ); file.seekg( 0, ios::beg ); file.read( (char*)( &volume[0] ), size ); file.close(); } //calculate and save derivatives { int result = calculateAndSaveDerivatives( dst, &volume[0], w, h, d ); if( result ) return result; } std::cout << "done" << endl; return 0; }
void snake() { if (beat()) { int vol = volume(); move_back(0); int amount = (float)vol/600 * 8; int length = (float)vol/600 * (float)num_panels* 16; for (int i = 0; i < length ;i++) { picture[i][amount] =red; } } }