mirror of
https://github.com/leozide/leocad
synced 2025-01-28 19:58:12 +01:00
Added a decal material to fix the texmap extension.
This commit is contained in:
parent
e645228128
commit
acd5a485f0
10 changed files with 260 additions and 345 deletions
|
@ -468,7 +468,7 @@ void lcCamera::CopyPosition(const lcCamera* camera)
|
|||
|
||||
void lcCamera::DrawInterface(lcContext* Context) const
|
||||
{
|
||||
Context->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
|
||||
lcMatrix44 ViewWorldMatrix = lcMatrix44AffineInverse(mWorldView);
|
||||
ViewWorldMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
|
||||
#endif
|
||||
|
||||
lcProgram lcContext::mPrograms[LC_NUM_LIGHTING_MODES][LC_NUM_MATERIALS];
|
||||
lcProgram lcContext::mPrograms[LC_NUM_MATERIALS];
|
||||
|
||||
static int lcOpaqueRenderMeshCompare(const void* Elem1, const void* Elem2)
|
||||
{
|
||||
|
@ -133,324 +133,237 @@ void lcContext::CreateShaderPrograms()
|
|||
" vec3 SpecularColor = vec3(Specular, Specular, Specular);\n" \
|
||||
" float Diffuse = min(abs(dot(Normal, LightDirection)) * 0.6 + 0.65, 1.0);\n"
|
||||
|
||||
const char* VertexShaders[LC_NUM_LIGHTING_MODES][LC_NUM_MATERIALS] =
|
||||
const char* VertexShaders[LC_NUM_MATERIALS] =
|
||||
{
|
||||
// LC_LIGHTING_UNLIT
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec4 VertexColor;\n"
|
||||
LC_VERTEX_OUTPUT "vec4 PixelColor;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelColor = VertexColor;\n"
|
||||
"}\n"
|
||||
},
|
||||
// LC_LIGHTING_FAKE
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec3 VertexNormal;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelPosition;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelNormal;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"uniform mat4 WorldMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" PixelPosition = (WorldMatrix * vec4(VertexPosition, 1.0)).xyz;\n"
|
||||
" PixelNormal = (WorldMatrix * vec4(VertexNormal, 0.0)).xyz;\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec3 VertexNormal;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelPosition;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelNormal;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"uniform mat4 WorldMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" PixelPosition = (WorldMatrix * vec4(VertexPosition, 1.0)).xyz;\n"
|
||||
" PixelNormal = (WorldMatrix * vec4(VertexNormal, 0.0)).xyz;\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec3 VertexNormal;\n"
|
||||
LC_VERTEX_INPUT "vec4 VertexColor;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelPosition;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelNormal;\n"
|
||||
LC_VERTEX_OUTPUT "vec4 PixelColor;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"uniform mat4 WorldMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" PixelPosition = (WorldMatrix * vec4(VertexPosition, 1.0)).xyz;\n"
|
||||
" PixelNormal = (WorldMatrix * vec4(VertexNormal, 0.0)).xyz;\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelColor = VertexColor;\n"
|
||||
"}\n"
|
||||
},
|
||||
// LC_LIGHTING_FULL
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec4 VertexColor;\n"
|
||||
LC_VERTEX_OUTPUT "vec4 PixelColor;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelColor = VertexColor;\n"
|
||||
"}\n"
|
||||
}
|
||||
// LC_MATERIAL_UNLIT_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec4 VertexColor;\n"
|
||||
LC_VERTEX_OUTPUT "vec4 PixelColor;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelColor = VertexColor;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_FAKELIT_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec3 VertexNormal;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelPosition;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelNormal;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"uniform mat4 WorldMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" PixelPosition = (WorldMatrix * vec4(VertexPosition, 1.0)).xyz;\n"
|
||||
" PixelNormal = (WorldMatrix * vec4(VertexNormal, 0.0)).xyz;\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
||||
LC_SHADER_VERSION
|
||||
LC_VERTEX_INPUT "vec3 VertexPosition;\n"
|
||||
LC_VERTEX_INPUT "vec3 VertexNormal;\n"
|
||||
LC_VERTEX_INPUT "vec2 VertexTexCoord;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelPosition;\n"
|
||||
LC_VERTEX_OUTPUT "vec3 PixelNormal;\n"
|
||||
LC_VERTEX_OUTPUT "vec2 PixelTexCoord;\n"
|
||||
"uniform mat4 WorldViewProjectionMatrix;\n"
|
||||
"uniform mat4 WorldMatrix;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" PixelPosition = (WorldMatrix * vec4(VertexPosition, 1.0)).xyz;\n"
|
||||
" PixelNormal = (WorldMatrix * vec4(VertexNormal, 0.0)).xyz;\n"
|
||||
" gl_Position = WorldViewProjectionMatrix * vec4(VertexPosition, 1.0);\n"
|
||||
" PixelTexCoord = VertexTexCoord;\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
const char* FragmentShaders[LC_NUM_LIGHTING_MODES][LC_NUM_MATERIALS] =
|
||||
const char* FragmentShaders[LC_NUM_MATERIALS] =
|
||||
{
|
||||
// LC_LIGHTING_UNLIT
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = MaterialColor;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" gl_FragColor = vec4(MaterialColor.rgb, TexelColor.a * MaterialColor.a);\n"//vec4(mix(MaterialColor.xyz, TexelColor.xyz, TexelColor.a), MaterialColor.a);\n" // TODO: we need to support different texture modes, this shader is used by the overlay font, base grid and texmap pieces.
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec4 PixelColor;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = PixelColor;\n"
|
||||
"}\n"
|
||||
},
|
||||
// LC_LIGHTING_FAKE
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec3 PixelPosition;\n"
|
||||
LC_PIXEL_INPUT "vec3 PixelNormal;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform mediump vec3 LightPosition;\n"
|
||||
"uniform mediump vec3 EyePosition;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
LC_PIXEL_FAKE_LIGHTING
|
||||
" vec3 DiffuseColor = MaterialColor.rgb * Diffuse;\n"
|
||||
" gl_FragColor = vec4(DiffuseColor + SpecularColor, MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec3 PixelPosition;\n"
|
||||
LC_PIXEL_INPUT "vec3 PixelNormal;\n"
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform mediump vec3 LightPosition;\n"
|
||||
"uniform mediump vec3 EyePosition;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
LC_PIXEL_FAKE_LIGHTING
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" vec3 DiffuseColor = mix(MaterialColor.xyz, TexelColor.xyz, TexelColor.a) * Diffuse;\n"
|
||||
" gl_FragColor = vec4(DiffuseColor + SpecularColor, MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec3 PixelPosition;\n"
|
||||
LC_PIXEL_INPUT "vec3 PixelNormal;\n"
|
||||
LC_PIXEL_INPUT "vec4 PixelColor;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec3 LightPosition;\n"
|
||||
"uniform mediump vec3 EyePosition;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
LC_PIXEL_FAKE_LIGHTING
|
||||
" vec3 DiffuseColor = PixelColor.rgb * Diffuse;\n"
|
||||
" gl_FragColor = vec4(DiffuseColor + SpecularColor, PixelColor.a);\n"
|
||||
"}\n"
|
||||
},
|
||||
// LC_LIGHTING_FULL
|
||||
{
|
||||
// LC_MATERIAL_SIMPLE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = MaterialColor;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_TEXTURE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" gl_FragColor = vec4(mix(MaterialColor.xyz, TexelColor.xyz, TexelColor.a), MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec4 PixelColor;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = PixelColor;\n"
|
||||
"}\n"
|
||||
}
|
||||
// LC_MATERIAL_UNLIT_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = MaterialColor;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_TEXTURE_MODULATE
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" gl_FragColor = vec4(MaterialColor.rgb, TexelColor.a * MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_TEXTURE_DECAL
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" gl_FragColor = vec4(mix(MaterialColor.xyz, TexelColor.xyz, TexelColor.a), MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_UNLIT_VERTEX_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec4 PixelColor;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor = PixelColor;\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_FAKELIT_COLOR
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec3 PixelPosition;\n"
|
||||
LC_PIXEL_INPUT "vec3 PixelNormal;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform mediump vec3 LightPosition;\n"
|
||||
"uniform mediump vec3 EyePosition;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
LC_PIXEL_FAKE_LIGHTING
|
||||
" vec3 DiffuseColor = MaterialColor.rgb * Diffuse;\n"
|
||||
" gl_FragColor = vec4(DiffuseColor + SpecularColor, MaterialColor.a);\n"
|
||||
"}\n",
|
||||
// LC_MATERIAL_FAKELIT_TEXTURE_DECAL
|
||||
LC_SHADER_VERSION
|
||||
LC_PIXEL_INPUT "vec3 PixelPosition;\n"
|
||||
LC_PIXEL_INPUT "vec3 PixelNormal;\n"
|
||||
LC_PIXEL_INPUT "vec2 PixelTexCoord;\n"
|
||||
LC_PIXEL_OUTPUT
|
||||
"uniform mediump vec4 MaterialColor;\n"
|
||||
"uniform mediump vec3 LightPosition;\n"
|
||||
"uniform mediump vec3 EyePosition;\n"
|
||||
"uniform sampler2D Texture;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
LC_PIXEL_FAKE_LIGHTING
|
||||
" vec4 TexelColor = texture2D(Texture, PixelTexCoord);"
|
||||
" vec3 DiffuseColor = mix(MaterialColor.xyz, TexelColor.xyz, TexelColor.a) * Diffuse;\n"
|
||||
" gl_FragColor = vec4(DiffuseColor + SpecularColor, MaterialColor.a);\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
for (int LightingMode = 0; LightingMode < LC_NUM_LIGHTING_MODES; LightingMode++)
|
||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
||||
{
|
||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
||||
GLuint VertexShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(VertexShader, 1, &VertexShaders[MaterialType], NULL);
|
||||
glCompileShader(VertexShader);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
GLint VertexShaderCompiled = 0;
|
||||
glGetShaderiv(VertexShader, GL_COMPILE_STATUS, &VertexShaderCompiled);
|
||||
|
||||
if (VertexShaderCompiled == GL_FALSE)
|
||||
{
|
||||
GLuint VertexShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(VertexShader, 1, &VertexShaders[LightingMode][MaterialType], NULL);
|
||||
glCompileShader(VertexShader);
|
||||
GLint Length = 0;
|
||||
glGetShaderiv(VertexShader, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
GLint VertexShaderCompiled = 0;
|
||||
glGetShaderiv(VertexShader, GL_COMPILE_STATUS, &VertexShaderCompiled);
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetShaderInfoLog(VertexShader, Length, &Length, InfoLog.data());
|
||||
|
||||
if (VertexShaderCompiled == GL_FALSE)
|
||||
{
|
||||
GLint Length = 0;
|
||||
glGetShaderiv(VertexShader, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetShaderInfoLog(VertexShader, Length, &Length, InfoLog.data());
|
||||
|
||||
qDebug() << InfoLog;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLuint FragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(FragmentShader, 1, &FragmentShaders[LightingMode][MaterialType], NULL);
|
||||
glCompileShader(FragmentShader);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
GLint FragmentShaderCompiled = 0;
|
||||
glGetShaderiv(FragmentShader, GL_COMPILE_STATUS, &FragmentShaderCompiled);
|
||||
|
||||
if (FragmentShaderCompiled == GL_FALSE)
|
||||
{
|
||||
GLint Length = 0;
|
||||
glGetShaderiv(FragmentShader, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetShaderInfoLog(FragmentShader, Length, &Length, InfoLog.data());
|
||||
|
||||
qDebug() << InfoLog;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLuint Program = glCreateProgram();
|
||||
|
||||
glAttachShader(Program, VertexShader);
|
||||
glAttachShader(Program, FragmentShader);
|
||||
|
||||
glBindAttribLocation(Program, LC_ATTRIB_POSITION, "VertexPosition");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_NORMAL, "VertexNormal");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_TEXCOORD, "VertexTexCoord");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_COLOR, "VertexColor");
|
||||
|
||||
glLinkProgram(Program);
|
||||
|
||||
glDetachShader(Program, VertexShader);
|
||||
glDetachShader(Program, FragmentShader);
|
||||
glDeleteShader(VertexShader);
|
||||
glDeleteShader(FragmentShader);
|
||||
|
||||
GLint IsLinked = 0;
|
||||
glGetProgramiv(Program, GL_LINK_STATUS, &IsLinked);
|
||||
if (IsLinked == GL_FALSE)
|
||||
{
|
||||
GLint Length = 0;
|
||||
glGetProgramiv(Program, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetProgramInfoLog(Program, Length, &Length, InfoLog.data());
|
||||
|
||||
glDeleteProgram(Program);
|
||||
Program = 0;
|
||||
}
|
||||
|
||||
mPrograms[LightingMode][MaterialType].Object = Program;
|
||||
mPrograms[LightingMode][MaterialType].WorldViewProjectionMatrixLocation = glGetUniformLocation(Program, "WorldViewProjectionMatrix");
|
||||
mPrograms[LightingMode][MaterialType].WorldMatrixLocation = glGetUniformLocation(Program, "WorldMatrix");
|
||||
mPrograms[LightingMode][MaterialType].MaterialColorLocation = glGetUniformLocation(Program, "MaterialColor");
|
||||
mPrograms[LightingMode][MaterialType].LightPositionLocation = glGetUniformLocation(Program, "LightPosition");
|
||||
mPrograms[LightingMode][MaterialType].EyePositionLocation = glGetUniformLocation(Program, "EyePosition");
|
||||
qDebug() << InfoLog;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLuint FragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(FragmentShader, 1, &FragmentShaders[MaterialType], NULL);
|
||||
glCompileShader(FragmentShader);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
GLint FragmentShaderCompiled = 0;
|
||||
glGetShaderiv(FragmentShader, GL_COMPILE_STATUS, &FragmentShaderCompiled);
|
||||
|
||||
if (FragmentShaderCompiled == GL_FALSE)
|
||||
{
|
||||
GLint Length = 0;
|
||||
glGetShaderiv(FragmentShader, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetShaderInfoLog(FragmentShader, Length, &Length, InfoLog.data());
|
||||
|
||||
qDebug() << InfoLog;
|
||||
}
|
||||
#endif
|
||||
|
||||
GLuint Program = glCreateProgram();
|
||||
|
||||
glAttachShader(Program, VertexShader);
|
||||
glAttachShader(Program, FragmentShader);
|
||||
|
||||
glBindAttribLocation(Program, LC_ATTRIB_POSITION, "VertexPosition");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_NORMAL, "VertexNormal");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_TEXCOORD, "VertexTexCoord");
|
||||
glBindAttribLocation(Program, LC_ATTRIB_COLOR, "VertexColor");
|
||||
|
||||
glLinkProgram(Program);
|
||||
|
||||
glDetachShader(Program, VertexShader);
|
||||
glDetachShader(Program, FragmentShader);
|
||||
glDeleteShader(VertexShader);
|
||||
glDeleteShader(FragmentShader);
|
||||
|
||||
GLint IsLinked = 0;
|
||||
glGetProgramiv(Program, GL_LINK_STATUS, &IsLinked);
|
||||
if (IsLinked == GL_FALSE)
|
||||
{
|
||||
GLint Length = 0;
|
||||
glGetProgramiv(Program, GL_INFO_LOG_LENGTH, &Length);
|
||||
|
||||
QByteArray InfoLog;
|
||||
InfoLog.resize(Length);
|
||||
glGetProgramInfoLog(Program, Length, &Length, InfoLog.data());
|
||||
|
||||
glDeleteProgram(Program);
|
||||
Program = 0;
|
||||
}
|
||||
|
||||
mPrograms[MaterialType].Object = Program;
|
||||
mPrograms[MaterialType].WorldViewProjectionMatrixLocation = glGetUniformLocation(Program, "WorldViewProjectionMatrix");
|
||||
mPrograms[MaterialType].WorldMatrixLocation = glGetUniformLocation(Program, "WorldMatrix");
|
||||
mPrograms[MaterialType].MaterialColorLocation = glGetUniformLocation(Program, "MaterialColor");
|
||||
mPrograms[MaterialType].LightPositionLocation = glGetUniformLocation(Program, "LightPosition");
|
||||
mPrograms[MaterialType].EyePositionLocation = glGetUniformLocation(Program, "EyePosition");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,9 +380,11 @@ void lcContext::DestroyResources()
|
|||
if (!gSupportsShaderObjects)
|
||||
return;
|
||||
|
||||
for (int LightingMode = 0; LightingMode < LC_NUM_LIGHTING_MODES; LightingMode++)
|
||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
||||
glDeleteProgram(mPrograms[LightingMode][MaterialType].Object);
|
||||
for (int MaterialType = 0; MaterialType < LC_NUM_MATERIALS; MaterialType++)
|
||||
{
|
||||
glDeleteProgram(mPrograms[MaterialType].Object);
|
||||
mPrograms[MaterialType].Object = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void lcContext::SetDefaultState()
|
||||
|
@ -551,10 +466,10 @@ void lcContext::SetMaterial(lcMaterialType MaterialType)
|
|||
if (!gSupportsShaderObjects || mMaterialType == MaterialType)
|
||||
return;
|
||||
|
||||
glUseProgram(mPrograms[mLightingMode][MaterialType].Object);
|
||||
glUseProgram(mPrograms[MaterialType].Object);
|
||||
mMaterialType = MaterialType;
|
||||
mColorDirty = true;
|
||||
mWorldMatrixDirty = true;
|
||||
mWorldMatrixDirty = true; // todo: change dirty to a bitfield and set the lighting constants dirty here
|
||||
}
|
||||
|
||||
void lcContext::SetViewport(int x, int y, int Width, int Height)
|
||||
|
@ -1140,7 +1055,7 @@ void lcContext::FlushState()
|
|||
{
|
||||
if (gSupportsShaderObjects)
|
||||
{
|
||||
const lcProgram& Program = mPrograms[mLightingMode][mMaterialType];
|
||||
const lcProgram& Program = mPrograms[mMaterialType];
|
||||
|
||||
if (mWorldMatrixDirty || mViewMatrixDirty || mProjectionMatrixDirty)
|
||||
{
|
||||
|
@ -1236,7 +1151,7 @@ void lcContext::DrawMeshSection(lcMesh* Mesh, lcMeshSection* Section)
|
|||
|
||||
if (!Texture)
|
||||
{
|
||||
SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
SetMaterial(mLightingMode == LC_LIGHTING_UNLIT ? LC_MATERIAL_UNLIT_COLOR : LC_MATERIAL_FAKELIT_COLOR);
|
||||
SetVertexFormat(VertexBufferOffset, 3, 1, 0, 0);
|
||||
|
||||
if (mTexture)
|
||||
|
@ -1248,7 +1163,7 @@ void lcContext::DrawMeshSection(lcMesh* Mesh, lcMeshSection* Section)
|
|||
else
|
||||
{
|
||||
VertexBufferOffset += Mesh->mNumVertices * sizeof(lcVertex);
|
||||
SetMaterial(LC_MATERIAL_TEXTURE);
|
||||
SetMaterial(mLightingMode == LC_LIGHTING_UNLIT ? LC_MATERIAL_UNLIT_TEXTURE_DECAL : LC_MATERIAL_FAKELIT_TEXTURE_DECAL);
|
||||
SetVertexFormat(VertexBufferOffset, 3, 1, 2, 0);
|
||||
|
||||
if (Texture != mTexture)
|
||||
|
|
|
@ -70,9 +70,12 @@ enum lcLightingMode : int
|
|||
|
||||
enum lcMaterialType
|
||||
{
|
||||
LC_MATERIAL_SIMPLE,
|
||||
LC_MATERIAL_TEXTURE,
|
||||
LC_MATERIAL_VERTEX_COLOR,
|
||||
LC_MATERIAL_UNLIT_COLOR,
|
||||
LC_MATERIAL_UNLIT_TEXTURE_MODULATE,
|
||||
LC_MATERIAL_UNLIT_TEXTURE_DECAL,
|
||||
LC_MATERIAL_UNLIT_VERTEX_COLOR,
|
||||
LC_MATERIAL_FAKELIT_COLOR,
|
||||
LC_MATERIAL_FAKELIT_TEXTURE_DECAL,
|
||||
LC_NUM_MATERIALS
|
||||
};
|
||||
|
||||
|
@ -97,7 +100,6 @@ struct lcProgram
|
|||
enum lcTextureMode
|
||||
{
|
||||
LC_TEXTURE_DECAL,
|
||||
LC_TEXTURE_REPLACE,
|
||||
LC_TEXTURE_MODULATE
|
||||
};
|
||||
|
||||
|
@ -214,7 +216,7 @@ protected:
|
|||
GLuint mFramebufferTexture;
|
||||
GLuint mDepthRenderbufferObject;
|
||||
|
||||
static lcProgram mPrograms[LC_NUM_LIGHTING_MODES][LC_NUM_MATERIALS];
|
||||
static lcProgram mPrograms[LC_NUM_MATERIALS];
|
||||
|
||||
Q_DECLARE_TR_FUNCTIONS(lcContext);
|
||||
};
|
||||
|
|
|
@ -1171,7 +1171,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
ViewWidth, 0.0f, Color2[0], Color2[1], Color2[2], 1.0f
|
||||
};
|
||||
|
||||
Context->SetMaterial(LC_MATERIAL_VERTEX_COLOR);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_VERTEX_COLOR);
|
||||
Context->SetVertexBufferPointer(Verts);
|
||||
Context->SetVertexFormat(0, 2, 0, 0, 4);
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
Context->SetTextureMode(LC_TEXTURE_REPLACE);
|
||||
Context->SetTextureMode(LC_TEXTURE_MODULATE);
|
||||
glBindTexture(GL_TEXTURE_2D, mBackgroundTexture->mTexture);
|
||||
|
||||
float TileWidth = 1.0f, TileHeight = 1.0f;
|
||||
|
@ -1206,7 +1206,8 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
|
|||
0.0f, 0.0f, 0.0f, TileHeight
|
||||
};
|
||||
|
||||
Context->SetMaterial(LC_MATERIAL_TEXTURE);
|
||||
Context->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
Context->SetVertexBufferPointer(Verts);
|
||||
Context->SetVertexFormat(0, 2, 0, 2, 0);
|
||||
|
||||
|
|
|
@ -334,8 +334,8 @@ void lcPartSelectionListModel::DrawPreview(int InfoIndex)
|
|||
|
||||
Context->SetDefaultState();
|
||||
Context->SetProjectionMatrix(ProjectionMatrix);
|
||||
Context->SetLightingMode(LC_LIGHTING_UNLIT);
|
||||
Context->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
Context->SetLightingMode(Preferences.mLightingMode);
|
||||
|
||||
lcPiecesLibrary* Library = lcGetPiecesLibrary();
|
||||
PieceInfo* Info = mParts[InfoIndex].first;
|
||||
|
|
|
@ -284,7 +284,7 @@ void lcLight::UpdatePosition(lcStep Step)
|
|||
|
||||
void lcLight::DrawInterface(lcContext* Context) const
|
||||
{
|
||||
Context->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
|
||||
if (IsPointLight())
|
||||
DrawPointLight(Context);
|
||||
|
|
|
@ -292,8 +292,8 @@ void MinifigWizard::OnDraw()
|
|||
|
||||
Scene.End();
|
||||
|
||||
mContext->SetLightingMode(LC_LIGHTING_UNLIT);
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
const lcPreferences& Preferences = lcGetPreferences();
|
||||
mContext->SetLightingMode(Preferences.mLightingMode);
|
||||
mContext->DrawOpaqueMeshes(Scene.mOpaqueMeshes);
|
||||
mContext->DrawTranslucentMeshes(Scene.mTranslucentMeshes);
|
||||
|
||||
|
|
|
@ -541,7 +541,7 @@ void lcPiece::DrawInterface(lcContext* Context) const
|
|||
{ Min[0], Min[1], Min[2] }, { Min[0], Min[1], Min[2] + Edge[2] },
|
||||
};
|
||||
|
||||
Context->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
Context->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
Context->SetWorldMatrix(mModelWorld);
|
||||
|
||||
if (IsFocused(LC_PIECE_SECTION_POSITION))
|
||||
|
|
|
@ -1313,7 +1313,6 @@ void Project::ExportHTML()
|
|||
|
||||
Context->SetDefaultState();
|
||||
Context->SetProjectionMatrix(ProjectionMatrix);
|
||||
Context->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
|
||||
for (lcPartsList::const_iterator PartIt = PartsList.constBegin(); PartIt != PartsList.constEnd(); PartIt++)
|
||||
{
|
||||
|
|
|
@ -570,7 +570,6 @@ void View::OnDraw()
|
|||
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||
mContext->SetLightingMode(Preferences.mLightingMode);
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
|
||||
#ifndef LC_OPENGLES
|
||||
const lcModelProperties& Properties = mModel->GetProperties();
|
||||
|
@ -599,7 +598,6 @@ void View::OnDraw()
|
|||
if (DrawInterface)
|
||||
{
|
||||
mContext->SetLightingMode(LC_LIGHTING_UNLIT);
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->DrawInterfaceObjects(mScene.mInterfaceObjects);
|
||||
|
||||
mContext->SetLineWidth(1.0f);
|
||||
|
@ -628,7 +626,7 @@ void View::OnDraw()
|
|||
|
||||
void View::DrawSelectMoveOverlay()
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||
|
||||
|
@ -819,7 +817,7 @@ void View::DrawRotateOverlay()
|
|||
const float OverlayScale = GetOverlayScale();
|
||||
const float OverlayRotateRadius = 2.0f;
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetViewMatrix(mCamera->mWorldView);
|
||||
mContext->SetProjectionMatrix(GetProjectionMatrix());
|
||||
|
||||
|
@ -1090,7 +1088,7 @@ void View::DrawRotateOverlay()
|
|||
// Draw text.
|
||||
lcVector3 ScreenPos = ProjectPoint(OverlayCenter);
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_TEXTURE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
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));
|
||||
|
@ -1119,7 +1117,7 @@ void View::DrawRotateOverlay()
|
|||
|
||||
void View::DrawSelectZoomRegionOverlay()
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
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));
|
||||
|
@ -1208,7 +1206,7 @@ void View::DrawRotateViewOverlay()
|
|||
w = mWidth;
|
||||
h = mHeight;
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, w, 0, h, -1, 1));
|
||||
|
@ -1422,7 +1420,7 @@ void View::DrawGrid()
|
|||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_TEXTURE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridStudColor));
|
||||
|
||||
mContext->SetVertexFormat(0, 3, 0, 2, 0);
|
||||
|
@ -1437,7 +1435,7 @@ void View::DrawGrid()
|
|||
if (Preferences.mDrawGridLines)
|
||||
{
|
||||
mContext->SetLineWidth(1.0f);
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetColor(lcVector4FromColor(Preferences.mGridLineColor));
|
||||
|
||||
int NumVerts = 2 * (MaxX - MinX + MaxY - MinY + 2);
|
||||
|
@ -1476,7 +1474,7 @@ void View::DrawAxes()
|
|||
lcMatrix44 WorldViewMatrix = mCamera->mWorldView;
|
||||
WorldViewMatrix.SetTranslation(lcVector3(0, 0, 0));
|
||||
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||
mContext->SetViewMatrix(lcMul(WorldViewMatrix, TranslationMatrix));
|
||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0, mWidth, 0, mHeight, -50, 50));
|
||||
|
@ -1495,7 +1493,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_TEXTURE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
mContext->SetViewMatrix(TranslationMatrix);
|
||||
mContext->SetTextureMode(LC_TEXTURE_MODULATE);
|
||||
gTexFont.MakeCurrent();
|
||||
|
@ -1535,7 +1533,7 @@ void View::DrawViewport()
|
|||
|
||||
if (gMainWindow->GetActiveView() == this)
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_SIMPLE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_COLOR);
|
||||
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 };
|
||||
|
||||
|
@ -1550,7 +1548,7 @@ void View::DrawViewport()
|
|||
|
||||
if (CameraName[0])
|
||||
{
|
||||
mContext->SetMaterial(LC_MATERIAL_TEXTURE);
|
||||
mContext->SetMaterial(LC_MATERIAL_UNLIT_TEXTURE_MODULATE);
|
||||
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
|
Loading…
Add table
Reference in a new issue