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

159 lines
4.1 KiB
C++

#include "ElementProxyHeaders.hpp"
//----------------------------------------------------------------------------
//
bool
SetExplicitLightingModeProcess::SetExplicitLightingMode(ChildProxy *child, MLRState::LightingMode newLightingMode)
{
Check_Object(this);
Check_Object(child);
if (child->IsDerivedFrom(ElementGroupProxy::DefaultData))
{
ElementGroupProxy *group = Cast_Object(ElementGroupProxy*, child);
return SetExplicitLightingMode(group, newLightingMode);
}
else if (child->IsDerivedFrom(ElementPolygonMeshProxy::DefaultData))
{
ElementPolygonMeshProxy *mesh = Cast_Object(ElementPolygonMeshProxy*, child);
return SetExplicitLightingMode(mesh, newLightingMode);
}
else if (child->IsDerivedFrom(ElementListProxy::DefaultData))
{
return true;
}
STOP(("Shouldn't get here..."));
SetExplicitLightingModeCallback(child);
return false;
}
//----------------------------------------------------------------------------
//
bool
SetExplicitLightingModeProcess::SetExplicitLightingMode(ElementGroupProxy* group, MLRState::LightingMode newLightingMode)
{
Check_Object(this);
Check_Object(group);
//
//---------------------------------------
// Make sure that the process says its OK
//---------------------------------------
//
SetExplicitLightingModeCallback(group);
if (!continueProcess)
return true;
//
//--------------------
// Kill the group name
//--------------------
//
group->SetName(NULL);
//
//-----------------------------
// Run optimize on the children
//-----------------------------
//
unsigned child_count = group->GetChildCount();
ChildProxy *child = group->UseFirstChildProxy();
for (unsigned i=0; i<child_count; ++i)
{
Check_Object(child);
ChildProxy *next = child->UseNextSiblingProxy();
if (SetExplicitLightingMode(child, newLightingMode))
child->DetachReference();
child = next;
if (!continueProcess)
break;
}
//
//-------------------------------------------
// Make sure to discard any remaining proxies
//-------------------------------------------
//
if (child)
child->DetachReference();
return false;
}
//----------------------------------------------------------------------------
//
bool
SetExplicitLightingModeProcess::SetExplicitLightingMode(ElementPolygonMeshProxy* mesh, MLRState::LightingMode newLightingMode)
{
Check_Object(this);
Check_Object(mesh);
//
//---------------------------------------
// Make sure that the process says its OK
//---------------------------------------
//
SetExplicitLightingModeCallback(mesh);
if (!continueProcess)
return true;
//
// Set the Lighting mode
//
unsigned unique_combinations = mesh->GetPrimitiveCount();
for (int i = 0; i < unique_combinations; i++)
{
MLR_I_PMesh *primitive = mesh->GetPrimitive(i);
Check_Object(primitive);
MLRState state = primitive->GetReferenceState();
state.SetLightingMode(newLightingMode);
primitive->SetReferenceState(state);
}
return true;
}
//----------------------------------------------------------------------------
//
void
SetExplicitLightingModeProcess::SetExplicitLightingMode(ElementSceneProxy* scene, MLRState::LightingMode newLightingMode)
{
Check_Object(this);
Check_Object(scene);
//
//---------------------------------------
// Make sure that the process says its OK
//---------------------------------------
//
SetExplicitLightingModeCallback(scene);
if (!continueProcess)
return;
//
//-----------------------------
// Run optimize on the children
//-----------------------------
//
ChildProxy *child = scene->UseFirstChildProxy();
while (child)
{
Check_Object(child);
ChildProxy *next = child->UseNextSiblingProxy();
if (SetExplicitLightingMode(child, newLightingMode))
child->DetachReference();
child = next;
if (!continueProcess)
break;
}
//
//-------------------------------------------
// Make sure to discard any remaining proxies
//-------------------------------------------
//
if (child)
child->DetachReference();
}