void Sound::Update(bool pause) { if (disable) return; set_pause = pause; // get source stop messages from sound thread GetSourceChanges(); // process source stop messages ProcessSourceStop(); // ProcessSourceAdd is implicit // calculate sampler changes from sources ProcessSources(); /* logso << "id: " <<samplers_update.getFirst().id; logso << " add: " << samplers_update.getFirst().sadd.size(); logso << " del: " << samplers_update.getFirst().sremove.size(); logso << " set: " << samplers_update.getFirst().sset.size(); logso << " sources: " << sources_num; logso << std::endl; */ size_t old_update_id = update_id; // commit sampler changes to sound thread SetSamplerChanges(); // use update id to determine whether sampler updates have been comitted if (old_update_id != update_id) { ProcessSourceRemove(); } }
// ------------------------------------------------------------------------------------------------ void ColladaModelFactory::ProcessGeo(Model3dBuilder * builder, xml_node* geo) { // process meshes for(xml_node* mesh = FindChildByName(geo, "mesh"); geo != NULL; geo=FindNextByName(geo, "mesh")) { const char * id = GetAttributeText(geo, "id", true); if (!id) { id = "!missing-id!"; } //start a new mesh builder->Mesh_Reset(); builder->Mesh_Begin(id); std::vector<Source> sources; // setup our 'source' arrays ProcessSources(&sources, builder, mesh); // process 'polylists' for(xml_node* polylist = FindChildByName(mesh, "polylist"); polylist != NULL; polylist = FindNextByName(polylist, "polylist")) { // process the inputs to determine index stride & offsets ProcessPolyListFeatures(builder, polylist, &sources); // get the poly index list and vcount per poly. ParseUINTArray(FindChildByName(polylist, "vcount"), &builder->m_mesh.poly.vcount); ParseUINTArray(FindChildByName(polylist, "p"), &builder->m_mesh.poly.indices); // tell the builder to process the poly/indices data to build vertex/index data builder->Mesh_SetPrimType("POLYGONS"); builder->Mesh_AddPolys(); } // process 'triangles' for(xml_node* triangles = FindChildByName(mesh, "triangles"); triangles != NULL; triangles = FindNextByName(triangles, "triangles")) { ProcessPolyListFeatures(builder, triangles, &sources); ParseUINTArray(FindChildByName(triangles, "p"), &builder->m_mesh.poly.indices); builder->Mesh_SetPrimType("TRIANGLES"); builder->Mesh_AddTriangles(); } // process 'tristrips' for(xml_node* tristrips = FindChildByName(mesh, "tristrips"); tristrips != NULL; tristrips = FindNextByName(tristrips, "tristrips")) { ProcessPolyListFeatures(builder, tristrips, &sources); ParseUINTArray(FindChildByName(tristrips, "p"), &builder->m_mesh.poly.indices); builder->Mesh_SetPrimType("TRISTRIPS"); builder->Mesh_AddTriStrips(); } // process 'trifans' for(xml_node* trifans = FindChildByName(mesh, "trifans"); trifans != NULL; trifans = FindNextByName(trifans, "trifans")) { ProcessPolyListFeatures(builder, trifans, &sources); ParseUINTArray(FindChildByName(trifans, "p"), &builder->m_mesh.poly.indices); builder->Mesh_SetPrimType("TRIFANS"); builder->Mesh_AddTriFans(); } builder->Mesh_End(); } }