//===========================================================================// // File: D3DRMVideoRenderables.cpp // // Project: MUNGA Brick: Win95 Video Renderer // // Contents: Windows95 Layer Video Renderer // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 03/13/97 JTR Initial coding. // //---------------------------------------------------------------------------// // Copyright (C) 1997, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include "AdeptHeaders.hpp" #include "VideoHeaders.hpp" using namespace ElementRenderer; // // Class Data Support // Component::ClassData* LODComponent::DefaultData = NULL; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void LODComponent::InitializeClass() { Verify(!DefaultData); DefaultData = new ClassData( LODComponentClassID, "Adept::LODComponent", BaseClass::DefaultData, 0, NULL ); Register_Object(DefaultData); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void LODComponent::TerminateClass() { Unregister_Object(DefaultData); delete DefaultData; DefaultData = NULL; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LODComponent::LODComponent( ClassData *shared_data, MemoryStream *stream, VideoComponentWeb *owning_web ): VideoComponent( shared_data, stream, owning_web, AllocateLOD() ) { // //--------------------------- // Get the lOD implementation //--------------------------- // LODElement *lod = GetElement(); Check_Object(lod); // //----------------------------- // Get the number of LOD ranges //----------------------------- // Check_Object(stream); unsigned ranges; *stream >> ranges; Verify(ranges < 65536); gos_PushCurrentHeap(ElementRenderer::LODElement::s_Heap); lod->SetSize(static_cast(ranges)); gos_PopCurrentHeap(); // //-------------------------------------------------------------- // Spin through the ranges, setting the range for each LOD child //-------------------------------------------------------------- // for (WORD i=0; iGetScriptResourceID(); *stream >> component_id.componentNumber; Component *component = owning_web->FindComponent(component_id); Check_Object(component); VideoComponent *child = Cast_Object(VideoComponent*, component); LODElement::Entry entry; *stream >> entry.m_nearSquared >> entry.m_farSquared; lod->AttachLOD(i, child->GetElement(), entry); } // //-------------------------------------- // Set the bounding sphere for this node //-------------------------------------- // lod->NeedNewBounds(); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LODElement* LODComponent::AllocateLOD() { gos_PushCurrentHeap(ElementRenderer::LODElement::s_Heap); LODElement *lod = new LODElement; gos_PopCurrentHeap(); Register_Object(lod); return lod; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LODComponent* LODComponent::Make( MemoryStream *stream, VideoComponentWeb *owning_web ) { LODComponent *lod = new LODComponent(DefaultData, stream, owning_web); return lod; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // void LODComponent::TestInstance() { Verify(IsDerivedFrom(DefaultData)); }