Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

150 lines
4.0 KiB
C++

//===========================================================================//
// 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<WORD>(ranges));
gos_PopCurrentHeap();
//
//--------------------------------------------------------------
// Spin through the ranges, setting the range for each LOD child
//--------------------------------------------------------------
//
for (WORD i=0; i<ranges; ++i)
{
ComponentID component_id;
component_id.scriptResourceID = owning_web->GetScriptResourceID();
*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));
}