[GameEngine] Commit all Kester's changes made to the gameengine to restore 2.25 like physics.

[SCons] Build with Solid as default when enabling the gameengine in the build process
[SCons] Build solid and qhull from the extern directory and link statically against them

That was about it.

There are a few things that needs double checking:

* Makefiles
* Projectfiles
* All the other systems than Linux and Windows on which the build (with scons) has been successfully tested.
This commit is contained in:
Nathan Letwory
2004-03-22 22:02:18 +00:00
parent 5b90aafbd6
commit 00291b5cf4
133 changed files with 9550 additions and 1534 deletions

View File

@@ -1,69 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "RAS_CheckVertexArrays.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef WIN32
#include <windows.h>
#endif // WIN32
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "STR_String.h"
bool RAS_SystemSupportsVertexArrays() {
bool result = false;
char* ext = (char*) glGetString(GL_EXTENSIONS);
STR_String extensions;
if (ext)
extensions = STR_String(ext);
#ifdef WIN32
if (extensions.Find("GL_EXT_compiled_vertex_array") >= 0)
{
result=true;
}
#endif //WIN32
return result;
}

View File

@@ -1,38 +0,0 @@
/**
* $Id$
*
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifndef __RAS_CHECKVERTEXARRAYS
#define __RAS_CHECKVERTEXARRAYS
bool RAS_SystemSupportsVertexArrays();
#endif //__RAS_CHECKVERTEXARRAYS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,33 @@
/**
* $Id$
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#include "RAS_OpenGLRasterizer.h"
#ifdef HAVE_CONFIG_H
@@ -23,8 +53,8 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas)
:RAS_IRasterizer(canvas),
m_2DCanvas(canvas),
m_fogenabled(false),
m_materialCachingInfo(0),
m_noOfScanlines(32)
m_noOfScanlines(32),
m_materialCachingInfo(0)
{
m_viewmatrix.Identity();
m_stereomode = RAS_STEREO_NOSTEREO;
@@ -314,11 +344,14 @@ void RAS_OpenGLRasterizer::SetDepthMask(int depthmask)
case KX_DEPTHMASK_ENABLED:
{
glDepthMask(GL_TRUE);
//glDisable ( GL_ALPHA_TEST );
break;
};
case KX_DEPTHMASK_DISABLED:
{
glDepthMask(GL_FALSE);
//glAlphaFunc ( GL_GREATER, 0.0 ) ;
//glEnable ( GL_ALPHA_TEST ) ;
break;
};
default:
@@ -441,7 +474,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
const MT_Vector4& rgbacolor
)
{
static const GLsizei vtxstride = sizeof(RAS_TexVert);
GLenum drawmode;
switch (mode)
{
@@ -460,7 +492,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
}
const RAS_TexVert* vertexarray ;
int numindices,vt;
unsigned int numindices,vt;
for (vt=0;vt<vertexarrays.size();vt++)
{
@@ -468,8 +500,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
const KX_IndexArray & indexarray = (*indexarrays[vt]);
numindices = indexarray.size();
int numverts = vertexarrays[vt]->size();
if (!numindices)
break;
@@ -480,7 +510,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
{
glBegin(GL_LINES);
vindex=0;
for (int i=0;i<numindices;i+=2)
for (unsigned int i=0;i<numindices;i+=2)
{
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
@@ -494,7 +524,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
vindex=0;
if (useObjectColor)
{
for (int i=0;i<numindices;i+=4)
for (unsigned int i=0;i<numindices;i+=4)
{
glColor4d(rgbacolor[0], rgbacolor[1], rgbacolor[2], rgbacolor[3]);
@@ -509,7 +539,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
@@ -522,35 +552,31 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
}
else
{
for (int i=0;i<numindices;i+=4)
for (unsigned int i=0;i<numindices;i+=4)
{
char *cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
// This looks curiously endian unsafe to me.
// However it depends on the way the colors are packed into
// the m_rgba field of RAS_TexVert
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
@@ -566,7 +592,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
vindex=0;
if (useObjectColor)
{
for (int i=0;i<numindices;i+=3)
for (unsigned int i=0;i<numindices;i+=3)
{
glColor4d(rgbacolor[0], rgbacolor[1], rgbacolor[2], rgbacolor[3]);
@@ -589,25 +615,22 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
}
else
{
for (int i=0;i<numindices;i+=3)
for (unsigned int i=0;i<numindices;i+=3)
{
char *cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
@@ -636,7 +659,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
)
{
bool recalc;
static const GLsizei vtxstride = sizeof(RAS_TexVert);
GLenum drawmode;
switch (mode)
{
@@ -655,7 +677,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
}
const RAS_TexVert* vertexarray ;
int numindices,vt;
unsigned int numindices,vt;
for (vt=0;vt<vertexarrays.size();vt++)
{
@@ -663,8 +685,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
const KX_IndexArray & indexarray = (*indexarrays[vt]);
numindices = indexarray.size();
int numverts = vertexarrays[vt]->size();
if (!numindices)
break;
@@ -675,7 +695,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
{
glBegin(GL_LINES);
vindex=0;
for (int i=0;i<numindices;i+=2)
for (unsigned int i=0;i<numindices;i+=2)
{
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
@@ -689,7 +709,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
vindex=0;
if (useObjectColor)
{
for (int i=0;i<numindices;i+=4)
for (unsigned int i=0;i<numindices;i+=4)
{
MT_Point3 mv1, mv2, mv3, mv4, fnor;
/* Calc a new face normal */
@@ -739,9 +759,8 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
}
else
{
for (int i=0;i<numindices;i+=4)
for (unsigned int i=0;i<numindices;i+=4)
{
char *cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
// This looks curiously endian unsafe to me.
// However it depends on the way the colors are packed into
// the m_rgba field of RAS_TexVert
@@ -765,31 +784,28 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
glNormal3f(fnor[0], fnor[1], fnor[2]);
}
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
@@ -806,7 +822,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
vindex=0;
if (useObjectColor)
{
for (int i=0;i<numindices;i+=3)
for (unsigned int i=0;i<numindices;i+=3)
{
MT_Point3 mv1, mv2, mv3, fnor;
/* Calc a new face normal */
@@ -848,7 +864,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
}
else
{
for (int i=0;i<numindices;i+=3)
for (unsigned int i=0;i<numindices;i+=3)
{
MT_Point3 mv1, mv2, mv3, fnor;
/* Calc a new face normal */
@@ -868,24 +884,21 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
glNormal3f(fnor[0], fnor[1], fnor[2]);
}
char *cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
glColor4ub(cp[0], cp[1], cp[2], cp[3]);
glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3sv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
@@ -916,8 +929,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
const MT_Vector4& rgbacolor
)
{
unsigned char* mypointer=NULL;
static const GLsizei vtxstride = sizeof(RAS_TexVert);
GLenum drawmode;
switch (mode)
{
@@ -937,8 +948,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
const RAS_TexVert* vertexarray ;
int numindices ;
int vt;
unsigned int numindices, vt;
if (useObjectColor)
{
@@ -956,8 +966,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
const KX_IndexArray & indexarray = (*indexarrays[vt]);
numindices = indexarray.size();
int numverts = vertexarrays[vt]->size();
if (!numindices)
break;
@@ -968,7 +976,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
{
glBegin(GL_LINES);
vindex=0;
for (int i=0;i<numindices;i+=2)
for (unsigned int i=0;i<numindices;i+=2)
{
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
glVertex3fv(vertexarray[(indexarray[vindex++])].getLocalXYZ());
@@ -979,7 +987,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
case 2:
{
vindex=0;
for (int i=0;i<numindices;i+=4)
for (unsigned int i=0;i<numindices;i+=4)
{
float v1[3],v2[3],v3[3],v4[3];
@@ -1017,7 +1025,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
{
glBegin(GL_TRIANGLES);
vindex=0;
for (int i=0;i<numindices;i+=3)
for (unsigned int i=0;i<numindices;i+=3)
{
float v1[3],v2[3],v3[3];
@@ -1199,7 +1207,13 @@ void RAS_OpenGLRasterizer::SetCullFace(bool enable)
glDisable(GL_CULL_FACE);
}
void RAS_OpenGLRasterizer::SetLines(bool enable)
{
if (enable)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
void RAS_OpenGLRasterizer::SetSpecularity(float specX,
float specY,

View File

@@ -95,7 +95,7 @@ public:
KX_WIREFRAME,
KX_SOLID,
KX_SHADED,
KX_TEXTURED
KX_TEXTURED
};
enum
@@ -195,6 +195,7 @@ public:
virtual void EnableTextures(bool enable);
virtual void SetCullFace(bool enable);
virtual void SetLines(bool enable);
virtual MT_Matrix4x4 GetFrustumMatrix(
float left,

View File

@@ -1,33 +1,61 @@
/**
* $Id$
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. The Blender
* Foundation also sells licenses for use in proprietary software under
* the Blender License. See http://www.blender.org/BL/ for information
* about this.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef WIN32
#include "RAS_VAOpenGLRasterizer.h"
#ifdef WIN32
#include <windows.h>
#include "GL/gl.h"
typedef void (APIENTRY *GLLOCKARRAYSEXTPTR)(GLint first,GLsizei count);
typedef void (APIENTRY *GLUNLOCKARRAYSEXTPTR)(void);
void APIENTRY RAS_lockfunc(GLint first,GLsizei count) {};
void APIENTRY RAS_unlockfunc() {};
GLLOCKARRAYSEXTPTR glLockArraysEXT=RAS_lockfunc;
GLUNLOCKARRAYSEXTPTR glUnlockArraysEXT=RAS_unlockfunc;
#endif // WIN32
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#include "STR_String.h"
#include "RAS_TexVert.h"
#include "MT_CmMatrix4x4.h"
#include "RAS_IRenderTools.h" // rendering text
#include "RAS_GLExtensionManager.h"
using namespace RAS_GL;
RAS_VAOpenGLRasterizer::RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas)
:RAS_OpenGLRasterizer(canvas)
{
int i = 0;
}
@@ -38,7 +66,7 @@ RAS_VAOpenGLRasterizer::~RAS_VAOpenGLRasterizer()
bool RAS_VAOpenGLRasterizer::Init()
bool RAS_VAOpenGLRasterizer::Init(void)
{
bool result = RAS_OpenGLRasterizer::Init();
@@ -48,15 +76,7 @@ bool RAS_VAOpenGLRasterizer::Init()
// if possible, add extensions to other platforms too, if this
// rasterizer becomes messy just derive one for each platform
// (ie. KX_Win32Rasterizer, KX_LinuxRasterizer etc.)
glUnlockArraysEXT = reinterpret_cast<GLUNLOCKARRAYSEXTPTR>(wglGetProcAddress("glUnlockArraysEXT"));
if (!glUnlockArraysEXT)
result = false;
glLockArraysEXT = reinterpret_cast<GLLOCKARRAYSEXTPTR>(wglGetProcAddress("glLockArraysEXT"));
if (!glLockArraysEXT)
result=false;
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
@@ -149,7 +169,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
}
}
const RAS_TexVert* vertexarray;
int numindices,vt;
unsigned int numindices, vt;
if (drawmode != GL_LINES)
{
if (useObjectColor)
@@ -177,14 +197,10 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
if (!numindices)
break;
mypointer = (unsigned char*)(vertexarray);
glVertexPointer(3,GL_FLOAT,vtxstride,mypointer);
mypointer+= 3*sizeof(float);
glTexCoordPointer(2,GL_FLOAT,vtxstride,mypointer);
mypointer+= 2*sizeof(float);
glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,mypointer);
mypointer += sizeof(int);
glNormalPointer(GL_SHORT,vtxstride,mypointer);
glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ());
glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1());
glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,&vertexarray->getRGBA());
glNormalPointer(GL_SHORT,vtxstride,vertexarray->getNormal());
glLockArraysEXT(0,numverts);
// here the actual drawing takes places
glDrawElements(drawmode,numindices,GL_UNSIGNED_INT,&(indexarray[0]));
@@ -212,5 +228,3 @@ bool RAS_VAOpenGLRasterizer::Stereo()
return false;
}
#endif //WIN32

View File

@@ -3,7 +3,7 @@ Import ('library_env')
ras_openglrasterizer_env = library_env.Copy ()
source_files = ['RAS_CheckVertexArrays.cpp',
source_files = ['RAS_GLExtensionManager.cpp',
'RAS_OpenGLRasterizer.cpp',
'RAS_VAOpenGLRasterizer.cpp']

View File

@@ -0,0 +1,538 @@
#!/usr/bin/python
#
# $Id$
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. The Blender
# Foundation also sells licenses for use in proprietary software under
# the Blender License. See http://www.blender.org/BL/ for information
# about this.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL/BL DUAL LICENSE BLOCK *****
#
# mkglext.py generates code for linking extensions.
#
# It reads the glext.h header from stdin and writes code to stdout.
#
# Usage: mkglext.py < glext.h > tmp
# Code can be copied & pasted from tmp to GL_ExtensionManager.cpp.
#
# glext.h is available here: http://oss.sgi.com/projects/ogl-sample/ABI/glext.h
#
from sys import stdin
import string, re
glext_h = string.split(stdin.read(), '\n')
# These extensions have been incorporated into the core GL or been superceded.
# Code will not be generated for these extensions
blacklist = [
"GL_EXT_multisample",
"GL_INGR_blend_func_separate",
"GL_SGIX_fragment_lighting",
"GL_SGIX_polynomial_ffd",
"GL_SGIS_point_parameters",
"GL_EXT_texture_object",
"GL_EXT_subtexture",
"GL_EXT_copy_texture",
"GL_EXT_vertex_array",
"GL_EXT_point_parameters",
"GL_EXT_blend_color",
"GL_EXT_polygon_offset",
"GL_EXT_texture"]
# Only code for these extensions will be generated. Extensions on both the
# blacklist & whitelist will not have code generated.
# This list is from http://oss.sgi.com/projects/ogl-sample/registry/ at 14-Mar-04
whitelist = [
# ARB Extensions
"GL_ARB_multitexture",
"GLX_ARB_get_proc_address",
"GL_ARB_transpose_matrix",
"WGL_ARB_buffer_region",
"GL_ARB_multisample",
"GL_ARB_texture_env_add",
"GL_ARB_texture_cube_map",
"WGL_ARB_extensions_string",
"WGL_ARB_pixel_format",
"WGL_ARB_make_current_read",
"WGL_ARB_pbuffer",
"GL_ARB_texture_compression",
"GL_ARB_texture_border_clamp",
"GL_ARB_point_parameters",
"GL_ARB_vertex_blend",
"GL_ARB_matrix_palette",
"GL_ARB_texture_env_combine",
"GL_ARB_texture_env_crossbar",
"GL_ARB_texture_env_dot3",
"WGL_ARB_render_texture",
"GL_ARB_texture_mirrored_repeat",
"GL_ARB_depth_texture",
"GL_ARB_shadow",
"GL_ARB_shadow_ambient",
"GL_ARB_window_pos",
"GL_ARB_vertex_program",
"GL_ARB_fragment_program",
"GL_ARB_vertex_buffer_object",
"GL_ARB_occlusion_query",
"GL_ARB_shader_objects",
"GL_ARB_vertex_shader",
"GL_ARB_fragment_shader",
"GL_ARB_shading_language_100",
"GL_ARB_texture_non_power_of_two",
"GL_ARB_point_sprite",
"GL_ARB_fragment_program_shadow",
# Non ARB Extensions
"GL_EXT_abgr",
"GL_EXT_blend_color",
"GL_EXT_polygon_offset",
"GL_EXT_texture",
"GL_EXT_texture3D",
"GL_SGIS_texture_filter4",
"GL_EXT_subtexture",
"GL_EXT_copy_texture",
"GL_EXT_histogram",
"GL_EXT_convolution",
"GL_SGI_color_matrix",
"GL_SGI_color_table",
"GL_SGIS_pixel_texture",
"GL_SGIS_texture4D",
"GL_SGI_texture_color_table",
"GL_EXT_cmyka",
"GL_EXT_texture_object",
"GL_SGIS_detail_texture",
"GL_SGIS_sharpen_texture",
"GL_EXT_packed_pixels",
"GL_SGIS_texture_lod",
"GL_SGIS_multisample",
"GL_EXT_rescale_normal",
"GLX_EXT_visual_info",
"GL_EXT_vertex_array",
"GL_EXT_misc_attribute",
"GL_SGIS_generate_mipmap",
"GL_SGIX_clipmap",
"GL_SGIX_shadow",
"GL_SGIS_texture_edge_clamp",
"GL_SGIS_texture_border_clamp",
"GL_EXT_blend_minmax",
"GL_EXT_blend_subtract",
"GL_EXT_blend_logic_op",
"GLX_SGI_swap_control",
"GLX_SGI_video_sync",
"GLX_SGI_make_current_read",
"GLX_SGIX_video_source",
"GLX_EXT_visual_rating",
"GL_SGIX_interlace",
"GLX_EXT_import_context",
"GLX_SGIX_fbconfig",
"GLX_SGIX_pbuffer",
"GL_SGIS_texture_select",
"GL_SGIX_sprite",
"GL_SGIX_texture_multi_buffer",
"GL_EXT_point_parameters",
"GL_SGIX_instruments",
"GL_SGIX_texture_scale_bias",
"GL_SGIX_framezoom",
"GL_SGIX_tag_sample_buffer",
"GL_SGIX_reference_plane",
"GL_SGIX_flush_raster",
"GLX_SGI_cushion",
"GL_SGIX_depth_texture",
"GL_SGIS_fog_function",
"GL_SGIX_fog_offset",
"GL_HP_image_transform",
"GL_HP_convolution_border_modes",
"GL_SGIX_texture_add_env",
"GL_EXT_color_subtable",
"GLU_EXT_object_space_tess",
"GL_PGI_vertex_hints",
"GL_PGI_misc_hints",
"GL_EXT_paletted_texture",
"GL_EXT_clip_volume_hint",
"GL_SGIX_list_priority",
"GL_SGIX_ir_instrument1",
"GLX_SGIX_video_resize",
"GL_SGIX_texture_lod_bias",
"GLU_SGI_filter4_parameters",
"GLX_SGIX_dm_buffer",
"GL_SGIX_shadow_ambient",
"GLX_SGIX_swap_group",
"GLX_SGIX_swap_barrier",
"GL_EXT_index_texture",
"GL_EXT_index_material",
"GL_EXT_index_func",
"GL_EXT_index_array_formats",
"GL_EXT_compiled_vertex_array",
"GL_EXT_cull_vertex",
"GLU_EXT_nurbs_tessellator",
"GL_SGIX_ycrcb",
"GL_EXT_fragment_lighting",
"GL_IBM_rasterpos_clip",
"GL_HP_texture_lighting",
"GL_EXT_draw_range_elements",
"GL_WIN_phong_shading",
"GL_WIN_specular_fog",
"GLX_SGIS_color_range",
"GL_EXT_light_texture",
"GL_SGIX_blend_alpha_minmax",
"GL_EXT_scene_marker",
"GL_SGIX_pixel_texture_bits",
"GL_EXT_bgra",
"GL_SGIX_async",
"GL_SGIX_async_pixel",
"GL_SGIX_async_histogram",
"GL_INTEL_texture_scissor",
"GL_INTEL_parallel_arrays",
"GL_HP_occlusion_test",
"GL_EXT_pixel_transform",
"GL_EXT_pixel_transform_color_table",
"GL_EXT_shared_texture_palette",
"GLX_SGIS_blended_overlay",
"GL_EXT_separate_specular_color",
"GL_EXT_secondary_color",
"GL_EXT_texture_env",
"GL_EXT_texture_perturb_normal",
"GL_EXT_multi_draw_arrays",
"GL_EXT_fog_coord",
"GL_REND_screen_coordinates",
"GL_EXT_coordinate_frame",
"GL_EXT_texture_env_combine",
"GL_APPLE_specular_vector",
"GL_SGIX_pixel_texture",
"GL_APPLE_transform_hint",
"GL_SUNX_constant_data",
"GL_SUN_global_alpha",
"GL_SUN_triangle_list",
"GL_SUN_vertex",
"WGL_EXT_display_color_table",
"WGL_EXT_extensions_string",
"WGL_EXT_make_current_read",
"WGL_EXT_pixel_format",
"WGL_EXT_pbuffer",
"WGL_EXT_swap_control",
"GL_EXT_blend_func_separate",
"GL_INGR_color_clamp",
"GL_INGR_interlace_read",
"GL_EXT_stencil_wrap",
"WGL_EXT_depth_float",
"GL_EXT_422_pixels",
"GL_NV_texgen_reflection",
"GL_SGIX_texture_range",
"GL_SUN_convolution_border_modes",
"GLX_SUN_get_transparent_index",
"GL_EXT_texture_env_add",
"GL_EXT_texture_lod_bias",
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_vertex_weighting",
"GL_NV_light_max_exponent",
"GL_NV_vertex_array_range",
"GL_NV_register_combiners",
"GL_NV_fog_distance",
"GL_NV_texgen_emboss",
"GL_NV_blend_square",
"GL_NV_texture_env_combine4",
"GL_MESA_resize_buffers",
"GL_MESA_window_pos",
"GL_EXT_texture_compression_s3tc",
"GL_IBM_cull_vertex",
"GL_IBM_multimode_draw_arrays",
"GL_IBM_vertex_array_lists",
"GL_3DFX_texture_compression_FXT1",
"GL_3DFX_multisample",
"GL_3DFX_tbuffer",
"WGL_EXT_multisample",
"GL_SGIX_vertex_preclip",
"GL_SGIX_resample",
"GL_SGIS_texture_color_mask",
"GLX_MESA_copy_sub_buffer",
"GLX_MESA_pixmap_colormap",
"GLX_MESA_release_buffers",
"GLX_MESA_set_3dfx_mode",
"GL_EXT_texture_env_dot3",
"GL_ATI_texture_mirror_once",
"GL_NV_fence",
"GL_IBM_static_data",
"GL_IBM_texture_mirrored_repeat",
"GL_NV_evaluators",
"GL_NV_packed_depth_stencil",
"GL_NV_register_combiners2",
"GL_NV_texture_compression_vtc",
"GL_NV_texture_rectangle",
"GL_NV_texture_shader",
"GL_NV_texture_shader2",
"GL_NV_vertex_array_range2",
"GL_NV_vertex_program",
"GLX_SGIX_visual_select_group",
"GL_SGIX_texture_coordinate_clamp",
"GLX_OML_swap_method",
"GLX_OML_sync_control",
"GL_OML_interlace",
"GL_OML_subsample",
"GL_OML_resample",
"WGL_OML_sync_control",
"GL_NV_copy_depth_to_color",
"GL_ATI_envmap_bumpmap",
"GL_ATI_fragment_shader",
"GL_ATI_pn_triangles",
"GL_ATI_vertex_array_object",
"GL_EXT_vertex_shader",
"GL_ATI_vertex_streams",
"WGL_I3D_digital_video_control",
"WGL_I3D_gamma",
"WGL_I3D_genlock",
"WGL_I3D_image_buffer",
"WGL_I3D_swap_frame_lock",
"WGL_I3D_swap_frame_usage",
"GL_ATI_element_array",
"GL_SUN_mesh_array",
"GL_SUN_slice_accum",
"GL_NV_multisample_filter_hint",
"GL_NV_depth_clamp",
"GL_NV_occlusion_query",
"GL_NV_point_sprite",
"WGL_NV_render_depth_texture",
"WGL_NV_render_texture_rectangle",
"GL_NV_texture_shader3",
"GL_NV_vertex_program1_1",
"GL_EXT_shadow_funcs",
"GL_EXT_stencil_two_side",
"GL_ATI_text_fragment_shader",
"GL_APPLE_client_storage",
"GL_APPLE_element_array",
"GL_APPLE_fence",
"GL_APPLE_vertex_array_object",
"GL_APPLE_vertex_array_range",
"GL_APPLE_ycbcr_422",
"GL_S3_s3tc",
"GL_ATI_draw_buffers",
"WGL_ATI_pixel_format_float",
"GL_ATI_texture_env_combine3",
"GL_ATI_texture_float",
"GL_NV_float_buffer",
"GL_NV_fragment_program",
"GL_NV_half_float",
"GL_NV_pixel_data_range",
"GL_NV_primitive_restart",
"GL_NV_texture_expand_normal",
"GL_NV_vertex_program2",
"GL_ATI_map_object_buffer",
"GL_ATI_separate_stencil",
"GL_ATI_vertex_attrib_array_object",
"GL_OES_byte_coordinates",
"GL_OES_fixed_point",
"GL_OES_single_precision",
"GL_OES_compressed_paletted_texture",
"GL_OES_read_format",
"GL_OES_query_matrix",
"GL_EXT_depth_bounds_test",
"GL_EXT_texture_mirror_clamp",
"GL_EXT_blend_equation_separate",
"GL_MESA_pack_invert",
"GL_MESA_ycbcr_texture"]
"""
Example code output:
#ifdef GL_EXT_compiled_vertex_array
if (QueryExtension("GL_EXT_compiled_vertex_array"))
{
glUnlockArraysEXT = reinterpret_cast<PFNGLUNLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glUnlockArraysEXT"));
glLockArraysEXT = reinterpret_cast<PFNGLLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glLockArraysEXT"));
if (glUnlockArraysEXT && glLockArraysEXT)
{
EnableExtension(_GL_EXT_compiled_vertex_array);
if (m_debug && doDebugMessages)
std::cout << "Enabled GL_EXT_compiled_vertex_array" << std::endl;
} else {
std::cout << "ERROR: GL_EXT_compiled_vertex_array implementation is broken!" << std::endl;
}
}
#endif
"""
def writeext(ext, fnlist):
if (find(blacklist, ext)):
return
if (len(fnlist) == 0):
print "\tif (QueryExtension(\"" + ext + "\"))"
print "\t{"
print "\t\tEnableExtension(_" + ext + ");"
print "\t\tif (m_debug && doDebugMessages)"
print "\t\t\tstd::cout << \"Enabled " + ext + "\" << std::endl;"
print "\t}"
print
return
print "#if defined(" + ext + ")"
print "\tif (QueryExtension(\"" + ext + "\"))"
print "\t{"
for fn in fnlist:
print "\t\t" + fn[0] + " = reinterpret_cast<" + fn[1] + ">(bglGetProcAddress((const GLubyte *) \"" + fn[0] + "\"));"
errcheck = ""
for fn in fnlist:
if (errcheck == ""):
errcheck = fn[0]
else:
errcheck = errcheck + " && " + fn[0]
print "\t\tif (" + errcheck + ") {"
print "\t\t\tEnableExtension(_" + ext + ");"
print "\t\t\tif (m_debug && doDebugMessages)"
print "\t\t\t\tstd::cout << \"Enabled " + ext + "\" << std::endl;"
print "\t\t} else {"
print "\t\t\tstd::cout << \"ERROR: " + ext + " implementation is broken!\" << std::endl;"
print "\t\t}"
print "\t}"
print "#endif"
print
"""
Example Output:
#if defined(GL_EXT_compiled_vertex_array)
PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
#endif
"""
def writeproto(ext, fnlist):
if (find(blacklist, ext) or not find(whitelist, ext)):
return
print "#if defined(" + ext + ")"
for fn in fnlist:
print fn[1] + " " + fn[0] + ";"
print "#endif"
print
"""
#ifdef GL_EXT_compiled_vertex_array
extern PFNGLLOCKARRAYSEXTPROC glLockArraysEXT;
extern PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT;
#endif
"""
def writeheader(ext, fnlisti):
if (find(blacklist, ext) or not find(whitelist, ext)):
return
print "#if defined(" + ext + ")"
for fn in fnlist:
print "extern " + fn[1] + " " + fn[0] + ";"
print "#endif"
print
def find(l, x):
for i in l:
if (i == x):
return 1
return 0
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeproto(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.*(gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeext(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.*(gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]
ext = ""
fns = []
fnlist = []
ifdef = 0
for i in glext_h:
line = re.search('^#ifn?def', i)
if (line):
ifdef = ifdef + 1
line = re.search('^#ifndef (GL_.*)', i)
if (line):
if (not re.search('GL_VERSION.*', line.group(1)) and find(whitelist, line.group(1))):
ext = line.group(1)
line = re.search('^#endif', i)
if (line):
ifdef = ifdef - 1
if (ifdef == 0 and ext != ""):
writeheader(ext, fnlist)
ext = ""
fns = []
fnlist = []
if (ext != ""):
line = re.search('.*(gl.*) \(.*\);', i)
if (line):
fns += [line.group(1)]
line = re.search('.*PFN(.*)PROC.*', i)
if (line):
for j in fns:
if (string.lower(line.group(1)) == string.lower(j)):
fnlist += [(j, "PFN" + line.group(1) + "PROC")]