2017-04-02 01:53:54 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "lc_mesh.h"
|
|
|
|
#include "lc_array.h"
|
|
|
|
|
2019-11-23 01:47:58 +01:00
|
|
|
enum class lcRenderMeshState : int
|
2019-11-13 00:11:03 +01:00
|
|
|
{
|
2019-11-23 01:47:58 +01:00
|
|
|
NORMAL,
|
|
|
|
SELECTED,
|
|
|
|
FOCUSED,
|
|
|
|
DISABLED,
|
|
|
|
HIGHLIGHT
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcRenderMesh
|
|
|
|
{
|
|
|
|
lcMatrix44 WorldMatrix;
|
|
|
|
lcMesh* Mesh;
|
|
|
|
int ColorIndex;
|
|
|
|
int LodIndex;
|
|
|
|
lcRenderMeshState State;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lcTranslucentMeshInstance
|
|
|
|
{
|
|
|
|
const lcMeshSection* Section;
|
|
|
|
int RenderMeshIndex;
|
|
|
|
float Distance;
|
2019-11-13 00:11:03 +01:00
|
|
|
};
|
|
|
|
|
2017-04-02 01:53:54 +02:00
|
|
|
class lcScene
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
lcScene();
|
|
|
|
|
2018-04-08 02:17:32 +02:00
|
|
|
void SetActiveSubmodelInstance(lcPiece* ActiveSubmodelInstance, const lcMatrix44& ActiveSubmodelTransform)
|
2018-04-07 20:45:00 +02:00
|
|
|
{
|
|
|
|
mActiveSubmodelInstance = ActiveSubmodelInstance;
|
2018-04-08 02:17:32 +02:00
|
|
|
mActiveSubmodelTransform = ActiveSubmodelTransform;
|
2018-04-07 20:45:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
lcPiece* GetActiveSubmodelInstance() const
|
|
|
|
{
|
|
|
|
return mActiveSubmodelInstance;
|
|
|
|
}
|
|
|
|
|
2019-11-16 21:15:49 +01:00
|
|
|
const lcMatrix44& GetViewMatrix() const
|
|
|
|
{
|
|
|
|
return mViewMatrix;
|
|
|
|
}
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
void SetDrawInterface(bool DrawInterface)
|
|
|
|
{
|
|
|
|
mDrawInterface = DrawInterface;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetDrawInterface() const
|
|
|
|
{
|
|
|
|
return mDrawInterface;
|
|
|
|
}
|
|
|
|
|
2018-04-08 00:28:44 +02:00
|
|
|
void SetAllowWireframe(bool AllowWireframe)
|
|
|
|
{
|
|
|
|
mAllowWireframe = AllowWireframe;
|
|
|
|
}
|
|
|
|
|
2019-11-28 21:47:19 +01:00
|
|
|
void SetAllowLOD(bool AllowLOD)
|
|
|
|
{
|
|
|
|
mAllowLOD = AllowLOD;
|
|
|
|
}
|
|
|
|
|
2018-04-08 02:17:32 +02:00
|
|
|
lcMatrix44 ApplyActiveSubmodelTransform(const lcMatrix44& WorldMatrix) const
|
|
|
|
{
|
|
|
|
return !mActiveSubmodelInstance ? WorldMatrix : lcMul(WorldMatrix, mActiveSubmodelTransform);
|
|
|
|
}
|
|
|
|
|
2017-04-02 01:53:54 +02:00
|
|
|
void Begin(const lcMatrix44& ViewMatrix);
|
|
|
|
void End();
|
2019-07-21 17:56:37 +02:00
|
|
|
void AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
void AddInterfaceObject(const lcObject* Object)
|
|
|
|
{
|
|
|
|
mInterfaceObjects.Add(Object);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw(lcContext* Context) const;
|
|
|
|
void DrawInterfaceObjects(lcContext* Context) const;
|
|
|
|
|
|
|
|
protected:
|
2019-11-23 01:47:58 +01:00
|
|
|
void DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTypes) const;
|
|
|
|
void DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const;
|
|
|
|
void DrawDebugNormals(lcContext* Context, lcMesh* Mesh) const;
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
lcMatrix44 mViewMatrix;
|
2018-04-08 02:17:32 +02:00
|
|
|
lcMatrix44 mActiveSubmodelTransform;
|
2018-04-07 20:45:00 +02:00
|
|
|
lcPiece* mActiveSubmodelInstance;
|
|
|
|
bool mDrawInterface;
|
2018-04-08 00:28:44 +02:00
|
|
|
bool mAllowWireframe;
|
2019-11-28 21:47:19 +01:00
|
|
|
bool mAllowLOD;
|
2018-04-07 20:45:00 +02:00
|
|
|
|
2017-04-02 01:53:54 +02:00
|
|
|
lcArray<lcRenderMesh> mRenderMeshes;
|
|
|
|
lcArray<int> mOpaqueMeshes;
|
2019-11-23 01:47:58 +01:00
|
|
|
lcArray<lcTranslucentMeshInstance> mTranslucentMeshes;
|
2017-04-02 01:53:54 +02:00
|
|
|
lcArray<const lcObject*> mInterfaceObjects;
|
|
|
|
};
|