- Projection matrix not being reset properly
- Texture states not being reset properly
- First frame with normal mapped not rendred properly due to first SetLight not preserving light direction
- Fixed direct matrix computation and related warning
- ecere.epj: Removed duplicate MinEmscripten entry caused by bad merge
"Options" : {
"ExcludeFromBuild" : false
}
"Options" : {
"ExcludeFromBuild" : false
}
- },
- {
- "Name" : "MinEmscripten",
- "Options" : {
- "ExcludeFromBuild" : false
- }
material.baseMap.MakeMipMaps(info->displaySystem);
if(material.bumpMap)
material.bumpMap.MakeMipMaps(info->displaySystem);
material.baseMap.MakeMipMaps(info->displaySystem);
if(material.bumpMap)
material.bumpMap.MakeMipMaps(info->displaySystem);
+ if(material.specularMap)
+ material.specularMap.MakeMipMaps(info->displaySystem);
+
// COPY_NITEM(mat, material);
CopyBytes(((byte *)(mat)) + sizeof(class NamedItem), ((byte *)(material)) + sizeof(class NamedItem), sizeof(class Material) - sizeof(class NamedItem));
}
// COPY_NITEM(mat, material);
CopyBytes(((byte *)(mat)) + sizeof(class NamedItem), ((byte *)(material)) + sizeof(class NamedItem), sizeof(class Material) - sizeof(class NamedItem));
}
// --- Lights ---
void SetLight(int id, Light light)
{
// --- Lights ---
void SetLight(int id, Light light)
{
+ if(!display3D)
+ {
+ display3D = Display3D { };
+ }
displaySystem.driver.SetLight(this, id, light);
}
displaySystem.driver.SetLight(this, id, light);
}
Matrix t, inv = camera.viewMatrix;
Vector3D ot { };
Vector3D cPos = camera.cPosition;
Matrix t, inv = camera.viewMatrix;
Vector3D ot { };
Vector3D cPos = camera.cPosition;
- Vector3D pos = camera.position;
bool positional = l[3] ? true : false;
inv.Scale(1.0/nearPlane, -1.0/nearPlane,-1.0/nearPlane);
bool positional = l[3] ? true : false;
inv.Scale(1.0/nearPlane, -1.0/nearPlane,-1.0/nearPlane);
bool depthWrite;
int x, y;
uint vao;
bool depthWrite;
int x, y;
uint vao;
#if defined(__WIN32__)
HDC hdc;
#if defined(__WIN32__)
HDC hdc;
-#if ENABLE_GL_FFP
-static int maxTMU = 0;
-
-static void disableRemainingTMUs(int lastTMU)
-{
- int t;
- for(t = lastTMU; t < maxTMU; t++)
- {
- glActiveTexture(GL_TEXTURE0 + t);
- glClientActiveTexture(GL_TEXTURE0 + t);
- glDisable(GL_TEXTURE_2D);
- glDisable(GL_TEXTURE_CUBE_MAP);
- GLDisableClientState(TEXCOORDS);
- }
- glActiveTexture(GL_TEXTURE0);
- glClientActiveTexture(GL_TEXTURE0);
- maxTMU = lastTMU;
-}
-#endif
-
class OpenGLDisplayDriver : DisplayDriver
{
class_property(name) = "OpenGL";
class OpenGLDisplayDriver : DisplayDriver
{
class_property(name) = "OpenGL";
+#if ENABLE_GL_FFP
+ void ::disableRemainingTMUs(Display display, int lastTMU)
+ {
+ OGLDisplay oglDisplay = display.driverData;
+ int t;
+ for(t = lastTMU; t < oglDisplay.maxTMU; t++)
+ {
+ glActiveTexture(GL_TEXTURE0 + t);
+ glClientActiveTexture(GL_TEXTURE0 + t);
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_TEXTURE_CUBE_MAP);
+ GLDisableClientState(TEXCOORDS);
+ }
+ glActiveTexture(GL_TEXTURE0);
+ glClientActiveTexture(GL_TEXTURE0);
+ oglDisplay.maxTMU = lastTMU;
+ }
+#endif
#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
void SetRenderState(Display display, RenderState state, uint value)
#if !defined(ECERE_NO3D) && !defined(ECERE_VANILLA)
void SetRenderState(Display display, RenderState state, uint value)
#endif
// *** Restore 2D MODELVIEW Matrix ***
#endif
// *** Restore 2D MODELVIEW Matrix ***
+ GLMatrixMode(MatrixMode::modelView);
+ GLPopMatrix();
+
+ // *** Restore 2D TEXTURE Matrix ***
+ GLMatrixMode(MatrixMode::texture);
GLPopMatrix();
// *** Restore 2D PROJECTION Matrix ***
GLMatrixMode(MatrixMode::projection);
GLPopMatrix();
GLPopMatrix();
// *** Restore 2D PROJECTION Matrix ***
GLMatrixMode(MatrixMode::projection);
GLPopMatrix();
- // *** Restore 2D TEXTURE Matrix ***
- GLMatrixMode(MatrixMode::texture);
- GLPopMatrix();
+ // NOTE: We expect the 2D projection matrix to be the active one for GetSurface to call glOrtho()
#if ENABLE_GL_SHADERS
if(glCaps_shaders)
#if ENABLE_GL_SHADERS
if(glCaps_shaders)
#if ENABLE_GL_FFP
if(!glCaps_shaders)
{
#if ENABLE_GL_FFP
if(!glCaps_shaders)
{
- disableRemainingTMUs(1);
+ disableRemainingTMUs(display, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_TEXTURE_CUBE_MAP);
#if _GLES
glDisable(GL_TEXTURE_GEN_STR);
glDisable(GL_TEXTURE_CUBE_MAP);
#if _GLES
glDisable(GL_TEXTURE_GEN_STR);
GLMatrixMode(MatrixMode::texture);
{
GLMatrixMode(MatrixMode::texture);
{
- double * s = display.display3D.camera.inverseTranspose.array;
- Quaternion q = display.display3D.camera.cOrientation;
- Matrix mat;
- Euler e = q;
- //e.yaw *= -1;
- q = e;
- mat.RotationQuaternion(q);
- mat.Scale(2,-2,-2);
- s = mat.array;
-
+ double * s = display.display3D.camera.viewMatrix.array;
+ double k = 2.0;
- s[0],s[1],s[2],0,
- s[4],s[5],s[6],0,
- s[8],s[9],s[10],0,
+ k*s[0],-k*s[4],-k*s[8], 0,
+ k*s[1],-k*s[5],-k*s[9], 0,
+ k*s[2],-k*s[6],-k*s[10],0,
0,0,0,1
} };
GLLoadMatrixd(m.array);
0,0,0,1
} };
GLLoadMatrixd(m.array);
#if ENABLE_GL_FFP
if(!glCaps_shaders)
{
#if ENABLE_GL_FFP
if(!glCaps_shaders)
{
- disableRemainingTMUs(tmu);
+ disableRemainingTMUs(display, tmu);