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.
201 lines
4.3 KiB
C++
201 lines
4.3 KiB
C++
#pragma once
|
|
|
|
#include "ElementRenderer.hpp"
|
|
#include "ShapeLODElement.hpp"
|
|
|
|
namespace MidLevelRenderer {
|
|
class MLRShape;
|
|
}
|
|
|
|
//#########################################################################
|
|
//######################### TreeElement ###############################
|
|
//#########################################################################
|
|
|
|
namespace ElementRenderer {
|
|
|
|
class GroupElement;
|
|
|
|
class TreeElement:
|
|
public Element
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Initialization
|
|
//
|
|
public:
|
|
static void InitializeClass();
|
|
static void TerminateClass();
|
|
static ClassData *DefaultData;
|
|
|
|
typedef Element BaseClass;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Constructors/Destructors
|
|
//
|
|
protected:
|
|
TreeElement(
|
|
Stuff::MemoryStream *stream,
|
|
int version,
|
|
ShapeHolder shapes
|
|
);
|
|
|
|
public:
|
|
TreeElement();
|
|
~TreeElement();
|
|
|
|
static TreeElement* Make(
|
|
Stuff::MemoryStream *stream,
|
|
int version,
|
|
ShapeHolder shapes=NULL
|
|
);
|
|
|
|
void Save(Stuff::MemoryStream *stream);
|
|
|
|
static HGOSHEAP s_Heap;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Testing
|
|
//
|
|
public:
|
|
void TestInstance();
|
|
bool CheckBounds();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Hierarchy
|
|
//
|
|
protected:
|
|
void AttachChild(Element *child);
|
|
void DetachChild(Element *child);
|
|
|
|
public:
|
|
struct Entry
|
|
{
|
|
Stuff::Scalar
|
|
m_nearSquared,
|
|
m_fadeInSquared,
|
|
m_fadeOutSquared,
|
|
m_farSquared;
|
|
};
|
|
|
|
void AttachLOD(
|
|
WORD index,
|
|
MidLevelRenderer::MLRShape *shape,
|
|
const Entry& ranges
|
|
);
|
|
int AttachLODFirstAvailableSlot(
|
|
MidLevelRenderer::MLRShape *shape,
|
|
const Entry &ranges
|
|
);
|
|
void GetLOD(
|
|
WORD index,
|
|
MidLevelRenderer::MLRShape **shape,
|
|
const Entry** ranges
|
|
);
|
|
|
|
void SetLOD(
|
|
WORD index,
|
|
const Entry &ranges
|
|
);
|
|
|
|
void SetSize(WORD max_size);
|
|
WORD GetSize();
|
|
|
|
WORD m_startAligningAt;
|
|
int m_alignType;
|
|
|
|
protected:
|
|
Stuff::DynamicArrayOf<Entry> m_ranges;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Sync support
|
|
//
|
|
public:
|
|
const Stuff::LinearMatrix4D& GetWorldToLocal()
|
|
{
|
|
Check_Object(this); Check_Object(&m_worldToLocal);
|
|
return m_worldToLocal;
|
|
}
|
|
|
|
protected:
|
|
void SetSyncState();
|
|
static SyncMethod SyncMethods[SyncStateCount];
|
|
|
|
Stuff::LinearMatrix4D m_worldToLocal;
|
|
|
|
void DirtySyncMethod();
|
|
|
|
void CleanSphereSyncMethod();
|
|
void DirtySphereSyncMethod();
|
|
|
|
void CleanOBBSyncMethod();
|
|
void DirtyOBBSyncMethod();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Collision
|
|
//
|
|
protected:
|
|
bool CastCulledRay(CollisionQuery *query);
|
|
Element* FindSmallestElementContainingCulled(SphereTest *test);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Drawing
|
|
//
|
|
protected:
|
|
void SetDrawState();
|
|
|
|
static DrawMethod DrawMethods[DrawStateCount];
|
|
|
|
void InheritDrawMethod(
|
|
CameraElement *camera,
|
|
const StateChange *inherited_state,
|
|
int clipping_state
|
|
);
|
|
void OverrideDrawMethod(
|
|
CameraElement *camera,
|
|
const StateChange *inherited_state,
|
|
int clipping_state
|
|
);
|
|
|
|
int CullLights(
|
|
LightList culled_lights,
|
|
const LightList lights
|
|
);
|
|
|
|
int CountTriangles();
|
|
|
|
public:
|
|
void CleanDamage();
|
|
|
|
void ApplyDamage(
|
|
const Stuff::LinearMatrix4D &damage_spot,
|
|
Stuff::Scalar radius
|
|
);
|
|
|
|
void ApplyDamageDecal(
|
|
const Stuff::LinearMatrix4D &damage_spot,
|
|
Stuff::Scalar radius,
|
|
MidLevelRenderer::MLRTexture *texture
|
|
);
|
|
|
|
void CastShadow(
|
|
const Stuff::LinearMatrix4D &shadow_to_world,
|
|
const Stuff::UnitVector3D &sun_in_world,
|
|
Stuff::Scalar radius
|
|
);
|
|
|
|
void MakeFootStep(
|
|
MidLevelRenderer::MLRShape *shape,
|
|
const Stuff::LinearMatrix4D &foot,
|
|
Stuff::Scalar radius,
|
|
MidLevelRenderer::MLRTexture *tex
|
|
);
|
|
|
|
MidLevelRenderer::MLRShape* GetMLRShape(CameraElement *camera=NULL);
|
|
|
|
void GetCoordData(Stuff::DynamicArrayOf<Stuff::Point3D> *array);
|
|
|
|
protected:
|
|
Stuff::DynamicArrayOf<MidLevelRenderer::MLRShape*> m_MLRShapes;
|
|
};
|
|
|
|
}
|