2017-04-02 01:53:54 +02:00
|
|
|
#include "lc_global.h"
|
|
|
|
#include "lc_scene.h"
|
|
|
|
#include "lc_context.h"
|
|
|
|
#include "pieceinf.h"
|
|
|
|
#include "lc_texture.h"
|
|
|
|
#include "lc_library.h"
|
|
|
|
#include "lc_application.h"
|
|
|
|
#include "object.h"
|
|
|
|
|
|
|
|
lcScene::lcScene()
|
|
|
|
: mRenderMeshes(0, 1024), mOpaqueMeshes(0, 1024), mTranslucentMeshes(0, 1024), mInterfaceObjects(0, 1024)
|
|
|
|
{
|
2018-04-07 20:45:00 +02:00
|
|
|
mActiveSubmodelInstance = nullptr;
|
2018-04-08 00:28:44 +02:00
|
|
|
mAllowWireframe = true;
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcScene::Begin(const lcMatrix44& ViewMatrix)
|
|
|
|
{
|
|
|
|
mViewMatrix = ViewMatrix;
|
2018-04-07 20:45:00 +02:00
|
|
|
mActiveSubmodelInstance = nullptr;
|
|
|
|
mDrawInterface = false;
|
2017-04-02 01:53:54 +02:00
|
|
|
mRenderMeshes.RemoveAll();
|
|
|
|
mOpaqueMeshes.RemoveAll();
|
|
|
|
mTranslucentMeshes.RemoveAll();
|
|
|
|
mInterfaceObjects.RemoveAll();
|
|
|
|
mHasTexture = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcScene::End()
|
|
|
|
{
|
|
|
|
auto OpaqueMeshCompare = [this](int Index1, int Index2)
|
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
const lcMesh* Mesh1 = mRenderMeshes[Index1].Mesh;
|
|
|
|
const lcMesh* Mesh2 = mRenderMeshes[Index2].Mesh;
|
|
|
|
|
|
|
|
int Texture1 = Mesh1->mFlags & lcMeshFlag::HasTexture;
|
|
|
|
int Texture2 = Mesh2->mFlags & lcMeshFlag::HasTexture;
|
|
|
|
|
|
|
|
if (Texture1 == Texture2)
|
|
|
|
return Mesh1 < Mesh2;
|
|
|
|
|
|
|
|
return Texture1 ? false : true;
|
2017-04-02 01:53:54 +02:00
|
|
|
};
|
|
|
|
|
2019-03-29 01:59:58 +01:00
|
|
|
std::sort(mOpaqueMeshes.begin(), mOpaqueMeshes.end(), OpaqueMeshCompare);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
auto TranslucentMeshCompare = [this](int Index1, int Index2)
|
|
|
|
{
|
|
|
|
return mRenderMeshes[Index1].Distance < mRenderMeshes[Index2].Distance;
|
|
|
|
};
|
|
|
|
|
2019-03-29 01:59:58 +01:00
|
|
|
std::sort(mTranslucentMeshes.begin(), mTranslucentMeshes.end(), TranslucentMeshCompare);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
2019-07-21 17:56:37 +02:00
|
|
|
void lcScene::AddMesh(lcMesh* Mesh, const lcMatrix44& WorldMatrix, int ColorIndex, lcRenderMeshState State)
|
2017-04-02 01:53:54 +02:00
|
|
|
{
|
|
|
|
lcRenderMesh& RenderMesh = mRenderMeshes.Add();
|
|
|
|
|
|
|
|
RenderMesh.WorldMatrix = WorldMatrix;
|
|
|
|
RenderMesh.Mesh = Mesh;
|
|
|
|
RenderMesh.ColorIndex = ColorIndex;
|
|
|
|
RenderMesh.State = State;
|
|
|
|
RenderMesh.Distance = fabsf(lcMul31(WorldMatrix[3], mViewMatrix).z);
|
|
|
|
RenderMesh.LodIndex = RenderMesh.Mesh->GetLodIndex(RenderMesh.Distance);
|
|
|
|
|
|
|
|
bool Translucent = lcIsColorTranslucent(ColorIndex);
|
2019-07-21 17:56:37 +02:00
|
|
|
lcMeshFlags Flags = Mesh->mFlags;
|
2017-04-02 01:53:54 +02:00
|
|
|
|
2019-07-21 17:56:37 +02:00
|
|
|
if ((Flags & (lcMeshFlag::HasSolid | lcMeshFlag::HasLines)) || ((Flags & lcMeshFlag::HasDefault) && !Translucent))
|
2017-04-02 01:53:54 +02:00
|
|
|
mOpaqueMeshes.Add(mRenderMeshes.GetSize() - 1);
|
|
|
|
|
2019-07-21 17:56:37 +02:00
|
|
|
if ((Flags & lcMeshFlag::HasTranslucent) || ((Flags & lcMeshFlag::HasDefault) && Translucent))
|
2017-04-02 01:53:54 +02:00
|
|
|
mTranslucentMeshes.Add(mRenderMeshes.GetSize() - 1);
|
|
|
|
|
2019-07-21 17:56:37 +02:00
|
|
|
if (Flags & lcMeshFlag::HasTexture)
|
2017-04-02 01:53:54 +02:00
|
|
|
mHasTexture = true;
|
|
|
|
}
|
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
void lcScene::DrawPass(lcContext* Context, lcRenderPass RenderPass, int PrimitiveTypes) const
|
2017-04-02 01:53:54 +02:00
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
bool IsTranslucent = (RenderPass == lcRenderPass::UnlitTranslucent || RenderPass == lcRenderPass::LitTranslucent);
|
|
|
|
const lcArray<int>& Meshes = IsTranslucent ? mTranslucentMeshes : mOpaqueMeshes;
|
|
|
|
|
|
|
|
if (Meshes.IsEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
bool IsLit = (RenderPass == lcRenderPass::LitOpaque || RenderPass == lcRenderPass::LitTranslucent);
|
|
|
|
lcMaterialType FlatMaterial, TexturedMaterial;
|
|
|
|
|
|
|
|
if (IsLit)
|
|
|
|
{
|
|
|
|
FlatMaterial = LC_MATERIAL_FAKELIT_COLOR;
|
|
|
|
TexturedMaterial = LC_MATERIAL_FAKELIT_TEXTURE_DECAL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FlatMaterial = LC_MATERIAL_UNLIT_COLOR;
|
|
|
|
TexturedMaterial = LC_MATERIAL_UNLIT_TEXTURE_DECAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsTranslucent)
|
|
|
|
{
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
Context->SetDepthWrite(false);
|
|
|
|
Context->SetPolygonOffset(LC_POLYGON_OFFSET_TRANSLUCENT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
for (int MeshIndex : Meshes)
|
|
|
|
{
|
|
|
|
const lcRenderMesh& RenderMesh = mRenderMeshes[MeshIndex];
|
|
|
|
const lcMesh* Mesh = RenderMesh.Mesh;
|
|
|
|
int LodIndex = RenderMesh.LodIndex;
|
|
|
|
|
|
|
|
Context->BindMesh(Mesh);
|
|
|
|
Context->SetWorldMatrix(RenderMesh.WorldMatrix);
|
|
|
|
|
|
|
|
for (int SectionIdx = 0; SectionIdx < Mesh->mLods[LodIndex].NumSections; SectionIdx++)
|
|
|
|
{
|
|
|
|
lcMeshSection* Section = &Mesh->mLods[LodIndex].Sections[SectionIdx];
|
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
if ((Section->PrimitiveType & PrimitiveTypes) == 0)
|
2017-04-02 01:53:54 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
int ColorIndex = Section->ColorIndex;
|
|
|
|
|
|
|
|
if (Section->PrimitiveType & (LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES))
|
|
|
|
{
|
|
|
|
if (ColorIndex == gDefaultColor)
|
|
|
|
ColorIndex = RenderMesh.ColorIndex;
|
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
if (lcIsColorTranslucent(ColorIndex) != IsTranslucent)
|
2017-04-02 01:53:54 +02:00
|
|
|
continue;
|
|
|
|
|
|
|
|
switch (RenderMesh.State)
|
|
|
|
{
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::NORMAL:
|
|
|
|
case lcRenderMeshState::HIGHLIGHT:
|
2017-04-02 01:53:54 +02:00
|
|
|
Context->SetColorIndex(ColorIndex);
|
|
|
|
break;
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::SELECTED:
|
2018-03-29 19:20:36 +02:00
|
|
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_SELECTED, 0.5f);
|
2017-04-02 01:53:54 +02:00
|
|
|
break;
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::FOCUSED:
|
2018-03-29 19:20:36 +02:00
|
|
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_FOCUSED, 0.5f);
|
|
|
|
break;
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::DISABLED:
|
2018-03-29 19:20:36 +02:00
|
|
|
Context->SetColorIndexTinted(ColorIndex, LC_COLOR_DISABLED, 0.25f);
|
2017-04-02 01:53:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-11-02 19:38:24 +01:00
|
|
|
else if (Section->PrimitiveType & LC_MESH_LINES)
|
2017-04-02 01:53:54 +02:00
|
|
|
{
|
|
|
|
switch (RenderMesh.State)
|
|
|
|
{
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::NORMAL:
|
2017-04-02 01:53:54 +02:00
|
|
|
if (ColorIndex == gEdgeColor)
|
|
|
|
Context->SetEdgeColorIndex(RenderMesh.ColorIndex);
|
|
|
|
else
|
|
|
|
Context->SetColorIndex(ColorIndex);
|
|
|
|
break;
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::SELECTED:
|
2017-04-02 01:53:54 +02:00
|
|
|
Context->SetInterfaceColor(LC_COLOR_SELECTED);
|
|
|
|
break;
|
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::FOCUSED:
|
2017-04-02 01:53:54 +02:00
|
|
|
Context->SetInterfaceColor(LC_COLOR_FOCUSED);
|
|
|
|
break;
|
2017-06-20 03:30:54 +02:00
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::HIGHLIGHT:
|
2017-06-20 03:30:54 +02:00
|
|
|
Context->SetInterfaceColor(LC_COLOR_HIGHLIGHT);
|
|
|
|
break;
|
2018-03-29 19:20:36 +02:00
|
|
|
|
2018-04-07 20:45:00 +02:00
|
|
|
case lcRenderMeshState::DISABLED:
|
2018-03-29 19:20:36 +02:00
|
|
|
Context->SetInterfaceColor(LC_COLOR_DISABLED);
|
|
|
|
break;
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Section->PrimitiveType == LC_MESH_CONDITIONAL_LINES)
|
|
|
|
{
|
|
|
|
lcMatrix44 WorldViewProjectionMatrix = lcMul(RenderMesh.WorldMatrix, lcMul(mViewMatrix, Context->GetProjectionMatrix()));
|
|
|
|
lcVertex* VertexBuffer = (lcVertex*)Mesh->mVertexData;
|
|
|
|
int IndexBufferOffset = Mesh->mIndexCacheOffset != -1 ? Mesh->mIndexCacheOffset : 0;
|
|
|
|
|
2017-06-23 03:45:45 +02:00
|
|
|
int VertexBufferOffset = Mesh->mVertexCacheOffset != -1 ? Mesh->mVertexCacheOffset : 0;
|
2019-11-13 00:11:03 +01:00
|
|
|
Context->SetVertexFormat(VertexBufferOffset, 3, 1, 0, 0, IsLit);
|
2017-06-23 03:45:45 +02:00
|
|
|
|
2017-04-02 01:53:54 +02:00
|
|
|
if (Mesh->mIndexType == GL_UNSIGNED_SHORT)
|
|
|
|
{
|
2017-12-02 21:22:04 +01:00
|
|
|
quint16* Indices = (quint16*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < Section->NumIndices; i += 4)
|
|
|
|
{
|
|
|
|
lcVector3 p1 = lcMul31(VertexBuffer[Indices[i + 0]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p2 = lcMul31(VertexBuffer[Indices[i + 1]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p3 = lcMul31(VertexBuffer[Indices[i + 2]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
|
|
|
|
|
|
|
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
2017-12-02 21:22:04 +01:00
|
|
|
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(quint16));
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-12-02 21:22:04 +01:00
|
|
|
quint32* Indices = (quint32*)((char*)Mesh->mIndexData + Section->IndexOffset);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < Section->NumIndices; i += 4)
|
|
|
|
{
|
|
|
|
lcVector3 p1 = lcMul31(VertexBuffer[Indices[i + 0]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p2 = lcMul31(VertexBuffer[Indices[i + 1]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p3 = lcMul31(VertexBuffer[Indices[i + 2]].Position, WorldViewProjectionMatrix);
|
|
|
|
lcVector3 p4 = lcMul31(VertexBuffer[Indices[i + 3]].Position, WorldViewProjectionMatrix);
|
|
|
|
|
|
|
|
if (((p1.y - p2.y) * (p3.x - p1.x) + (p2.x - p1.x) * (p3.y - p1.y)) * ((p1.y - p2.y) * (p4.x - p1.x) + (p2.x - p1.x) * (p4.y - p1.y)) >= 0)
|
2017-12-02 21:22:04 +01:00
|
|
|
Context->DrawIndexedPrimitives(GL_LINES, 2, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset + i * sizeof(quint32));
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
}
|
2017-06-23 03:45:45 +02:00
|
|
|
|
|
|
|
continue;
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
lcTexture* Texture = Section->Texture;
|
|
|
|
int VertexBufferOffset = Mesh->mVertexCacheOffset != -1 ? Mesh->mVertexCacheOffset : 0;
|
|
|
|
int IndexBufferOffset = Mesh->mIndexCacheOffset != -1 ? Mesh->mIndexCacheOffset : 0;
|
|
|
|
|
|
|
|
if (!Texture)
|
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
Context->SetMaterial(FlatMaterial);
|
|
|
|
Context->SetVertexFormat(VertexBufferOffset, 3, 1, 0, 0, IsLit);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
Context->SetMaterial(TexturedMaterial);
|
2017-04-02 01:53:54 +02:00
|
|
|
VertexBufferOffset += Mesh->mNumVertices * sizeof(lcVertex);
|
2019-11-13 00:11:03 +01:00
|
|
|
Context->SetVertexFormat(VertexBufferOffset, 3, 1, 2, 0, IsLit);
|
2017-12-26 19:19:20 +01:00
|
|
|
Context->BindTexture2D(Texture->mTexture);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GLenum DrawPrimitiveType = Section->PrimitiveType & (LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES) ? GL_TRIANGLES : GL_LINES;
|
|
|
|
Context->DrawIndexedPrimitives(DrawPrimitiveType, Section->NumIndices, Mesh->mIndexType, IndexBufferOffset + Section->IndexOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
const bool DrawNormals = false;
|
|
|
|
|
|
|
|
if (DrawNormals)
|
|
|
|
{
|
|
|
|
lcVertex* VertexBuffer = (lcVertex*)Mesh->mVertexData;
|
|
|
|
lcVector3* Vertices = (lcVector3*)malloc(Mesh->mNumVertices * 2 * sizeof(lcVector3));
|
|
|
|
|
|
|
|
for (int VertexIdx = 0; VertexIdx < Mesh->mNumVertices; VertexIdx++)
|
|
|
|
{
|
|
|
|
Vertices[VertexIdx * 2] = VertexBuffer[VertexIdx].Position;
|
|
|
|
Vertices[VertexIdx * 2 + 1] = VertexBuffer[VertexIdx].Position + lcUnpackNormal(VertexBuffer[VertexIdx].Normal);
|
|
|
|
}
|
|
|
|
|
|
|
|
Context->SetVertexBufferPointer(Vertices);
|
|
|
|
Context->SetVertexFormatPosition(3);
|
|
|
|
Context->DrawPrimitives(GL_LINES, 0, Mesh->mNumVertices * 2);
|
|
|
|
free(Vertices);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2019-11-13 00:11:03 +01:00
|
|
|
|
|
|
|
if (IsTranslucent)
|
|
|
|
{
|
|
|
|
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
|
|
|
|
Context->SetDepthWrite(true);
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
}
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcScene::Draw(lcContext* Context) const
|
|
|
|
{
|
2017-12-22 14:42:28 +01:00
|
|
|
// TODO: find a better place for these updates
|
|
|
|
lcGetPiecesLibrary()->UpdateBuffers(Context);
|
2018-09-30 04:45:21 +02:00
|
|
|
lcGetPiecesLibrary()->UploadTextures(Context);
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
Context->SetViewMatrix(mViewMatrix);
|
|
|
|
|
2017-06-23 03:45:45 +02:00
|
|
|
const bool DrawConditional = false;
|
2018-07-31 20:33:32 +02:00
|
|
|
const lcPreferences& Preferences = lcGetPreferences();
|
2017-06-23 03:45:45 +02:00
|
|
|
|
2018-07-31 20:33:32 +02:00
|
|
|
lcShadingMode ShadingMode = Preferences.mShadingMode;
|
2018-04-08 00:28:44 +02:00
|
|
|
if (ShadingMode == LC_SHADING_WIREFRAME && !mAllowWireframe)
|
|
|
|
ShadingMode = LC_SHADING_FLAT;
|
2017-08-25 21:57:14 +02:00
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
Context->BindTexture2D(0);
|
2019-11-10 03:11:25 +01:00
|
|
|
|
2017-11-26 00:47:37 +01:00
|
|
|
if (ShadingMode == LC_SHADING_WIREFRAME)
|
2017-04-02 01:53:54 +02:00
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
int PrimitiveTypes = LC_MESH_LINES;
|
2017-11-26 00:47:37 +01:00
|
|
|
|
|
|
|
if (DrawConditional)
|
2019-11-13 00:11:03 +01:00
|
|
|
PrimitiveTypes |= LC_MESH_CONDITIONAL_LINES;
|
2017-08-25 21:57:14 +02:00
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
DrawPass(Context, lcRenderPass::UnlitOpaque, PrimitiveTypes);
|
2017-11-26 00:47:37 +01:00
|
|
|
}
|
|
|
|
else if (ShadingMode == LC_SHADING_FLAT)
|
|
|
|
{
|
2018-07-31 20:33:32 +02:00
|
|
|
bool DrawLines = Preferences.mDrawEdgeLines && Preferences.mLineWidth != 0.0f;
|
2017-04-02 01:53:54 +02:00
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
int PrimitiveTypes = LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES;
|
2017-06-23 03:45:45 +02:00
|
|
|
|
2017-04-02 01:53:54 +02:00
|
|
|
if (DrawLines)
|
2017-06-23 03:45:45 +02:00
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
PrimitiveTypes |= LC_MESH_LINES;
|
2017-06-23 03:45:45 +02:00
|
|
|
|
|
|
|
if (DrawConditional)
|
2019-11-13 00:11:03 +01:00
|
|
|
PrimitiveTypes |= LC_MESH_CONDITIONAL_LINES;
|
2019-11-09 20:54:17 +01:00
|
|
|
}
|
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
DrawPass(Context, lcRenderPass::UnlitOpaque, PrimitiveTypes);
|
|
|
|
DrawPass(Context, lcRenderPass::UnlitTranslucent, LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-07-31 20:33:32 +02:00
|
|
|
bool DrawLines = Preferences.mDrawEdgeLines && Preferences.mLineWidth != 0.0f;
|
2017-04-02 01:53:54 +02:00
|
|
|
|
|
|
|
if (DrawLines)
|
|
|
|
{
|
2019-11-13 00:11:03 +01:00
|
|
|
int PrimitiveTypes = LC_MESH_LINES;
|
2017-06-23 03:45:45 +02:00
|
|
|
|
|
|
|
if (DrawConditional)
|
2019-11-13 00:11:03 +01:00
|
|
|
PrimitiveTypes |= LC_MESH_CONDITIONAL_LINES;
|
2017-06-23 03:45:45 +02:00
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
DrawPass(Context, lcRenderPass::UnlitOpaque, PrimitiveTypes);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
2019-11-13 00:11:03 +01:00
|
|
|
DrawPass(Context, lcRenderPass::LitOpaque, LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES);
|
|
|
|
DrawPass(Context, lcRenderPass::LitTranslucent, LC_MESH_TRIANGLES | LC_MESH_TEXTURED_TRIANGLES);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
2019-11-13 00:11:03 +01:00
|
|
|
|
|
|
|
Context->BindTexture2D(0);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcScene::DrawInterfaceObjects(lcContext* Context) const
|
|
|
|
{
|
|
|
|
for (const lcObject* Object : mInterfaceObjects)
|
2018-04-08 02:17:32 +02:00
|
|
|
Object->DrawInterface(Context, *this);
|
2017-04-02 01:53:54 +02:00
|
|
|
}
|