mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +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
|
||||
{
|
||||
Q_UNUSED(Scene);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||
|
||||
lcMatrix44 ViewWorldMatrix = lcMatrix44AffineInverse(mWorldView);
|
||||
ViewWorldMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||
|
|
|
@ -16,7 +16,7 @@ void lcPreferences::LoadDefaults()
|
|||
{
|
||||
mFixedAxes = lcGetProfileInt(LC_PROFILE_FIXED_AXES);
|
||||
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);
|
||||
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
||||
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
||||
|
@ -28,7 +28,7 @@ void lcPreferences::LoadDefaults()
|
|||
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
||||
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
||||
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);
|
||||
mViewSphereColor = lcGetProfileInt(LC_PROFILE_VIEW_SPHERE_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_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_EDGE_LINES, mDrawEdgeLines);
|
||||
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
||||
|
@ -340,13 +340,13 @@ bool lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPaths, bool&
|
|||
ParseString(ShadingString, true);
|
||||
|
||||
if (ShadingString == QLatin1String("wireframe"))
|
||||
mPreferences.mShadingMode = LC_SHADING_WIREFRAME;
|
||||
mPreferences.mShadingMode = lcShadingMode::Wireframe;
|
||||
else if (ShadingString == QLatin1String("flat"))
|
||||
mPreferences.mShadingMode = LC_SHADING_FLAT;
|
||||
mPreferences.mShadingMode = lcShadingMode::Flat;
|
||||
else if (ShadingString == QLatin1String("default"))
|
||||
mPreferences.mShadingMode = LC_SHADING_DEFAULT_LIGHTS;
|
||||
mPreferences.mShadingMode = lcShadingMode::DefaultLights;
|
||||
else if (ShadingString == QLatin1String("full"))
|
||||
mPreferences.mShadingMode = LC_SHADING_FULL;
|
||||
mPreferences.mShadingMode = lcShadingMode::Full;
|
||||
}
|
||||
else if (Param == QLatin1String("--line-width"))
|
||||
ParseFloat(mPreferences.mLineWidth);
|
||||
|
|
|
@ -5,21 +5,20 @@
|
|||
class Project;
|
||||
class lcPiecesLibrary;
|
||||
|
||||
enum lcShadingMode
|
||||
enum class lcShadingMode
|
||||
{
|
||||
LC_SHADING_WIREFRAME,
|
||||
LC_SHADING_FLAT,
|
||||
LC_SHADING_DEFAULT_LIGHTS,
|
||||
LC_SHADING_FULL,
|
||||
LC_NUM_SHADING_MODES
|
||||
Wireframe,
|
||||
Flat,
|
||||
DefaultLights,
|
||||
Full
|
||||
};
|
||||
|
||||
enum class lcViewSphereLocation
|
||||
{
|
||||
TOP_LEFT,
|
||||
TOP_RIGHT,
|
||||
BOTTOM_LEFT,
|
||||
BOTTOM_RIGHT
|
||||
TopLeft,
|
||||
TopRight,
|
||||
BottomLeft,
|
||||
BottomRight
|
||||
};
|
||||
|
||||
class lcPreferences
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
|
||||
#endif
|
||||
|
||||
lcProgram lcContext::mPrograms[LC_NUM_MATERIALS];
|
||||
lcProgram lcContext::mPrograms[static_cast<int>(lcMaterialType::Count)];
|
||||
|
||||
lcContext::lcContext()
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ lcContext::lcContext()
|
|||
mTexture2D = 0;
|
||||
mTexture2DMS = 0;
|
||||
mTextureCubeMap = 0;
|
||||
mPolygonOffset = LC_POLYGON_OFFSET_NONE;
|
||||
mPolygonOffset = lcPolygonOffset::None;
|
||||
mDepthWrite = true;
|
||||
mLineWidth = 1.0f;
|
||||
#ifndef LC_OPENGLES
|
||||
|
@ -61,7 +61,7 @@ lcContext::lcContext()
|
|||
mViewProjectionMatrixDirty = false;
|
||||
mHighlightParamsDirty = false;
|
||||
|
||||
mMaterialType = LC_NUM_MATERIALS;
|
||||
mMaterialType = lcMaterialType::Count;
|
||||
}
|
||||
|
||||
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"
|
||||
};
|
||||
|
||||
const char* VertexShaders[LC_NUM_MATERIALS] =
|
||||
const char* VertexShaders[lcMaterialType::Count] =
|
||||
{
|
||||
":/resources/shaders/unlit_color_vs.glsl", // LC_MATERIAL_UNLIT_COLOR
|
||||
":/resources/shaders/unlit_texture_modulate_vs.glsl", // LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
||||
":/resources/shaders/unlit_texture_decal_vs.glsl", // LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
||||
":/resources/shaders/unlit_vertex_color_vs.glsl", // LC_MATERIAL_UNLIT_VERTEX_COLOR
|
||||
":/resources/shaders/unlit_view_sphere_vs.glsl", // LC_MATERIAL_UNLIT_VIEW_SPHERE
|
||||
":/resources/shaders/fakelit_color_vs.glsl", // LC_MATERIAL_FAKELIT_COLOR
|
||||
":/resources/shaders/fakelit_texture_decal_vs.glsl" // LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
||||
":/resources/shaders/unlit_color_vs.glsl", // UnlitColor
|
||||
":/resources/shaders/unlit_texture_modulate_vs.glsl", // UnlitTextureModulate
|
||||
":/resources/shaders/unlit_texture_decal_vs.glsl", // UnlitTextureDecal
|
||||
":/resources/shaders/unlit_vertex_color_vs.glsl", // UnlitVertexColor
|
||||
":/resources/shaders/unlit_view_sphere_vs.glsl", // UnlitViewSphere
|
||||
":/resources/shaders/fakelit_color_vs.glsl", // FakeLitColor
|
||||
":/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_texture_modulate_ps.glsl", // LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
||||
":/resources/shaders/unlit_texture_decal_ps.glsl", // LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
||||
":/resources/shaders/unlit_vertex_color_ps.glsl", // LC_MATERIAL_UNLIT_VERTEX_COLOR
|
||||
":/resources/shaders/unlit_view_sphere_ps.glsl", // LC_MATERIAL_UNLIT_VIEW_SPHERE
|
||||
":/resources/shaders/fakelit_color_ps.glsl", // LC_MATERIAL_FAKELIT_COLOR
|
||||
":/resources/shaders/fakelit_texture_decal_ps.glsl" // LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
||||
":/resources/shaders/unlit_color_ps.glsl", // UnlitColor
|
||||
":/resources/shaders/unlit_texture_modulate_ps.glsl", // UnlitTextureModulate
|
||||
":/resources/shaders/unlit_texture_decal_ps.glsl", // UnlitTextureDecal
|
||||
":/resources/shaders/unlit_vertex_color_ps.glsl", // UnlitVertexColor
|
||||
":/resources/shaders/unlit_view_sphere_ps.glsl", // UnlitViewSphere
|
||||
":/resources/shaders/fakelit_color_ps.glsl", // FakeLitColor
|
||||
":/resources/shaders/fakelit_texture_decal_ps.glsl" // FakeLitTextureDecal
|
||||
};
|
||||
|
||||
auto LoadShader = [ShaderPrefix](const char* FileName, GLuint ShaderType) -> GLuint
|
||||
|
@ -165,7 +165,7 @@ void lcContext::CreateShaderPrograms()
|
|||
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 FragmentShader = LoadShader(FragmentShaders[MaterialType], GL_FRAGMENT_SHADER);
|
||||
|
@ -226,7 +226,7 @@ void lcContext::DestroyResources()
|
|||
if (!gSupportsShaderObjects)
|
||||
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);
|
||||
mPrograms[MaterialType].Object = 0;
|
||||
|
@ -294,7 +294,7 @@ void lcContext::SetDefaultState()
|
|||
mTextureCubeMap = 0;
|
||||
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
mPolygonOffset = LC_POLYGON_OFFSET_NONE;
|
||||
mPolygonOffset = lcPolygonOffset::None;
|
||||
|
||||
mDepthWrite = true;
|
||||
glDepthMask(GL_TRUE);
|
||||
|
@ -305,7 +305,7 @@ void lcContext::SetDefaultState()
|
|||
if (gSupportsShaderObjects)
|
||||
{
|
||||
glUseProgram(0);
|
||||
mMaterialType = LC_NUM_MATERIALS;
|
||||
mMaterialType = lcMaterialType::Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
|
||||
if (gSupportsShaderObjects)
|
||||
{
|
||||
glUseProgram(mPrograms[MaterialType].Object);
|
||||
glUseProgram(mPrograms[static_cast<int>(MaterialType)].Object);
|
||||
mColorDirty = true;
|
||||
mWorldMatrixDirty = true; // todo: change dirty to a bitfield and set the lighting constants dirty here
|
||||
mViewMatrixDirty = true;
|
||||
|
@ -348,7 +348,7 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
#ifndef LC_OPENGLES
|
||||
switch (MaterialType)
|
||||
{
|
||||
case LC_MATERIAL_UNLIT_TEXTURE_MODULATE:
|
||||
case lcMaterialType::UnlitTextureModulate:
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
if (!mTextureEnabled)
|
||||
|
@ -358,8 +358,8 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_MATERIAL_FAKELIT_TEXTURE_DECAL:
|
||||
case LC_MATERIAL_UNLIT_TEXTURE_DECAL:
|
||||
case lcMaterialType::FakeLitTextureDecal:
|
||||
case lcMaterialType::UnlitTextureDecal:
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
|
||||
if (!mTextureEnabled)
|
||||
|
@ -369,9 +369,9 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_MATERIAL_UNLIT_COLOR:
|
||||
case LC_MATERIAL_UNLIT_VERTEX_COLOR:
|
||||
case LC_MATERIAL_FAKELIT_COLOR:
|
||||
case lcMaterialType::UnlitColor:
|
||||
case lcMaterialType::UnlitVertexColor:
|
||||
case lcMaterialType::FakeLitColor:
|
||||
if (mTextureEnabled)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
@ -379,8 +379,8 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
}
|
||||
break;
|
||||
|
||||
case LC_MATERIAL_UNLIT_VIEW_SPHERE:
|
||||
case LC_NUM_MATERIALS:
|
||||
case lcMaterialType::UnlitViewSphere:
|
||||
case lcMaterialType::Count:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -399,16 +399,16 @@ void lcContext::SetPolygonOffset(lcPolygonOffset PolygonOffset)
|
|||
|
||||
switch (PolygonOffset)
|
||||
{
|
||||
case LC_POLYGON_OFFSET_NONE:
|
||||
case lcPolygonOffset::None:
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
break;
|
||||
|
||||
case LC_POLYGON_OFFSET_OPAQUE:
|
||||
case lcPolygonOffset::Opaque:
|
||||
glPolygonOffset(0.5f, 0.1f);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
break;
|
||||
|
||||
case LC_POLYGON_OFFSET_TRANSLUCENT:
|
||||
case lcPolygonOffset::Translucent:
|
||||
glPolygonOffset(0.25f, 0.1f);
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
break;
|
||||
|
@ -1174,7 +1174,7 @@ void lcContext::FlushState()
|
|||
{
|
||||
if (gSupportsShaderObjects)
|
||||
{
|
||||
const lcProgram& Program = mPrograms[mMaterialType];
|
||||
const lcProgram& Program = mPrograms[static_cast<int>(mMaterialType)];
|
||||
|
||||
if (mWorldMatrixDirty || mViewMatrixDirty || mProjectionMatrixDirty)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class lcVertexBuffer
|
||||
{
|
||||
public:
|
||||
lcVertexBuffer()
|
||||
constexpr lcVertexBuffer()
|
||||
: Pointer(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
class lcIndexBuffer
|
||||
{
|
||||
public:
|
||||
lcIndexBuffer()
|
||||
constexpr lcIndexBuffer()
|
||||
: Pointer(nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -45,16 +45,16 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
enum lcMaterialType
|
||||
enum class lcMaterialType
|
||||
{
|
||||
LC_MATERIAL_UNLIT_COLOR,
|
||||
LC_MATERIAL_UNLIT_TEXTURE_MODULATE,
|
||||
LC_MATERIAL_UNLIT_TEXTURE_DECAL,
|
||||
LC_MATERIAL_UNLIT_VERTEX_COLOR,
|
||||
LC_MATERIAL_UNLIT_VIEW_SPHERE,
|
||||
LC_MATERIAL_FAKELIT_COLOR,
|
||||
LC_MATERIAL_FAKELIT_TEXTURE_DECAL,
|
||||
LC_NUM_MATERIALS
|
||||
UnlitColor,
|
||||
UnlitTextureModulate,
|
||||
UnlitTextureDecal,
|
||||
UnlitVertexColor,
|
||||
UnlitViewSphere,
|
||||
FakeLitColor,
|
||||
FakeLitTextureDecal,
|
||||
Count
|
||||
};
|
||||
|
||||
enum lcProgramAttrib
|
||||
|
@ -100,11 +100,11 @@ public:
|
|||
int mHeight = 0;
|
||||
};
|
||||
|
||||
enum lcPolygonOffset
|
||||
enum class lcPolygonOffset
|
||||
{
|
||||
LC_POLYGON_OFFSET_NONE,
|
||||
LC_POLYGON_OFFSET_OPAQUE,
|
||||
LC_POLYGON_OFFSET_TRANSLUCENT
|
||||
None,
|
||||
Opaque,
|
||||
Translucent
|
||||
};
|
||||
|
||||
class lcContext
|
||||
|
@ -250,7 +250,7 @@ protected:
|
|||
|
||||
GLuint mFramebufferObject;
|
||||
|
||||
static lcProgram mPrograms[LC_NUM_MATERIALS];
|
||||
static lcProgram mPrograms[static_cast<int>(lcMaterialType::Count)];
|
||||
|
||||
Q_DECLARE_TR_FUNCTIONS(lcContext);
|
||||
};
|
||||
|
|
|
@ -2085,7 +2085,7 @@ void lcMainWindow::UpdatePerspective()
|
|||
|
||||
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()
|
||||
|
@ -2636,15 +2636,15 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId)
|
|||
break;
|
||||
|
||||
case LC_VIEW_SHADING_WIREFRAME:
|
||||
SetShadingMode(LC_SHADING_WIREFRAME);
|
||||
SetShadingMode(lcShadingMode::Wireframe);
|
||||
break;
|
||||
|
||||
case LC_VIEW_SHADING_FLAT:
|
||||
SetShadingMode(LC_SHADING_FLAT);
|
||||
SetShadingMode(lcShadingMode::Flat);
|
||||
break;
|
||||
|
||||
case LC_VIEW_SHADING_DEFAULT_LIGHTS:
|
||||
SetShadingMode(LC_SHADING_DEFAULT_LIGHTS);
|
||||
SetShadingMode(lcShadingMode::DefaultLights);
|
||||
break;
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1325,7 +1325,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
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->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->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_DECAL);
|
||||
Context->SetMaterial(lcMaterialType::UnlitTextureDecal);
|
||||
Context->SetVertexBufferPointer(Verts);
|
||||
Context->SetVertexFormat(0, 2, 0, 2, 0, false);
|
||||
|
||||
|
|
|
@ -55,75 +55,75 @@ lcProfileEntry::lcProfileEntry(const char* Section, const char* Key)
|
|||
|
||||
static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||
{
|
||||
lcProfileEntry("Settings", "FixedAxes", false), // LC_PROFILE_FIXED_AXES
|
||||
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
|
||||
lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD
|
||||
lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS
|
||||
lcProfileEntry("Settings", "ShadingMode", LC_SHADING_DEFAULT_LIGHTS), // LC_PROFILE_SHADING_MODE
|
||||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
||||
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
||||
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR
|
||||
lcProfileEntry("Settings", "GridLines", 1), // LC_PROFILE_GRID_LINES
|
||||
lcProfileEntry("Settings", "GridLineSpacing", 5), // LC_PROFILE_GRID_LINE_SPACING
|
||||
lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
|
||||
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
||||
lcProfileEntry("Settings", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
||||
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TOP_RIGHT), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
||||
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", "ViewSphereTextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_TEXT_COLOR
|
||||
lcProfileEntry("Settings", "ViewSphereHighlightColor", LC_RGBA(255, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_HIGHLIGHT_COLOR
|
||||
lcProfileEntry("Settings", "FixedAxes", false), // LC_PROFILE_FIXED_AXES
|
||||
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
|
||||
lcProfileEntry("Settings", "AllowLOD", true), // LC_PROFILE_ALLOW_LOD
|
||||
lcProfileEntry("Settings", "FadeSteps", false), // LC_PROFILE_FADE_STEPS
|
||||
lcProfileEntry("Settings", "ShadingMode", static_cast<int>(lcShadingMode::DefaultLights)), // LC_PROFILE_SHADING_MODE
|
||||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
||||
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
||||
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR
|
||||
lcProfileEntry("Settings", "GridLines", 1), // LC_PROFILE_GRID_LINES
|
||||
lcProfileEntry("Settings", "GridLineSpacing", 5), // LC_PROFILE_GRID_LINE_SPACING
|
||||
lcProfileEntry("Settings", "GridLineColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_GRID_LINE_COLOR
|
||||
lcProfileEntry("Settings", "AASamples", 1), // LC_PROFILE_ANTIALIASING_SAMPLES
|
||||
lcProfileEntry("Settings", "ViewSphereEnabled", 1), // LC_PROFILE_VIEW_SPHERE_ENABLED
|
||||
lcProfileEntry("Settings", "ViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_VIEW_SPHERE_LOCATION
|
||||
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", "ViewSphereTextColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_TEXT_COLOR
|
||||
lcProfileEntry("Settings", "ViewSphereHighlightColor", LC_RGBA(255, 0, 0, 255)), // LC_PROFILE_VIEW_SPHERE_HIGHLIGHT_COLOR
|
||||
|
||||
lcProfileEntry("Settings", "Language", ""), // LC_PROFILE_LANGUAGE
|
||||
lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
|
||||
lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
|
||||
lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
|
||||
lcProfileEntry("Settings", "PartPalettes"), // LC_PROFILE_PART_PALETTES
|
||||
lcProfileEntry("Settings", "MinifigSettings", ""), // LC_PROFILE_MINIFIG_SETTINGS
|
||||
lcProfileEntry("Settings", "ColorConfig", ""), // LC_PROFILE_COLOR_CONFIG
|
||||
lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
|
||||
lcProfileEntry("Settings", "MouseShortcuts", QStringList()), // LC_PROFILE_MOUSE_SHORTCUTS
|
||||
lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
|
||||
lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1
|
||||
lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2
|
||||
lcProfileEntry("Settings", "RecentFile3", ""), // LC_PROFILE_RECENT_FILE3
|
||||
lcProfileEntry("Settings", "RecentFile4", ""), // LC_PROFILE_RECENT_FILE4
|
||||
lcProfileEntry("Settings", "AutoLoadMostRecent", false), // LC_PROFILE_AUTOLOAD_MOSTRECENT
|
||||
lcProfileEntry("Settings", "RestoreTabLayout", true), // LC_PROFILE_RESTORE_TAB_LAYOUT
|
||||
lcProfileEntry("Settings", "AutosaveInterval", 10), // LC_PROFILE_AUTOSAVE_INTERVAL
|
||||
lcProfileEntry("Settings", "MouseSensitivity", 11), // LC_PROFILE_MOUSE_SENSITIVITY
|
||||
lcProfileEntry("Settings", "ImageWidth", 1280), // LC_PROFILE_IMAGE_WIDTH
|
||||
lcProfileEntry("Settings", "ImageHeight", 720), // LC_PROFILE_IMAGE_HEIGHT
|
||||
lcProfileEntry("Settings", "ImageExtension", ".png"), // LC_PROFILE_IMAGE_EXTENSION
|
||||
lcProfileEntry("Settings", "PartsListIcons", 64), // LC_PROFILE_PARTS_LIST_ICONS
|
||||
lcProfileEntry("Settings", "PartsListNames", 0), // LC_PROFILE_PARTS_LIST_NAMES
|
||||
lcProfileEntry("Settings", "PartsListFixedColor", -1), // LC_PROFILE_PARTS_LIST_FIXED_COLOR
|
||||
lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
|
||||
lcProfileEntry("Settings", "PartsListAliases", 1), // LC_PROFILE_PARTS_LIST_ALIASES
|
||||
lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
|
||||
lcProfileEntry("Settings", "StudLogo", 0), // LC_PROFILE_STUD_LOGO
|
||||
lcProfileEntry("Settings", "Language", ""), // LC_PROFILE_LANGUAGE
|
||||
lcProfileEntry("Settings", "CheckUpdates", 1), // LC_PROFILE_CHECK_UPDATES
|
||||
lcProfileEntry("Settings", "ProjectsPath", ""), // LC_PROFILE_PROJECTS_PATH
|
||||
lcProfileEntry("Settings", "PartsLibrary", ""), // LC_PROFILE_PARTS_LIBRARY
|
||||
lcProfileEntry("Settings", "PartPalettes"), // LC_PROFILE_PART_PALETTES
|
||||
lcProfileEntry("Settings", "MinifigSettings", ""), // LC_PROFILE_MINIFIG_SETTINGS
|
||||
lcProfileEntry("Settings", "ColorConfig", ""), // LC_PROFILE_COLOR_CONFIG
|
||||
lcProfileEntry("Settings", "Shortcuts"), // LC_PROFILE_KEYBOARD_SHORTCUTS
|
||||
lcProfileEntry("Settings", "MouseShortcuts", QStringList()), // LC_PROFILE_MOUSE_SHORTCUTS
|
||||
lcProfileEntry("Settings", "Categories"), // LC_PROFILE_CATEGORIES
|
||||
lcProfileEntry("Settings", "RecentFile1", ""), // LC_PROFILE_RECENT_FILE1
|
||||
lcProfileEntry("Settings", "RecentFile2", ""), // LC_PROFILE_RECENT_FILE2
|
||||
lcProfileEntry("Settings", "RecentFile3", ""), // LC_PROFILE_RECENT_FILE3
|
||||
lcProfileEntry("Settings", "RecentFile4", ""), // LC_PROFILE_RECENT_FILE4
|
||||
lcProfileEntry("Settings", "AutoLoadMostRecent", false), // LC_PROFILE_AUTOLOAD_MOSTRECENT
|
||||
lcProfileEntry("Settings", "RestoreTabLayout", true), // LC_PROFILE_RESTORE_TAB_LAYOUT
|
||||
lcProfileEntry("Settings", "AutosaveInterval", 10), // LC_PROFILE_AUTOSAVE_INTERVAL
|
||||
lcProfileEntry("Settings", "MouseSensitivity", 11), // LC_PROFILE_MOUSE_SENSITIVITY
|
||||
lcProfileEntry("Settings", "ImageWidth", 1280), // LC_PROFILE_IMAGE_WIDTH
|
||||
lcProfileEntry("Settings", "ImageHeight", 720), // LC_PROFILE_IMAGE_HEIGHT
|
||||
lcProfileEntry("Settings", "ImageExtension", ".png"), // LC_PROFILE_IMAGE_EXTENSION
|
||||
lcProfileEntry("Settings", "PartsListIcons", 64), // LC_PROFILE_PARTS_LIST_ICONS
|
||||
lcProfileEntry("Settings", "PartsListNames", 0), // LC_PROFILE_PARTS_LIST_NAMES
|
||||
lcProfileEntry("Settings", "PartsListFixedColor", -1), // LC_PROFILE_PARTS_LIST_FIXED_COLOR
|
||||
lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
|
||||
lcProfileEntry("Settings", "PartsListAliases", 1), // LC_PROFILE_PARTS_LIST_ALIASES
|
||||
lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
|
||||
lcProfileEntry("Settings", "StudLogo", 0), // LC_PROFILE_STUD_LOGO
|
||||
|
||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||
lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
|
||||
lcProfileEntry("Defaults", "FloorTexture", ""), // LC_PROFILE_DEFAULT_FLOOR_TEXTURE
|
||||
lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
|
||||
lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
|
||||
lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
|
||||
lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
|
||||
lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
|
||||
lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
|
||||
lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
|
||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||
lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
|
||||
lcProfileEntry("Defaults", "FloorTexture", ""), // LC_PROFILE_DEFAULT_FLOOR_TEXTURE
|
||||
lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
|
||||
lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
|
||||
lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
|
||||
lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
|
||||
lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
|
||||
lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
|
||||
lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
|
||||
|
||||
lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageWidth", 640), // LC_PROFILE_HTML_IMAGE_WIDTH
|
||||
lcProfileEntry("HTML", "ImageHeight", 480), // LC_PROFILE_HTML_IMAGE_HEIGHT
|
||||
lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageWidth", 640), // LC_PROFILE_HTML_IMAGE_WIDTH
|
||||
lcProfileEntry("HTML", "ImageHeight", 480), // LC_PROFILE_HTML_IMAGE_HEIGHT
|
||||
|
||||
lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
|
||||
lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
|
||||
lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
|
||||
lcProfileEntry("POVRay", "Height", 720) // LC_PROFILE_POVRAY_HEIGHT
|
||||
lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
|
||||
lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
|
||||
lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
|
||||
lcProfileEntry("POVRay", "Height", 720) // LC_PROFILE_POVRAY_HEIGHT
|
||||
};
|
||||
|
||||
void lcRemoveProfileKey(LC_PROFILE_KEY Key)
|
||||
|
|
|
@ -127,16 +127,16 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
|
|||
|
||||
if (DrawLit)
|
||||
{
|
||||
FlatMaterial = LC_MATERIAL_FAKELIT_COLOR;
|
||||
TexturedMaterial = LC_MATERIAL_FAKELIT_TEXTURE_DECAL;
|
||||
FlatMaterial = lcMaterialType::FakeLitColor;
|
||||
TexturedMaterial = lcMaterialType::FakeLitTextureDecal;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlatMaterial = LC_MATERIAL_UNLIT_COLOR;
|
||||
TexturedMaterial = LC_MATERIAL_UNLIT_TEXTURE_DECAL;
|
||||
FlatMaterial = lcMaterialType::UnlitColor;
|
||||
TexturedMaterial = lcMaterialType::UnlitTextureDecal;
|
||||
}
|
||||
|
||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_OPAQUE);
|
||||
Context->SetPolygonOffset(lcPolygonOffset::Opaque);
|
||||
|
||||
for (int MeshIndex : mOpaqueMeshes)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
|
|||
}
|
||||
|
||||
Context->BindTexture2D(0);
|
||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_NONE);
|
||||
Context->SetPolygonOffset(lcPolygonOffset::None);
|
||||
}
|
||||
|
||||
void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
||||
|
@ -294,18 +294,18 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
|||
|
||||
if (DrawLit)
|
||||
{
|
||||
FlatMaterial = LC_MATERIAL_FAKELIT_COLOR;
|
||||
TexturedMaterial = LC_MATERIAL_FAKELIT_TEXTURE_DECAL;
|
||||
FlatMaterial = lcMaterialType::FakeLitColor;
|
||||
TexturedMaterial = lcMaterialType::FakeLitTextureDecal;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlatMaterial = LC_MATERIAL_UNLIT_COLOR;
|
||||
TexturedMaterial = LC_MATERIAL_UNLIT_TEXTURE_DECAL;
|
||||
FlatMaterial = lcMaterialType::UnlitColor;
|
||||
TexturedMaterial = lcMaterialType::UnlitTextureDecal;
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
Context->SetDepthWrite(false);
|
||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_TRANSLUCENT);
|
||||
Context->SetPolygonOffset(lcPolygonOffset::Translucent);
|
||||
|
||||
for (const lcTranslucentMeshInstance& MeshInstance : mTranslucentMeshes)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit) const
|
|||
}
|
||||
|
||||
Context->BindTexture2D(0);
|
||||
Context->SetPolygonOffset(LC_POLYGON_OFFSET_NONE);
|
||||
Context->SetPolygonOffset(lcPolygonOffset::None);
|
||||
|
||||
Context->SetDepthWrite(true);
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -386,10 +386,10 @@ void lcScene::Draw(lcContext* Context) const
|
|||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
|
||||
lcShadingMode ShadingMode = Preferences.mShadingMode;
|
||||
if (ShadingMode == LC_SHADING_WIREFRAME && !mAllowWireframe)
|
||||
ShadingMode = LC_SHADING_FLAT;
|
||||
if (ShadingMode == lcShadingMode::Wireframe && !mAllowWireframe)
|
||||
ShadingMode = lcShadingMode::Flat;
|
||||
|
||||
if (ShadingMode == LC_SHADING_WIREFRAME)
|
||||
if (ShadingMode == lcShadingMode::Wireframe)
|
||||
{
|
||||
int PrimitiveTypes = LC_MESH_LINES;
|
||||
|
||||
|
@ -401,7 +401,7 @@ void lcScene::Draw(lcContext* Context) const
|
|||
if (mPreTranslucentCallback)
|
||||
mPreTranslucentCallback();
|
||||
}
|
||||
else if (ShadingMode == LC_SHADING_FLAT)
|
||||
else if (ShadingMode == lcShadingMode::Flat)
|
||||
{
|
||||
bool DrawLines = Preferences.mDrawEdgeLines && Preferences.mLineWidth != 0.0f;
|
||||
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
|
||||
lcStringCache gStringCache;
|
||||
|
||||
lcStringCache::lcStringCache()
|
||||
constexpr lcStringCache::lcStringCache()
|
||||
: mTexture(nullptr), mRefCount(0)
|
||||
{
|
||||
mTexture = nullptr;
|
||||
mRefCount = 0;
|
||||
}
|
||||
|
||||
lcStringCache::~lcStringCache()
|
||||
|
|
|
@ -8,7 +8,7 @@ struct lcStringCacheEntry
|
|||
class lcStringCache
|
||||
{
|
||||
public:
|
||||
lcStringCache();
|
||||
constexpr lcStringCache();
|
||||
~lcStringCache();
|
||||
|
||||
void AddRef(lcContext* Context);
|
||||
|
|
|
@ -162,8 +162,8 @@ void lcViewSphere::Draw()
|
|||
int Height = mView->mHeight;
|
||||
lcViewSphereLocation Location = Preferences.mViewSphereLocation;
|
||||
|
||||
int Left = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
|
||||
int Bottom = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
|
||||
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
||||
Context->SetViewport(Left, Bottom, ViewportSize, ViewportSize);
|
||||
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
|
@ -173,7 +173,7 @@ void lcViewSphere::Draw()
|
|||
Context->SetVertexFormatPosition(3);
|
||||
Context->SetIndexBuffer(mIndexBuffer);
|
||||
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||
Context->SetColor(lcVector4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
|
||||
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->SetMaterial(LC_MATERIAL_UNLIT_VIEW_SPHERE);
|
||||
Context->SetMaterial(lcMaterialType::UnlitViewSphere);
|
||||
Context->BindTextureCubeMap(mTexture->mTexture);
|
||||
|
||||
Context->SetWorldMatrix(lcMatrix44Identity());
|
||||
|
@ -305,8 +305,8 @@ std::bitset<6> lcViewSphere::GetIntersectionFlags(lcVector3& Intersection) const
|
|||
int Width = mView->mWidth;
|
||||
int Height = mView->mHeight;
|
||||
int ViewportSize = Preferences.mViewSphereSize;
|
||||
int Left = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::TOP_LEFT) ? 0 : Width - ViewportSize;
|
||||
int Bottom = (Location == lcViewSphereLocation::BOTTOM_LEFT || Location == lcViewSphereLocation::BOTTOM_RIGHT) ? 0 : Height - ViewportSize;
|
||||
int Left = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::TopLeft) ? 0 : Width - ViewportSize;
|
||||
int Bottom = (Location == lcViewSphereLocation::BottomLeft || Location == lcViewSphereLocation::BottomRight) ? 0 : Height - ViewportSize;
|
||||
int x = mView->mInputState.x - Left;
|
||||
int y = mView->mInputState.y - Bottom;
|
||||
std::bitset<6> IntersectionFlags;
|
||||
|
|
|
@ -284,7 +284,7 @@ void lcLight::UpdatePosition(lcStep Step)
|
|||
void lcLight::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
||||
{
|
||||
Q_UNUSED(Scene);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||
|
||||
if (IsPointLight())
|
||||
DrawPointLight(Context);
|
||||
|
|
|
@ -557,7 +557,7 @@ void lcPiece::DrawInterface(lcContext* Context, const lcScene& Scene) const
|
|||
};
|
||||
|
||||
lcMatrix44 WorldMatrix = Scene.ApplyActiveSubmodelTransform(mModelWorld);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
Context->SetMaterial(lcMaterialType::UnlitColor);
|
||||
Context->SetWorldMatrix(WorldMatrix);
|
||||
|
||||
if (IsFocused(LC_PIECE_SECTION_POSITION))
|
||||
|
|
|
@ -955,7 +955,7 @@ void View::OnDraw()
|
|||
|
||||
void View::DrawSelectMoveOverlay()
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ void View::DrawRotateOverlay()
|
|||
const float OverlayScale = GetOverlayScale();
|
||||
const float OverlayRotateRadius = 2.0f;
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||
|
||||
|
@ -1417,7 +1417,7 @@ void View::DrawRotateOverlay()
|
|||
// Draw text.
|
||||
lcVector3 ScreenPos = ProjectPoint(OverlayCenter);
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||
|
@ -1441,7 +1441,7 @@ void View::DrawRotateOverlay()
|
|||
|
||||
void View::DrawSelectZoomRegionOverlay()
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||
|
@ -1527,7 +1527,7 @@ void View::DrawRotateViewOverlay()
|
|||
w = mWidth;
|
||||
h = mHeight;
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1));
|
||||
|
@ -1738,7 +1738,7 @@ void View::DrawGrid()
|
|||
mContext->SetDepthWrite(false);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridStudColor));
|
||||
|
||||
mContext->SetVertexFormat(0, 3, 0, 2, 0, false);
|
||||
|
@ -1753,7 +1753,7 @@ void View::DrawGrid()
|
|||
if (Preferences.mDrawGridLines)
|
||||
{
|
||||
mContext->SetLineWidth(1.0f);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridLineColor));
|
||||
|
||||
int NumVerts = 2 * (MaxX - MinX + MaxY - MinY + 2);
|
||||
|
@ -1790,7 +1790,7 @@ void View::DrawAxes()
|
|||
lcMatrix44 WorldViewMatrix = mCamera->mWorldView;
|
||||
WorldViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMul(WorldViewMatrix, TranslationMatrix));
|
||||
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->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->BindTexture2D(gTexFont.GetTexture());
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -1842,7 +1842,7 @@ void View::DrawViewport()
|
|||
|
||||
if (gMainWindow->GetActiveView() == this)
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||
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 };
|
||||
|
||||
|
@ -1855,7 +1855,7 @@ void View::DrawViewport()
|
|||
|
||||
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->BindTexture2D(gTexFont.GetTexture());
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ lcQGLWidget::lcQGLWidget(QWidget *parent, lcGLWidget *owner, bool view)
|
|||
View::CreateResources(widget->mContext);
|
||||
lcViewSphere::CreateResources(widget->mContext);
|
||||
|
||||
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == LC_SHADING_DEFAULT_LIGHTS)
|
||||
lcGetPreferences().mShadingMode = LC_SHADING_FLAT;
|
||||
if (!gSupportsShaderObjects && lcGetPreferences().mShadingMode == lcShadingMode::DefaultLights)
|
||||
lcGetPreferences().mShadingMode = lcShadingMode::Flat;
|
||||
|
||||
if (!gSupportsFramebufferObjectARB && !gSupportsFramebufferObjectEXT)
|
||||
gMainWindow->GetPartSelectionWidget()->DisableIconMode();
|
||||
|
|
|
@ -105,8 +105,8 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
ui->studLogoCombo->setCurrentIndex(mOptions->StudLogo);
|
||||
|
||||
if (!gSupportsShaderObjects)
|
||||
ui->ShadingMode->removeItem(LC_SHADING_DEFAULT_LIGHTS);
|
||||
ui->ShadingMode->setCurrentIndex(mOptions->Preferences.mShadingMode);
|
||||
ui->ShadingMode->removeItem(static_cast<int>(lcShadingMode::DefaultLights));
|
||||
ui->ShadingMode->setCurrentIndex(static_cast<int>(mOptions->Preferences.mShadingMode));
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
|
|
Loading…
Reference in a new issue