//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRIndexedPolyMesh::InitializeClass() { Verify(!AllocatedMemory); AllocatedMemory = new MemoryBlock( sizeof(MLRIndexedPolyMesh), 100, 100, "MLRIndexedPolyMesh" ); Register_Object(AllocatedMemory); Verify(!DefaultData); DefaultData = new ClassData( MLRIndexedPolyMeshClassID, "MidLevelRenderer::MLRIndexedPolyMesh", MLRIndexedPrimitive::DefaultData, (MLRPrimitive::Factory)&Make ); Register_Object(DefaultData); #if defined(TRACE_ENABLED) && defined(MLR_TRACE) MLRIndexedPolyMesh_Clip = new BitTrace("MLRIndexedPolyMesh_Clip"); Register_Object(MLRIndexedPolyMesh_Clip); #endif }
//------------------------------------------------------------------------------ // gosFX::CardCloud::CardCloud( Specification* spec, uint32_t flags ): SpinningCloud(DefaultData, spec, flags) { Check_Object(spec); //Verify(gos_GetCurrentHeap() == Heap); gos_PushCurrentHeap(MidLevelRenderer::Heap); m_cloudImplementation = new MidLevelRenderer::MLRCardCloud(spec->m_maxParticleCount); Register_Object(m_cloudImplementation); gos_PopCurrentHeap(); uint32_t index = spec->m_maxParticleCount * sizeof(Particle); m_P_vertices = Cast_Pointer(Stuff::Point3D*, &m_data[index]); index += 4 * spec->m_maxParticleCount * sizeof(Stuff::Point3D); m_P_color = Cast_Pointer(Stuff::RGBAColor*, &m_data[index]); index += spec->m_maxParticleCount * sizeof(Stuff::RGBAColor); m_P_uvs = Cast_Pointer(Stuff::Vector2DOf<float>*, &m_data[index]); m_cloudImplementation->SetData( Cast_Pointer(pcsize_t, &m_activeParticleCount), m_P_vertices, m_P_color, m_P_uvs ); }
//------------------------------------------------------------------------------ // gosFX::ShapeCloud__Specification::ShapeCloud__Specification( Stuff::MemoryStream *stream, int gfx_version ): SpinningCloud__Specification(gosFX::ShapeCloudClassID, stream, gfx_version) { Check_Pointer(this); Verify(m_class == ShapeCloudClassID); Verify(gos_GetCurrentHeap() == Heap); m_particleClassSize = sizeof(gosFX::ShapeCloud::Particle); m_totalParticleSize = sizeof(gosFX::ShapeCloud::Particle); // //--------------- // Load the shape //--------------- // m_shape = MidLevelRenderer::MLRShape::Make( stream, MidLevelRenderer::ReadMLRVersion(stream) ); Register_Object(m_shape); *stream >> m_radius; // //--------------------------------- // Make sure everything is in order //--------------------------------- // }
//------------------------------------------------------------------------------ // gosFX::Effect__Specification::Effect__Specification( Stuff::RegisteredClass::ClassID class_id, Stuff::MemoryStream *stream, int gfx_version ): m_events(NULL) { Check_Pointer(this); Check_Object(stream); Verify(gos_GetCurrentHeap() == Heap); if (gfx_version < 9) { STOP(("This version of gosFX is no longer supported")); return; } // //-------------- // Read the name //-------------- // m_class = class_id; *stream >> m_name; // //-------------------------------------------------------------------- // Read the events. If we are using an array, no events will be saved //-------------------------------------------------------------------- // unsigned event_count; *stream >> event_count; while (event_count-- > 0) { Event *event = Event::Make(stream, gfx_version); Register_Object(event); m_events.Add(event); } // //-------------------------------------------------------- // Load the curves, variances, and MLRState if appropriate //-------------------------------------------------------- // m_lifeSpan.Load(stream, gfx_version); m_minimumChildSeed.Load(stream, gfx_version); m_maximumChildSeed.Load(stream, gfx_version); m_state.Load(stream, MidLevelRenderer::ReadMLRVersion(stream)); if (gfx_version < 14) { m_state.SetRenderPermissionMask( m_state.GetRenderPermissionMask() | MidLevelRenderer::MLRState::TextureMask ); } if ( m_state.GetAlphaMode() != MidLevelRenderer::MLRState::OneZeroMode && m_state.GetPriority() < MidLevelRenderer::MLRState::AlphaPriority ) m_state.SetPriority(MidLevelRenderer::MLRState::AlphaPriority); }
//------------------------------------------------------------------------------ // void gosFX::CardCloud::InitializeClass() { _ASSERT(!DefaultData); // _ASSERT(gos_GetCurrentHeap() == Heap); DefaultData = new ClassData(CardCloudClassID, "gosFX::CardCloud", SpinningCloud::DefaultData, (Effect::Factory)&Make, (Specification::Factory)&Specification::Make); Register_Object(DefaultData); }
inline MString::MString(const char *cstr) { representation = new MStringRepresentation(cstr); Register_Object(representation); representation->IncrementReferenceCount(); Verify(representation->referenceCount == 1); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLR_I_L_TMesh::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLR_I_L_TMeshClassID, "MidLevelRenderer::MLR_I_L_TMesh", MLR_I_C_TMesh::DefaultData, (MLRPrimitiveBase::Factory)&Make ); Register_Object(DefaultData); #if defined(TRACE_ENABLED) && defined(MLR_TRACE) MLR_I_L_TMesh_Clip = new BitTrace("MLR_I_L_TMesh_Clip"); Register_Object(MLR_I_L_TMesh_Clip); #endif }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRIndexedPrimitive::InitializeClass() { Verify(!DefaultData); DefaultData = new ClassData( MLRIndexedPrimitiveClassID, "MidLevelRenderer::MLRIndexedPrimitive", MLRPrimitive::DefaultData, NULL ); Register_Object(DefaultData); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLR_Terrain2::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLR_Terrain2ClassID, "MidLevelRenderer::MLR_Terrain2", MLR_I_DeT_TMesh::DefaultData, (MLRPrimitiveBase::Factory)&Make ); Register_Object(DefaultData); detailTexCoords = new DynamicArrayOf<Vector2DScalar> (Limits::Max_Number_Vertices_Per_Mesh); Register_Object(detailTexCoords); #if defined(TRACE_ENABLED) && defined(MLR_TRACE) MLR_Terrain2_Clip = new BitTrace("MLR_Terrain2_Clip"); Register_Object(MLR_Terrain2_Clip); #endif }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRAmbientLight::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLRAmbientLightClassID, "MidLevelRenderer::MLRAmbientLight", MLRLight::DefaultData ); Register_Object(DefaultData); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRSorter::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLRSorterClassID, "MidLevelRenderer::MLRSorter", RegisteredClass::DefaultData ); Register_Object(DefaultData); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRNGonCloud::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLRNGonCloudClassID, "MidLevelRenderer::MLRNGonCloud", MLREffect::DefaultData ); Register_Object(DefaultData); clipPerVertex = new DynamicArrayOf<MLRClippingState> (Limits::Max_Number_Vertices_Per_Mesh); Register_Object(clipPerVertex); clipExtraCoords = new DynamicArrayOf<Vector4D> (Limits::Max_Number_Vertices_Per_Mesh); Register_Object(clipExtraCoords); clipExtraColors = new DynamicArrayOf<RGBAColor> (Limits::Max_Number_Vertices_Per_Mesh); Register_Object(clipExtraColors); clipExtraLength = new DynamicArrayOf<int> (Limits::Max_Number_Primitives_Per_Frame); Register_Object(clipExtraLength); }
// //########################################################################### // AddValueImplementation //########################################################################### // void Hash::AddValueImplementation( Plug *plug, const void *value ) { Check_Object(this); Check_Object(plug); Check_Pointer(value); // //------------------------------------------------------------- // Verify that value has not been added //------------------------------------------------------------- // Verify(HasUniqueEntries() ? (FindImplementation(value) == NULL) : (bool)true); // //------------------------------------------------------------- // Find hash entry //------------------------------------------------------------- // IteratorPosition index; index = GetHashIndex(value); // //------------------------------------------------------------- // Get vchain for this index //------------------------------------------------------------- // SortedChain *vchain; Check_Pointer(hashTable); Verify_Index(index); if ((vchain = hashTable[index]) == NULL) { vchain = MakeSortedChain(); Register_Object(vchain); hashTable[index] = vchain; } // //------------------------------------------------------------- // Add to the vchain //------------------------------------------------------------- // Check_Object(vchain); vchain->AddValuePlug(plug, value); }
//------------------------------------------------------------------------------ // void gosFX::PointCloud::InitializeClass() { Verify(!DefaultData); //Verify(gos_GetCurrentHeap() == Heap); DefaultData = new ClassData( PointCloudClassID, "gosFX::PointCloud", ParticleCloud::DefaultData, (Effect::Factory)&Make, (Specification::Factory)&Specification::Make ); Register_Object(DefaultData); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRTexturePool::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLRTexturePoolClassID, "MidLevelRenderer::MLRTexturePool", RegisteredClass::DefaultData ); Register_Object(DefaultData); MLRTexturePool::Instance = NULL; }
//------------------------------------------------------------------------------ // void gosFX::Effect::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == Heap); DefaultData = new ClassData( EffectClassID, "gosFX::Effect", Node::DefaultData, &Make, &Specification::Make ); Register_Object(DefaultData); }
//------------------------------------------------------------------------------ // void gosFX::ParticleCloud::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == Heap); DefaultData = new ClassData( ParticleCloudClassID, "gosFX::ParticleCloud", Effect::DefaultData, NULL, NULL ); Register_Object(DefaultData); }
//------------------------------------------------------------------------------ // void gosFX::Shape::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == Heap); DefaultData = new ClassData( ShapeClassID, "gosFX::Shape", Singleton::DefaultData, (Effect::Factory)&Make, (Specification::Factory)&Specification::Make ); Register_Object(DefaultData); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void Plug::InitializeClass() { Verify(!ConnectionEngineHeap); ConnectionEngineHeap = gos_CreateMemoryHeap("ConnectionEngine"); Check_Pointer(ConnectionEngineHeap); Verify(!DefaultData); DefaultData = new ClassData( PlugClassID, "Stuff::Plug", RegisteredClass::DefaultData ); Register_Object(DefaultData); }
static Object Internal_Make_Pixmap (int finalize, Display *dpy, Pixmap pix) { Object pm; if (pix == None) return Sym_None; pm = Find_Object (T_Pixmap, (GENERIC)dpy, Match_X_Obj, pix); if (Nullp (pm)) { pm = Alloc_Object (sizeof (struct S_Pixmap), T_Pixmap, 0); PIXMAP(pm)->tag = Null; PIXMAP(pm)->pm = pix; PIXMAP(pm)->dpy = dpy; PIXMAP(pm)->free = 0; Register_Object (pm, (GENERIC)dpy, finalize ? P_Free_Pixmap : (PFO)0, 0); } return pm; }
static Object Internal_Make_Cursor (int finalize, Display *dpy, Cursor cursor) { Object c; if (cursor == None) return Sym_None; c = Find_Object (T_Cursor, (GENERIC)dpy, Match_X_Obj, cursor); if (Nullp (c)) { c = Alloc_Object (sizeof (struct S_Cursor), T_Cursor, 0); CURSOR(c)->tag = Null; CURSOR(c)->cursor = cursor; CURSOR(c)->dpy = dpy; CURSOR(c)->free = 0; Register_Object (c, (GENERIC)dpy, finalize ? P_Free_Cursor : (PFO)0, 0); } return c; }
// //########################################################################### //########################################################################### // void HashIterator::NextSortedChainIterator(IteratorPosition index) { Check_Object(this); int i; DeleteSortedChainIterator(); currentPosition = HashIteratorNullPosition; for (i = index; i < hashTableSize; i++) { Check_Pointer(hashTable); Verify_Index(i); if (hashTable[i] != NULL) { // // This index contains a vchain // Check_Object(hashTable[i]); // // Create a vchain iterator // vchainIterator = new SortedChainIterator(hashTable[i]); Register_Object(vchainIterator); if (vchainIterator->GetCurrentPlug() != NULL) { // // The vchain contains items // currentPosition = i; return; } // // Destroy the vchain iterator // DeleteSortedChainIterator(); } } }
Object Make_Window (int finalize, Display *dpy, Window win) { Object w; if (win == None) return Sym_None; if (win == PointerRoot) return Intern ("pointer-root"); w = Find_Object (T_Window, (GENERIC)dpy, Match_X_Obj, win); if (Nullp (w)) { w = Alloc_Object (sizeof (struct S_Window), T_Window, 0); WINDOW(w)->tag = Null; WINDOW(w)->win = win; WINDOW(w)->dpy = dpy; WINDOW(w)->free = 0; WINDOW(w)->finalize = finalize; Register_Object (w, (GENERIC)dpy, finalize ? P_Destroy_Window : (PFO)0, 0); } return w; }
template <class V> void* TableEntryOf<V>::operator new(size_t) { Verify(allocationCount >= 0); if (allocationCount++ == 0) { allocatedMemory = new MemoryBlock( sizeof(TableEntryOf<V>), TableEntry_Memoryblock_Allocation, TableEntry_Memoryblock_Allocation, "Stuff::TableEntryOf", Stuff::ConnectionEngineHeap ); Register_Object(allocatedMemory); } Verify(allocationCount < INT_MAX); Check_Object(allocatedMemory); return allocatedMemory->New(); }
//------------------------------------------------------------------------------ // gosFX::Effect__Specification* gosFX::Effect__Specification::Create( Stuff::MemoryStream *stream, int gfx_version ) { Check_Object(stream); Stuff::RegisteredClass::ClassID class_id; *stream >> class_id; gosFX::Effect::ClassData* class_data = Cast_Pointer( gosFX::Effect::ClassData*, Stuff::RegisteredClass::FindClassData(class_id) ); Check_Object(class_data); Check_Pointer(class_data->specificationFactory); gosFX::Effect__Specification *spec = (*class_data->specificationFactory)(stream, gfx_version); Register_Object(spec); return spec; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void MLRIndexedTriangleCloud::InitializeClass() { Verify(!DefaultData); Verify(gos_GetCurrentHeap() == StaticHeap); DefaultData = new ClassData( MLRIndexedTriangleCloudClassID, "MidLevelRenderer::MLRIndexedTriangleCloud", MLRTriangleCloud::DefaultData ); Register_Object(DefaultData); clipExtraIndex = new DynamicArrayOf<unsigned short> (Limits::Max_Number_Vertices_Per_Mesh); Register_Pointer(clipExtraIndex); clipExtraTexCoords = new DynamicArrayOf<Vector2DScalar> (Limits::Max_Number_Vertices_Per_Mesh); Register_Pointer(clipExtraTexCoords); visibleIndexedVertices = new DynamicArrayOf<unsigned char> (Limits::Max_Number_Vertices_Per_Mesh); Register_Pointer(visibleIndexedVertices); }
//------------------------------------------------------------------------------ // gosFX::Card::Card( Specification *spec, unsigned flags ): Singleton(DefaultData, spec, flags), m_cardCount(1) { Check_Object(spec); Verify(gos_GetCurrentHeap() == Heap); gos_PushCurrentHeap(MidLevelRenderer::Heap); m_cardCloud = new MidLevelRenderer::MLRCardCloud(1); Register_Object(m_cardCloud); gos_PopCurrentHeap(); m_cardCloud->SetData( &m_cardCount, m_vertices, m_colors, m_uvs ); }
//------------------------------------------------------------------------------ // void gosFX::Effect__Specification::Copy(Effect__Specification *spec) { Check_Object(this); Check_Object(spec); gos_PushCurrentHeap(Heap); Verify(spec->m_class == m_class); m_name = spec->m_name; // //---------------------------------------------- // Copy the events after delete our current ones //---------------------------------------------- // Stuff::ChainIteratorOf<Event*> old_events(&m_events); old_events.DeletePlugs(); Stuff::ChainIteratorOf<Event*> new_events(&spec->m_events); Event* event; while ((event = new_events.ReadAndNext()) != NULL) { Check_Object(event); Event *new_event = new Event(*event); Register_Object(new_event); AdoptEvent(new_event); } // //--------------------------------------------------- // Now copy the curves, variance modes, and MLR state //--------------------------------------------------- // m_lifeSpan = spec->m_lifeSpan; m_minimumChildSeed = spec->m_minimumChildSeed; m_maximumChildSeed = spec->m_maximumChildSeed; m_state = spec->m_state; gos_PopCurrentHeap(); }
//------------------------------------------------------------------------------ // gosFX::Shape__Specification::Shape__Specification( Stuff::MemoryStream *stream, int gfx_version ): Singleton__Specification(gosFX::ShapeClassID, stream, gfx_version) { Check_Pointer(this); Verify(m_class == ShapeClassID); Verify(gos_GetCurrentHeap() == Heap); // //--------------- // Load the shape //--------------- // m_shape = MidLevelRenderer::MLRShape::Make( stream, MidLevelRenderer::ReadMLRVersion(stream) ); Register_Object(m_shape); *stream >> m_radius; }
//------------------------------------------------------------------------------ // gosFX::PointCloud::PointCloud( Specification* spec, uint32_t flags ): ParticleCloud(DefaultData, spec, flags) { Check_Object(spec); //Verify(gos_GetCurrentHeap() == Heap); gos_PushCurrentHeap(MidLevelRenderer::Heap); m_cloudImplementation = new MidLevelRenderer::MLRPointCloud(spec->m_maxParticleCount); Register_Object(m_cloudImplementation); gos_PopCurrentHeap(); uint32_t index = spec->m_maxParticleCount * sizeof(Particle); m_P_localTranslation = Cast_Pointer(Stuff::Point3D*, &m_data[index]); index += spec->m_maxParticleCount * sizeof(Stuff::Point3D); m_P_color = Cast_Pointer(Stuff::RGBAColor*, &m_data[index]); m_cloudImplementation->SetData( Cast_Pointer(pcsize_t, &m_activeParticleCount), m_P_localTranslation, m_P_color ); }