mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Scoped enums and constexpr.
This commit is contained in:
parent
ade7334fa1
commit
90f1336a48
18 changed files with 186 additions and 188 deletions
|
@ -500,7 +500,7 @@ void lcCamera::CopySettings(const lcCamera* camera)
|
||||||
void lcCamera::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
void lcCamera::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(Scene);
|
Q_UNUSED(Scene);
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
|
|
||||||
lcMatrix44 ViewWorldMatrix = lcMatrix44AffineInverse(mWorldView);
|
lcMatrix44 ViewWorldMatrix = lcMatrix44AffineInverse(mWorldView);
|
||||||
ViewWorldMatrix.SetTranslation(lcVector3(0, 0, 0));
|
ViewWorldMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||||
|
|
|
@ -16,7 +16,7 @@ void lcPreferences::LoadDefaults()
|
||||||
{
|
{
|
||||||
mFixedAxes = lcGetProfileInt(LC_PROFILE_FIXED_AXES);
|
mFixedAxes = lcGetProfileInt(LC_PROFILE_FIXED_AXES);
|
||||||
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
|
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
|
||||||
mShadingMode = (lcShadingMode)lcGetProfileInt(LC_PROFILE_SHADING_MODE);
|
mShadingMode = static_cast<lcShadingMode>(lcGetProfileInt(LC_PROFILE_SHADING_MODE));
|
||||||
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
|
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
|
||||||
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
||||||
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
||||||
|
@ -28,7 +28,7 @@ void lcPreferences::LoadDefaults()
|
||||||
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
||||||
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
||||||
mViewSphereEnabled = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_ENABLED);
|
mViewSphereEnabled = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_ENABLED);
|
||||||
mViewSphereLocation = (lcViewSphereLocation)lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION);
|
mViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_LOCATION));
|
||||||
mViewSphereSize = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE);
|
mViewSphereSize = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_SIZE);
|
||||||
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR);
|
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_COLOR);
|
||||||
mViewSphereTextColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_TEXT_COLOR);
|
mViewSphereTextColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_TEXT_COLOR);
|
||||||
|
@ -41,7 +41,7 @@ void lcPreferences::SaveDefaults()
|
||||||
{
|
{
|
||||||
lcSetProfileInt(LC_PROFILE_FIXED_AXES, mFixedAxes);
|
lcSetProfileInt(LC_PROFILE_FIXED_AXES, mFixedAxes);
|
||||||
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
|
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
|
||||||
lcSetProfileInt(LC_PROFILE_SHADING_MODE, mShadingMode);
|
lcSetProfileInt(LC_PROFILE_SHADING_MODE, static_cast<int>(mShadingMode));
|
||||||
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
|
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
|
||||||
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
||||||
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
||||||
|
@ -340,13 +340,13 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
||||||
ParseString(ShadingString, true);
|
ParseString(ShadingString, true);
|
||||||
|
|
||||||
if (ShadingString == QLatin1String("wireframe"))
|
if (ShadingString == QLatin1String("wireframe"))
|
||||||
mPreferences.mShadingMode = LC_SHADING_WIREFRAME;
|
mPreferences.mShadingMode = lcShadingMode::Wireframe;
|
||||||
else if (ShadingString == QLatin1String("flat"))
|
else if (ShadingString == QLatin1String("flat"))
|
||||||
mPreferences.mShadingMode = LC_SHADING_FLAT;
|
mPreferences.mShadingMode = lcShadingMode::Flat;
|
||||||
else if (ShadingString == QLatin1String("default"))
|
else if (ShadingString == QLatin1String("default"))
|
||||||
mPreferences.mShadingMode = LC_SHADING_DEFAULT_LIGHTS;
|
mPreferences.mShadingMode = lcShadingMode::DefaultLights;
|
||||||
else if (ShadingString == QLatin1String("full"))
|
else if (ShadingString == QLatin1String("full"))
|
||||||
mPreferences.mShadingMode = LC_SHADING_FULL;
|
mPreferences.mShadingMode = lcShadingMode::Full;
|
||||||
}
|
}
|
||||||
else if (Param == QLatin1String("--line-width"))
|
else if (Param == QLatin1String("--line-width"))
|
||||||
ParseFloat(mPreferences.mLineWidth);
|
ParseFloat(mPreferences.mLineWidth);
|
||||||
|
|
|
@ -5,21 +5,20 @@
|
||||||
class Project;
|
class Project;
|
||||||
class lcPiecesLibrary;
|
class lcPiecesLibrary;
|
||||||
|
|
||||||
enum lcShadingMode
|
enum class lcShadingMode
|
||||||
{
|
{
|
||||||
LC_SHADING_WIREFRAME,
|
Wireframe,
|
||||||
LC_SHADING_FLAT,
|
Flat,
|
||||||
LC_SHADING_DEFAULT_LIGHTS,
|
DefaultLights,
|
||||||
LC_SHADING_FULL,
|
Full
|
||||||
LC_NUM_SHADING_MODES
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class lcViewSphereLocation
|
enum class lcViewSphereLocation
|
||||||
{
|
{
|
||||||
TOP_LEFT,
|
TopLeft,
|
||||||
TOP_RIGHT,
|
TopRight,
|
||||||
BOTTOM_LEFT,
|
BottomLeft,
|
||||||
BOTTOM_RIGHT
|
BottomRight
|
||||||
};
|
};
|
||||||
|
|
||||||
class lcPreferences
|
class lcPreferences
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
|
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lcProgram lcContext::mPrograms[LC_NUM_MATERIALS];
|
lcProgram lcContext::mPrograms[static_cast<int>(lcMaterialType::Count)];
|
||||||
|
|
||||||
lcContext::lcContext()
|
lcContext::lcContext()
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ lcContext::lcContext()
|
||||||
mTexture2D = 0;
|
mTexture2D = 0;
|
||||||
mTexture2DMS = 0;
|
mTexture2DMS = 0;
|
||||||
mTextureCubeMap = 0;
|
mTextureCubeMap = 0;
|
||||||
mPolygonOffset = LC_POLYGON_OFFSET_NONE;
|
mPolygonOffset = lcPolygonOffset::None;
|
||||||
mDepthWrite = true;
|
mDepthWrite = true;
|
||||||
mLineWidth = 1.0f;
|
mLineWidth = 1.0f;
|
||||||
#ifndef LC_OPENGLES
|
#ifndef LC_OPENGLES
|
||||||
|
@ -61,7 +61,7 @@ lcContext::lcContext()
|
||||||
mViewProjectionMatrixDirty = false;
|
mViewProjectionMatrixDirty = false;
|
||||||
mHighlightParamsDirty = false;
|
mHighlightParamsDirty = false;
|
||||||
|
|
||||||
mMaterialType = LC_NUM_MATERIALS;
|
mMaterialType = lcMaterialType::Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
lcContext::~lcContext()
|
lcContext::~lcContext()
|
||||||
|
@ -102,26 +102,26 @@ void lcContext::CreateShaderPrograms()
|
||||||
" LC_SHADER_PRECISION float Diffuse = min(abs(dot(Normal, LightDirection)) * 0.6 + 0.65, 1.0);\n"
|
" LC_SHADER_PRECISION float Diffuse = min(abs(dot(Normal, LightDirection)) * 0.6 + 0.65, 1.0);\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* VertexShaders[LC_NUM_MATERIALS] =
|
const char* VertexShaders[lcMaterialType::Count] =
|
||||||
{
|
{
|
||||||
":/resources/shaders/unlit_color_vs.glsl", // LC_MATERIAL_UNLIT_COLOR
|
":/resources/shaders/unlit_color_vs.glsl", // UnlitColor
|
||||||
":/resources/shaders/unlit_texture_modulate_vs.glsl", // LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
":/resources/shaders/unlit_texture_modulate_vs.glsl", // UnlitTextureModulate
|
||||||
":/resources/shaders/unlit_texture_decal_vs.glsl", // LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
":/resources/shaders/unlit_texture_decal_vs.glsl", // UnlitTextureDecal
|
||||||
":/resources/shaders/unlit_vertex_color_vs.glsl", // LC_MATERIAL_UNLIT_VERTEX_COLOR
|
":/resources/shaders/unlit_vertex_color_vs.glsl", // UnlitVertexColor
|
||||||
":/resources/shaders/unlit_view_sphere_vs.glsl", // LC_MATERIAL_UNLIT_VIEW_SPHERE
|
":/resources/shaders/unlit_view_sphere_vs.glsl", // UnlitViewSphere
|
||||||
":/resources/shaders/fakelit_color_vs.glsl", // LC_MATERIAL_FAKELIT_COLOR
|
":/resources/shaders/fakelit_color_vs.glsl", // FakeLitColor
|
||||||
":/resources/shaders/fakelit_texture_decal_vs.glsl" // LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
":/resources/shaders/fakelit_texture_decal_vs.glsl" // FakeLitTextureDecal
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* FragmentShaders[LC_NUM_MATERIALS] =
|
const char* FragmentShaders[lcMaterialType::Count] =
|
||||||
{
|
{
|
||||||
":/resources/shaders/unlit_color_ps.glsl", // LC_MATERIAL_UNLIT_COLOR
|
":/resources/shaders/unlit_color_ps.glsl", // UnlitColor
|
||||||
":/resources/shaders/unlit_texture_modulate_ps.glsl", // LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
":/resources/shaders/unlit_texture_modulate_ps.glsl", // UnlitTextureModulate
|
||||||
":/resources/shaders/unlit_texture_decal_ps.glsl", // LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
":/resources/shaders/unlit_texture_decal_ps.glsl", // UnlitTextureDecal
|
||||||
":/resources/shaders/unlit_vertex_color_ps.glsl", // LC_MATERIAL_UNLIT_VERTEX_COLOR
|
":/resources/shaders/unlit_vertex_color_ps.glsl", // UnlitVertexColor
|
||||||
":/resources/shaders/unlit_view_sphere_ps.glsl", // LC_MATERIAL_UNLIT_VIEW_SPHERE
|
":/resources/shaders/unlit_view_sphere_ps.glsl", // UnlitViewSphere
|
||||||
":/resources/shaders/fakelit_color_ps.glsl", // LC_MATERIAL_FAKELIT_COLOR
|
":/resources/shaders/fakelit_color_ps.glsl", // FakeLitColor
|
||||||
":/resources/shaders/fakelit_texture_decal_ps.glsl" // LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
":/resources/shaders/fakelit_texture_decal_ps.glsl" // FakeLitTextureDecal
|
||||||
};
|
};
|
||||||
|
|
||||||
auto LoadShader = [ShaderPrefix](const char* FileName, GLuint ShaderType) -> GLuint
|
auto LoadShader = [ShaderPrefix](const char* FileName, GLuint ShaderType) -> GLuint
|
||||||
|
@ -165,7 +165,7 @@ void lcContext::CreateShaderPrograms()
|
||||||
return Shader;
|
return Shader;
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
for (int MaterialType = 0; MaterialType < static_cast<int>(lcMaterialType::Count); MaterialType++)
|
||||||
{
|
{
|
||||||
GLuint VertexShader = LoadShader(VertexShaders[MaterialType], GL_VERTEX_SHADER);
|
GLuint VertexShader = LoadShader(VertexShaders[MaterialType], GL_VERTEX_SHADER);
|
||||||
GLuint FragmentShader = LoadShader(FragmentShaders[MaterialType], GL_FRAGMENT_SHADER);
|
GLuint FragmentShader = LoadShader(FragmentShaders[MaterialType], GL_FRAGMENT_SHADER);
|
||||||
|
@ -226,7 +226,7 @@ void lcContext::DestroyResources()
|
||||||
if (!gSupportsShaderObjects)
|
if (!gSupportsShaderObjects)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
for (int MaterialType = 0; MaterialType < static_cast<int>(lcMaterialType::Count); MaterialType++)
|
||||||
{
|
{
|
||||||
glDeleteProgram(mPrograms[MaterialType].Object);
|
glDeleteProgram(mPrograms[MaterialType].Object);
|
||||||
mPrograms[MaterialType].Object = 0;
|
mPrograms[MaterialType].Object = 0;
|
||||||
|
@ -294,7 +294,7 @@ void lcContext::SetDefaultState()
|
||||||
mTextureCubeMap = 0;
|
mTextureCubeMap = 0;
|
||||||
|
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
mPolygonOffset = LC_POLYGON_OFFSET_NONE;
|
mPolygonOffset = lcPolygonOffset::None;
|
||||||
|
|
||||||
mDepthWrite = true;
|
mDepthWrite = true;
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
|
@ -305,7 +305,7 @@ void lcContext::SetDefaultState()
|
||||||
if (gSupportsShaderObjects)
|
if (gSupportsShaderObjects)
|
||||||
{
|
{
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
mMaterialType = LC_NUM_MATERIALS;
|
mMaterialType = lcMaterialType::Count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -337,7 +337,7 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
||||||
|
|
||||||
if (gSupportsShaderObjects)
|
if (gSupportsShaderObjects)
|
||||||
{
|
{
|
||||||
glUseProgram(mPrograms[MaterialType].Object);
|
glUseProgram(mPrograms[static_cast<int>(MaterialType)].Object);
|
||||||
mColorDirty = true;
|
mColorDirty = true;
|
||||||
mWorldMatrixDirty = true; // todo: change dirty to a bitfield and set the lighting constants dirty here
|
mWorldMatrixDirty = true; // todo: change dirty to a bitfield and set the lighting constants dirty here
|
||||||
mViewMatrixDirty = true;
|
mViewMatrixDirty = true;
|
||||||
|
@ -348,7 +348,7 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
||||||
#ifndef LC_OPENGLES
|
#ifndef LC_OPENGLES
|
||||||
switch (MaterialType)
|
switch (MaterialType)
|
||||||
{
|
{
|
||||||
case LC_MATERIAL_UNLIT_TEXTURE_MODULATE:
|
case lcMaterialType::UnlitTextureModulate:
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
if (!mTextureEnabled)
|
if (!mTextureEnabled)
|
||||||
|
@ -358,8 +358,8 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_MATERIAL_FAKELIT_TEXTURE_DECAL:
|
case lcMaterialType::FakeLitTextureDecal:
|
||||||
case LC_MATERIAL_UNLIT_TEXTURE_DECAL:
|
case lcMaterialType::UnlitTextureDecal:
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||||
|
|
||||||
if (!mTextureEnabled)
|
if (!mTextureEnabled)
|
||||||
|
@ -369,9 +369,9 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_MATERIAL_UNLIT_COLOR:
|
case lcMaterialType::UnlitColor:
|
||||||
case LC_MATERIAL_UNLIT_VERTEX_COLOR:
|
case lcMaterialType::UnlitVertexColor:
|
||||||
case LC_MATERIAL_FAKELIT_COLOR:
|
case lcMaterialType::FakeLitColor:
|
||||||
if (mTextureEnabled)
|
if (mTextureEnabled)
|
||||||
{
|
{
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
@ -379,8 +379,8 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_MATERIAL_UNLIT_VIEW_SPHERE:
|
case lcMaterialType::UnlitViewSphere:
|
||||||
case LC_NUM_MATERIALS:
|
case lcMaterialType::Count:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -399,16 +399,16 @@ void lcContext::SetPolygonOffset(lcPolygonOffset PolygonOffset)
|
||||||
|
|
||||||
switch (PolygonOffset)
|
switch (PolygonOffset)
|
||||||
{
|
{
|
||||||
case LC_POLYGON_OFFSET_NONE:
|
case lcPolygonOffset::None:
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_POLYGON_OFFSET_OPAQUE:
|
case lcPolygonOffset::Opaque:
|
||||||
glPolygonOffset(0.5f, 0.1f);
|
glPolygonOffset(0.5f, 0.1f);
|
||||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_POLYGON_OFFSET_TRANSLUCENT:
|
case lcPolygonOffset::Translucent:
|
||||||
glPolygonOffset(0.25f, 0.1f);
|
glPolygonOffset(0.25f, 0.1f);
|
||||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
break;
|
break;
|
||||||
|
@ -1174,7 +1174,7 @@ void lcContext::FlushState()
|
||||||
{
|
{
|
||||||
if (gSupportsShaderObjects)
|
if (gSupportsShaderObjects)
|
||||||
{
|
{
|
||||||
const lcProgram& Program = mPrograms[mMaterialType];
|
const lcProgram& Program = mPrograms[static_cast<int>(mMaterialType)];
|
||||||
|
|
||||||
if (mWorldMatrixDirty || mViewMatrixDirty || mProjectionMatrixDirty)
|
if (mWorldMatrixDirty || mViewMatrixDirty || mProjectionMatrixDirty)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class lcVertexBuffer
|
class lcVertexBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
lcVertexBuffer()
|
constexpr lcVertexBuffer()
|
||||||
: Pointer(nullptr)
|
: Pointer(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
class lcIndexBuffer
|
class lcIndexBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
lcIndexBuffer()
|
constexpr lcIndexBuffer()
|
||||||
: Pointer(nullptr)
|
: Pointer(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -45,16 +45,16 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcMaterialType
|
enum class lcMaterialType
|
||||||
{
|
{
|
||||||
LC_MATERIAL_UNLIT_COLOR,
|
UnlitColor,
|
||||||
LC_MATERIAL_UNLIT_TEXTURE_MODULATE,
|
UnlitTextureModulate,
|
||||||
LC_MATERIAL_UNLIT_TEXTURE_DECAL,
|
UnlitTextureDecal,
|
||||||
LC_MATERIAL_UNLIT_VERTEX_COLOR,
|
UnlitVertexColor,
|
||||||
LC_MATERIAL_UNLIT_VIEW_SPHERE,
|
UnlitViewSphere,
|
||||||
LC_MATERIAL_FAKELIT_COLOR,
|
FakeLitColor,
|
||||||
LC_MATERIAL_FAKELIT_TEXTURE_DECAL,
|
FakeLitTextureDecal,
|
||||||
LC_NUM_MATERIALS
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcProgramAttrib
|
enum lcProgramAttrib
|
||||||
|
@ -100,11 +100,11 @@ public:
|
||||||
int mHeight = 0;
|
int mHeight = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcPolygonOffset
|
enum class lcPolygonOffset
|
||||||
{
|
{
|
||||||
LC_POLYGON_OFFSET_NONE,
|
None,
|
||||||
LC_POLYGON_OFFSET_OPAQUE,
|
Opaque,
|
||||||
LC_POLYGON_OFFSET_TRANSLUCENT
|
Translucent
|
||||||
};
|
};
|
||||||
|
|
||||||
class lcContext
|
class lcContext
|
||||||
|
@ -250,7 +250,7 @@ protected:
|
||||||
|
|
||||||
GLuint mFramebufferObject;
|
GLuint mFramebufferObject;
|
||||||
|
|
||||||
static lcProgram mPrograms[LC_NUM_MATERIALS];
|
static lcProgram mPrograms[static_cast<int>(lcMaterialType::Count)];
|
||||||
|
|
||||||
Q_DECLARE_TR_FUNCTIONS(lcContext);
|
Q_DECLARE_TR_FUNCTIONS(lcContext);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2085,7 +2085,7 @@ void lcMainWindow::UpdatePerspective()
|
||||||
|
|
||||||
void lcMainWindow::UpdateShadingMode()
|
void lcMainWindow::UpdateShadingMode()
|
||||||
{
|
{
|
||||||
mActions[LC_VIEW_SHADING_FIRST + lcGetPreferences().mShadingMode]->setChecked(true);
|
mActions[LC_VIEW_SHADING_FIRST + static_cast<int>(lcGetPreferences().mShadingMode)]->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcMainWindow::UpdateSelectionMode()
|
void lcMainWindow::UpdateSelectionMode()
|
||||||
|
@ -2636,15 +2636,15 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_VIEW_SHADING_WIREFRAME:
|
case LC_VIEW_SHADING_WIREFRAME:
|
||||||
SetShadingMode(LC_SHADING_WIREFRAME);
|
SetShadingMode(lcShadingMode::Wireframe);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_VIEW_SHADING_FLAT:
|
case LC_VIEW_SHADING_FLAT:
|
||||||
SetShadingMode(LC_SHADING_FLAT);
|
SetShadingMode(lcShadingMode::Flat);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_VIEW_SHADING_DEFAULT_LIGHTS:
|
case LC_VIEW_SHADING_DEFAULT_LIGHTS:
|
||||||
SetShadingMode(LC_SHADING_DEFAULT_LIGHTS);
|
SetShadingMode(lcShadingMode::DefaultLights);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LC_VIEW_PROJECTION_PERSPECTIVE:
|
case LC_VIEW_PROJECTION_PERSPECTIVE:
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector2(const float _x, const float _y)
|
constexpr lcVector2(const float _x, const float _y)
|
||||||
: x(_x), y(_y)
|
: x(_x), y(_y)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector3(const float _x, const float _y, const float _z)
|
constexpr lcVector3(const float _x, const float _y, const float _z)
|
||||||
: x(_x), y(_y), z(_z)
|
: x(_x), y(_y), z(_z)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -132,12 +132,12 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector4(const float _x, const float _y, const float _z, const float _w)
|
constexpr lcVector4(const float _x, const float _y, const float _z, const float _w)
|
||||||
: x(_x), y(_y), z(_z), w(_w)
|
: x(_x), y(_y), z(_z), w(_w)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
lcVector4(const lcVector3& _xyz, const float _w)
|
constexpr lcVector4(const lcVector3& _xyz, const float _w)
|
||||||
: x(_xyz.x), y(_xyz.y), z(_xyz.z), w(_w)
|
: x(_xyz.x), y(_xyz.y), z(_xyz.z), w(_w)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1325,7 +1325,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
ViewWidth, 0.0f, Color2[0], Color2[1], Color2[2], 1.0f
|
ViewWidth, 0.0f, Color2[0], Color2[1], Color2[2], 1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_VERTEX_COLOR);
|
Context->SetMaterial(lcMaterialType::UnlitVertexColor);
|
||||||
Context->SetVertexBufferPointer(Verts);
|
Context->SetVertexBufferPointer(Verts);
|
||||||
Context->SetVertexFormat(0, 2, 0, 0, 4, false);
|
Context->SetVertexFormat(0, 2, 0, 0, 4, false);
|
||||||
|
|
||||||
|
@ -1354,7 +1354,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
||||||
};
|
};
|
||||||
|
|
||||||
Context->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
Context->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_DECAL);
|
Context->SetMaterial(lcMaterialType::UnlitTextureDecal);
|
||||||
Context->SetVertexBufferPointer(Verts);
|
Context->SetVertexBufferPointer(Verts);
|
||||||
Context->SetVertexFormat(0, 2, 0, 2, 0, false);
|
Context->SetVertexFormat(0, 2, 0, 2, 0, false);
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
|
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
|
||||||
lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD
|
lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD
|
||||||
lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS
|
lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS
|
||||||
lcProfileEntry("Settings", "ShadingMode", LC_SHADING_DEFAULT_LIGHTS), // LC_PROFILE_SHADING_MODE
|
lcProfileEntry("Settings", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE
|
||||||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||||
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
||||||
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
||||||
|
@ -69,7 +69,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
|
lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
|
||||||
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
||||||
lcProfileEntry("Settings", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
lcProfileEntry("Settings", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
||||||
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TOP_RIGHT), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
||||||
lcProfileEntry("Settings", "ViewSphereSize", 100), // LC_PROFILE_VIEW_SPHERE_SIZE
|
lcProfileEntry("Settings", "ViewSphereSize", 100), // LC_PROFILE_VIEW_SPHERE_SIZE
|
||||||
lcProfileEntry("Settings", "ViewSphereColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_VIEW_SPHERE_COLOR
|
lcProfileEntry("Settings", "ViewSphereColor", LC_RGBA(255, 255, 255, 255)), // LC_PROFILE_VIEW_SPHERE_COLOR
|
||||||
lcProfileEntry("Settings", "ViewSphereTextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_TEXT_COLOR
|
lcProfileEntry("Settings", "ViewSphereTextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_TEXT_COLOR
|
||||||
|
|
|
@ -127,16 +127,16 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
|
||||||
|
|
||||||
if (DrawLit)
|
if (DrawLit)
|
||||||
{
|
{
|
||||||
FlatMaterial = LC_MATERIAL_FAKELIT_COLOR;
|
FlatMaterial = lcMaterialType::FakeLitColor;
|
||||||
TexturedMaterial = LC_MATERIAL_FAKELIT_TEXTURE_DECAL;
|
TexturedMaterial = lcMaterialType::FakeLitTextureDecal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlatMaterial = LC_MATERIAL_UNLIT_COLOR;
|
FlatMaterial = lcMaterialType::UnlitColor;
|
||||||
TexturedMaterial = LC_MATERIAL_UNLIT_TEXTURE_DECAL;
|
TexturedMaterial = lcMaterialType::UnlitTextureDecal;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
|
Context->SetPolygonOffset(lcPolygonOffset::Opaque);
|
||||||
|
|
||||||
for (int MeshIndex : mOpaqueMeshes)
|
for (int MeshIndex : mOpaqueMeshes)
|
||||||
{
|
{
|
||||||
|
@ -282,7 +282,7 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->BindTexture2D(0);
|
Context->BindTexture2D(0);
|
||||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_NONE);
|
Context->SetPolygonOffset(lcPolygonOffset::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
||||||
|
@ -294,18 +294,18 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
||||||
|
|
||||||
if (DrawLit)
|
if (DrawLit)
|
||||||
{
|
{
|
||||||
FlatMaterial = LC_MATERIAL_FAKELIT_COLOR;
|
FlatMaterial = lcMaterialType::FakeLitColor;
|
||||||
TexturedMaterial = LC_MATERIAL_FAKELIT_TEXTURE_DECAL;
|
TexturedMaterial = lcMaterialType::FakeLitTextureDecal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FlatMaterial = LC_MATERIAL_UNLIT_COLOR;
|
FlatMaterial = lcMaterialType::UnlitColor;
|
||||||
TexturedMaterial = LC_MATERIAL_UNLIT_TEXTURE_DECAL;
|
TexturedMaterial = lcMaterialType::UnlitTextureDecal;
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
Context->SetDepthWrite(false);
|
Context->SetDepthWrite(false);
|
||||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_TRANSLUCENT);
|
Context->SetPolygonOffset(lcPolygonOffset::Translucent);
|
||||||
|
|
||||||
for (const lcTranslucentMeshInstance& MeshInstance : mTranslucentMeshes)
|
for (const lcTranslucentMeshInstance& MeshInstance : mTranslucentMeshes)
|
||||||
{
|
{
|
||||||
|
@ -368,7 +368,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->BindTexture2D(0);
|
Context->BindTexture2D(0);
|
||||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_NONE);
|
Context->SetPolygonOffset(lcPolygonOffset::None);
|
||||||
|
|
||||||
Context->SetDepthWrite(true);
|
Context->SetDepthWrite(true);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -386,10 +386,10 @@ void lcScene::Draw(lcContext* Context) const
|
||||||
const lcPreferences& Preferences = lcGetPreferences();
|
const lcPreferences& Preferences = lcGetPreferences();
|
||||||
|
|
||||||
lcShadingMode ShadingMode = Preferences.mShadingMode;
|
lcShadingMode ShadingMode = Preferences.mShadingMode;
|
||||||
if (ShadingMode == LC_SHADING_WIREFRAME && !mAllowWireframe)
|
if (ShadingMode == lcShadingMode::Wireframe && !mAllowWireframe)
|
||||||
ShadingMode = LC_SHADING_FLAT;
|
ShadingMode = lcShadingMode::Flat;
|
||||||
|
|
||||||
if (ShadingMode == LC_SHADING_WIREFRAME)
|
if (ShadingMode == lcShadingMode::Wireframe)
|
||||||
{
|
{
|
||||||
int PrimitiveTypes = LC_MESH_LINES;
|
int PrimitiveTypes = LC_MESH_LINES;
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ void lcScene::Draw(lcContext* Context) const
|
||||||
if (mPreTranslucentCallback)
|
if (mPreTranslucentCallback)
|
||||||
mPreTranslucentCallback();
|
mPreTranslucentCallback();
|
||||||
}
|
}
|
||||||
else if (ShadingMode == LC_SHADING_FLAT)
|
else if (ShadingMode == lcShadingMode::Flat)
|
||||||
{
|
{
|
||||||
bool DrawLines = Preferences.mDrawEdgeLines && Preferences.mLineWidth != 0.0f;
|
bool DrawLines = Preferences.mDrawEdgeLines && Preferences.mLineWidth != 0.0f;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
|
|
||||||
lcStringCache gStringCache;
|
lcStringCache gStringCache;
|
||||||
|
|
||||||
lcStringCache::lcStringCache()
|
constexpr lcStringCache::lcStringCache()
|
||||||
|
: mTexture(nullptr), mRefCount(0)
|
||||||
{
|
{
|
||||||
mTexture = nullptr;
|
|
||||||
mRefCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcStringCache::~lcStringCache()
|
lcStringCache::~lcStringCache()
|
||||||
|
|
|
@ -8,7 +8,7 @@ struct lcStringCacheEntry
|
||||||
class lcStringCache
|
class lcStringCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
lcStringCache();
|
constexpr lcStringCache();
|
||||||
~lcStringCache();
|
~lcStringCache();
|
||||||
|
|
||||||
void AddRef(lcContext* Context);
|
void AddRef(lcContext* Context);
|
||||||
|
|
|
@ -162,8 +162,8 @@ void lcViewSphere::Draw()
|
||||||
int Height = mView->mHeight;
|
int Height = mView->mHeight;
|
||||||
lcViewSphereLocation Location = Preferences.mViewSphereLocation;
|
lcViewSphereLocation Location = Preferences.mViewSphereLocation;
|
||||||
|
|
||||||
int Left = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
|
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||||
int Bottom = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
|
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
||||||
Context->SetViewport(Left, Bottom, ViewportSize, ViewportSize);
|
Context->SetViewport(Left, Bottom, ViewportSize, ViewportSize);
|
||||||
|
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
|
@ -173,7 +173,7 @@ void lcViewSphere::Draw()
|
||||||
Context->SetVertexFormatPosition(3);
|
Context->SetVertexFormatPosition(3);
|
||||||
Context->SetIndexBuffer(mIndexBuffer);
|
Context->SetIndexBuffer(mIndexBuffer);
|
||||||
|
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
Context->SetColor(lcVector4(0.0f, 0.0f, 0.0f, 1.0f));
|
Context->SetColor(lcVector4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
float Scale = 1.005f + 2.0f / (float)ViewportSize;
|
float Scale = 1.005f + 2.0f / (float)ViewportSize;
|
||||||
|
@ -183,7 +183,7 @@ void lcViewSphere::Draw()
|
||||||
|
|
||||||
Context->DrawIndexedPrimitives(GL_TRIANGLES, mSubdivisions * mSubdivisions * 6 * 6, GL_UNSIGNED_SHORT, 0);
|
Context->DrawIndexedPrimitives(GL_TRIANGLES, mSubdivisions * mSubdivisions * 6 * 6, GL_UNSIGNED_SHORT, 0);
|
||||||
|
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_VIEW_SPHERE);
|
Context->SetMaterial(lcMaterialType::UnlitViewSphere);
|
||||||
Context->BindTextureCubeMap(mTexture->mTexture);
|
Context->BindTextureCubeMap(mTexture->mTexture);
|
||||||
|
|
||||||
Context->SetWorldMatrix(lcMatrix44Identity());
|
Context->SetWorldMatrix(lcMatrix44Identity());
|
||||||
|
@ -305,8 +305,8 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
||||||
int Width = mView->mWidth;
|
int Width = mView->mWidth;
|
||||||
int Height = mView->mHeight;
|
int Height = mView->mHeight;
|
||||||
int ViewportSize = Preferences.mViewSphereSize;
|
int ViewportSize = Preferences.mViewSphereSize;
|
||||||
int Left = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
|
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||||
int Bottom = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
|
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
||||||
int x = mView->mInputState.x - Left;
|
int x = mView->mInputState.x - Left;
|
||||||
int y = mView->mInputState.y - Bottom;
|
int y = mView->mInputState.y - Bottom;
|
||||||
std::bitset<6> IntersectionFlags;
|
std::bitset<6> IntersectionFlags;
|
||||||
|
|
|
@ -284,7 +284,7 @@ void lcLight::UpdatePosition(lcStep Step)
|
||||||
void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(Scene);
|
Q_UNUSED(Scene);
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
|
|
||||||
if (IsPointLight())
|
if (IsPointLight())
|
||||||
DrawPointLight(Context);
|
DrawPointLight(Context);
|
||||||
|
|
|
@ -557,7 +557,7 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||||
};
|
};
|
||||||
|
|
||||||
lcMatrix44 WorldMatrix = Scene.ApplyActiveSubmodelTransform(mModelWorld);
|
lcMatrix44 WorldMatrix = Scene.ApplyActiveSubmodelTransform(mModelWorld);
|
||||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
Context->SetWorldMatrix(WorldMatrix);
|
Context->SetWorldMatrix(WorldMatrix);
|
||||||
|
|
||||||
if (IsFocused(LC_PIECE_SECTION_POSITION))
|
if (IsFocused(LC_PIECE_SECTION_POSITION))
|
||||||
|
|
|
@ -955,7 +955,7 @@ void View::OnDraw()
|
||||||
|
|
||||||
void View::DrawSelectMoveOverlay()
|
void View::DrawSelectMoveOverlay()
|
||||||
{
|
{
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ void View::DrawRotateOverlay()
|
||||||
const float OverlayScale = GetOverlayScale();
|
const float OverlayScale = GetOverlayScale();
|
||||||
const float OverlayRotateRadius = 2.0f;
|
const float OverlayRotateRadius = 2.0f;
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||||
|
|
||||||
|
@ -1417,7 +1417,7 @@ void View::DrawRotateOverlay()
|
||||||
// Draw text.
|
// Draw text.
|
||||||
lcVector3 ScreenPos = ProjectPoint(OverlayCenter);
|
lcVector3 ScreenPos = ProjectPoint(OverlayCenter);
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||||
|
@ -1441,7 +1441,7 @@ void View::DrawRotateOverlay()
|
||||||
|
|
||||||
void View::DrawSelectZoomRegionOverlay()
|
void View::DrawSelectZoomRegionOverlay()
|
||||||
{
|
{
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||||
|
@ -1527,7 +1527,7 @@ void View::DrawRotateViewOverlay()
|
||||||
w = mWidth;
|
w = mWidth;
|
||||||
h = mHeight;
|
h = mHeight;
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1));
|
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1));
|
||||||
|
@ -1738,7 +1738,7 @@ void View::DrawGrid()
|
||||||
mContext->SetDepthWrite(false);
|
mContext->SetDepthWrite(false);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridStudColor));
|
mContext->SetColor(lcVector4FromColor(Preferences.mGridStudColor));
|
||||||
|
|
||||||
mContext->SetVertexFormat(0, 3, 0, 2, 0, false);
|
mContext->SetVertexFormat(0, 3, 0, 2, 0, false);
|
||||||
|
@ -1753,7 +1753,7 @@ void View::DrawGrid()
|
||||||
if (Preferences.mDrawGridLines)
|
if (Preferences.mDrawGridLines)
|
||||||
{
|
{
|
||||||
mContext->SetLineWidth(1.0f);
|
mContext->SetLineWidth(1.0f);
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridLineColor));
|
mContext->SetColor(lcVector4FromColor(Preferences.mGridLineColor));
|
||||||
|
|
||||||
int NumVerts = 2 * (MaxX - MinX + MaxY - MinY + 2);
|
int NumVerts = 2 * (MaxX - MinX + MaxY - MinY + 2);
|
||||||
|
@ -1790,7 +1790,7 @@ void View::DrawAxes()
|
||||||
lcMatrix44 WorldViewMatrix = mCamera->mWorldView;
|
lcMatrix44 WorldViewMatrix = mCamera->mWorldView;
|
||||||
WorldViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
WorldViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||||
mContext->SetViewMatrix(lcMul(WorldViewMatrix, TranslationMatrix));
|
mContext->SetViewMatrix(lcMul(WorldViewMatrix, TranslationMatrix));
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, mWidth, 0, mHeight, -50, 50));
|
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, mWidth, 0, mHeight, -50, 50));
|
||||||
|
@ -1809,7 +1809,7 @@ void View::DrawAxes()
|
||||||
mContext->SetColor(0.0f, 0.0f, 0.8f, 1.0f);
|
mContext->SetColor(0.0f, 0.0f, 0.8f, 1.0f);
|
||||||
mContext->DrawIndexedPrimitives(GL_TRIANGLES, 24, GL_UNSIGNED_SHORT, (6 + 48) * 2);
|
mContext->DrawIndexedPrimitives(GL_TRIANGLES, 24, GL_UNSIGNED_SHORT, (6 + 48) * 2);
|
||||||
|
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||||
mContext->SetViewMatrix(TranslationMatrix);
|
mContext->SetViewMatrix(TranslationMatrix);
|
||||||
mContext->BindTexture2D(gTexFont.GetTexture());
|
mContext->BindTexture2D(gTexFont.GetTexture());
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -1842,7 +1842,7 @@ void View::DrawViewport()
|
||||||
|
|
||||||
if (gMainWindow->GetActiveView() == this)
|
if (gMainWindow->GetActiveView() == this)
|
||||||
{
|
{
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
mContext->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
mContext->SetColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||||
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
||||||
|
|
||||||
|
@ -1855,7 +1855,7 @@ void View::DrawViewport()
|
||||||
|
|
||||||
if (CameraName[0])
|
if (CameraName[0])
|
||||||
{
|
{
|
||||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||||
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
mContext->BindTexture2D(gTexFont.GetTexture());
|
mContext->BindTexture2D(gTexFont.GetTexture());
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcGLWidget *owner, bool view)
|
||||||
View::CreateResources(widget->mContext);
|
View::CreateResources(widget->mContext);
|
||||||
lcViewSphere::CreateResources(widget->mContext);
|
lcViewSphere::CreateResources(widget->mContext);
|
||||||
|
|
||||||
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == LC_SHADING_DEFAULT_LIGHTS)
|
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == lcShadingMode::DefaultLights)
|
||||||
lcGetPreferences().mShadingMode = LC_SHADING_FLAT;
|
lcGetPreferences().mShadingMode = lcShadingMode::Flat;
|
||||||
|
|
||||||
if (!gSupportsFramebufferObjectARB && !gSupportsFramebufferObjectEXT)
|
if (!gSupportsFramebufferObjectARB && !gSupportsFramebufferObjectEXT)
|
||||||
gMainWindow->GetPartSelectionWidget()->DisableIconMode();
|
gMainWindow->GetPartSelectionWidget()->DisableIconMode();
|
||||||
|
|
|
@ -105,8 +105,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
||||||
ui->studLogoCombo->setCurrentIndex(mOptions->StudLogo);
|
ui->studLogoCombo->setCurrentIndex(mOptions->StudLogo);
|
||||||
|
|
||||||
if (!gSupportsShaderObjects)
|
if (!gSupportsShaderObjects)
|
||||||
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
|
ui->ShadingMode->removeItem(static_cast<int>(lcShadingMode::DefaultLights));
|
||||||
ui->ShadingMode->setCurrentIndex(mOptions->Preferences.mShadingMode);
|
ui->ShadingMode->setCurrentIndex(static_cast<int>(mOptions->Preferences.mShadingMode));
|
||||||
|
|
||||||
QPixmap pix(12, 12);
|
QPixmap pix(12, 12);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue