leocad/common/lc_scene.h

69 lines
1.6 KiB
C
Raw Normal View History

2017-04-02 01:53:54 +02:00
#pragma once
#include "lc_mesh.h"
#include "lc_array.h"
class lcScene
{
public:
lcScene();
void SetActiveSubmodelInstance(lcPiece* ActiveSubmodelInstance, const lcMatrix44& ActiveSubmodelTransform)
{
mActiveSubmodelInstance = ActiveSubmodelInstance;
mActiveSubmodelTransform = ActiveSubmodelTransform;
}
lcPiece* GetActiveSubmodelInstance() const
{
return mActiveSubmodelInstance;
}
void SetDrawInterface(bool DrawInterface)
{
mDrawInterface = DrawInterface;
}
bool GetDrawInterface() const
{
return mDrawInterface;
}
void SetAllowWireframe(bool AllowWireframe)
{
mAllowWireframe = AllowWireframe;
}
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();
void AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State, int Flags);
void AddInterfaceObject(const lcObject* Object)
{
mInterfaceObjects.Add(Object);
}
void Draw(lcContext* Context) const;
void DrawInterfaceObjects(lcContext* Context) const;
protected:
void DrawRenderMeshes(lcContext* Context, int PrimitiveTypes, bool EnableNormals, bool DrawTranslucent, bool DrawTextured) const;
lcMatrix44 mViewMatrix;
lcMatrix44 mActiveSubmodelTransform;
lcPiece* mActiveSubmodelInstance;
bool mDrawInterface;
bool mAllowWireframe;
2017-04-02 01:53:54 +02:00
lcArray<lcRenderMesh> mRenderMeshes;
lcArray<int> mOpaqueMeshes;
lcArray<int> mTranslucentMeshes;
lcArray<const lcObject*> mInterfaceObjects;
bool mHasTexture;
};