Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c16
-rw-r--r--source/blender/src/drawarmature.c3
-rw-r--r--source/blender/src/drawobject.c25
-rw-r--r--source/blender/src/editdeform.c2
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp5
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h55
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp18
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h10
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp25
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h8
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp87
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h10
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp73
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h8
15 files changed, 137 insertions, 210 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 59d603227b7..0a05047ac85 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -65,19 +65,8 @@
- arb draw buffers? 2.0 core
*/
-/* TODO: we also use GL_ARB_texture_border_clamp or GL_SGIS_texture_border_clamp,
- but seems to be widely supported on anything running fragment programs */
-
-/* TODO: GeforceFX float support, the issue is:
- ARB/ATI_texture_float is not supported on nv30 (GeforceFX)
- NV_float_buffer is, but only works with GL_TEXTURE_RECTANGLE
- but ATI doesn't support sampler2DRect in glsl! */
-
-#define MAX_ATTACHMENTS 16
-
struct GPUGlobal {
GLint maxtextures;
- GLint maxfbcolor;
GLuint currentfb;
GLenum halfformat;
struct GPUGlobalLimits {
@@ -101,11 +90,6 @@ void GPU_extensions_init()
if (GLEW_ARB_multitexture)
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &GG.maxtextures);
- if (GLEW_EXT_framebuffer_object) {
- glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &GG.maxfbcolor);
- if (GG.maxfbcolor > MAX_ATTACHMENTS)
- GG.maxfbcolor = MAX_ATTACHMENTS;
- }
if (GLEW_ATI_texture_float || GLEW_ARB_texture_float) {
GG.halfformat = (GLEW_ATI_texture_float)? GL_RGBA_FLOAT16_ATI: GL_RGBA16F_ARB;
}
diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c
index 6d78b21dfbb..79c89477d4e 100644
--- a/source/blender/src/drawarmature.c
+++ b/source/blender/src/drawarmature.c
@@ -2505,6 +2505,9 @@ int draw_armature(Base *base, int dt, int flag)
Object *ob= base->object;
bArmature *arm= ob->data;
int retval= 0;
+
+ if(G.f & G_SIMULATION)
+ return;
if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
/* we use color for solid lighting */
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index 78b2fa470d4..61b1e32a876 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -419,6 +419,9 @@ void drawaxes(float size, int flag, char drawtype)
float v1[3]= {0.0, 0.0, 0.0};
float v2[3]= {0.0, 0.0, 0.0};
float v3[3]= {0.0, 0.0, 0.0};
+
+ if(G.f & G_SIMULATION)
+ return;
switch(drawtype) {
@@ -801,6 +804,9 @@ static void drawlamp(Object *ob)
float pixsize, lampsize;
float imat[4][4], curcol[4];
char col[4];
+
+ if(G.f & G_SIMULATION)
+ return;
la= ob->data;
@@ -1091,6 +1097,9 @@ static void drawcamera(Object *ob, int flag)
float vec[8][4], tmat[4][4], fac, facx, facy, depth;
int i;
+ if(G.f & G_SIMULATION)
+ return;
+
cam= ob->data;
glDisable(GL_LIGHTING);
@@ -1894,6 +1903,9 @@ static void draw_verse_debug(Object *ob, EditMesh *em)
struct EditFace *efa=NULL;
float v1[3], v2[3], v3[3], v4[3], fvec[3], col[3];
char val[32];
+
+ if(G.f & G_SIMULATION)
+ return;
if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
glDisable(GL_DEPTH_TEST);
@@ -1958,6 +1970,9 @@ static void draw_em_measure_stats(Object *ob, EditMesh *em)
char conv_float[5]; /* Use a float conversion matching the grid size */
float area, col[3]; /* area of the face, color of the text to draw */
+ if(G.f & G_SIMULATION)
+ return;
+
/* make the precission of the pronted value proportionate to the gridsize */
if ((G.vd->grid) < 0.01)
strcpy(conv_float, "%.6f");
@@ -2459,6 +2474,8 @@ static void draw_mesh_fancy(Base *base, int dt, int flag)
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
+
+ set_gl_material(-1);
}
else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) {
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
@@ -4735,9 +4752,8 @@ static void drawSolidSelect(Base *base)
drawDispListwire(&ob->disp);
}
else if(ob->type==OB_ARMATURE) {
- if(!(ob->flag & OB_POSEMODE)) {
+ if(!(ob->flag & OB_POSEMODE))
draw_armature(base, OB_WIRE, 0);
- }
}
glLineWidth(1.0);
@@ -5252,9 +5268,8 @@ void draw_object(Base *base, int flag)
}
/* draw extra: after normal draw because of makeDispList */
- if(dtx) {
- if(G.f & G_SIMULATION);
- else if(dtx & OB_AXIS) {
+ if(dtx && !(G.f & G_SIMULATION)) {
+ if(dtx & OB_AXIS) {
drawaxes(1.0f, flag, OB_ARROWS);
}
if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c
index 5de4c6ed23c..3f178e1ea2b 100644
--- a/source/blender/src/editdeform.c
+++ b/source/blender/src/editdeform.c
@@ -270,7 +270,7 @@ static void del_defgroup_update_users(Object *ob, int id)
int a;
/* these cases don't use names to refer to vertex groups, so when
- * they get deleted the numbers get out of synce, this corrects that */
+ * they get deleted the numbers get out of sync, this corrects that */
if(ob->soft) {
if(ob->soft->vertgroup == id)
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 75d09fd6e2f..27a165383d3 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1656,7 +1656,7 @@ static KX_GameObject *gameobject_from_blenderobject(
// two options exists for deform: shape keys and armature
// only support relative shape key
bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE;
- bool bHasDvert = mesh->dvert != NULL;
+ bool bHasDvert = mesh->dvert != NULL && ob->defbase.first;
bool bHasArmature = (ob->parent && ob->parent->type == OB_ARMATURE && ob->partype==PARSKEL && bHasDvert);
if (bHasShapeKey) {
@@ -2073,7 +2073,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
if (blenderscene->camera) {
KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera);
- kxscene->SetActiveCamera(gamecamera);
+ if(gamecamera)
+ kxscene->SetActiveCamera(gamecamera);
}
// Set up armatures
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index 50df1a1e2ea..b4492ca03a9 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -109,7 +109,7 @@ void RAS_BucketManager::RenderAlphaBuckets(
// it is needed for compatibility.
rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED);
- int drawingmode;
+ RAS_IRasterizer::DrawMode drawingmode;
std::multiset< alphamesh, backtofront>::iterator msit = alphameshset.begin();
for (; msit != alphameshset.end(); ++msit)
{
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 81dcd6bd394..d4a9177a85d 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -33,12 +33,23 @@
#pragma warning (disable:4786)
#endif
+#include "STR_HashedString.h"
+
#include "MT_CmMatrix4x4.h"
#include "MT_Matrix4x4.h"
+#include "RAS_TexVert.h"
+
+#include <vector>
+using namespace std;
+
class RAS_ICanvas;
class RAS_IPolyMaterial;
-#include "RAS_MaterialBucket.h"
+
+typedef vector<unsigned short> KX_IndexArray;
+typedef vector<RAS_TexVert> KX_VertexArray;
+typedef vector< KX_VertexArray* > vecVertexArray;
+typedef vector< KX_IndexArray* > vecIndexArrays;
/**
* 3D rendering device context interface.
@@ -67,6 +78,16 @@ public:
};
/**
+ * Drawing modes
+ */
+
+ enum DrawMode {
+ KX_MODE_LINES = 1,
+ KX_MODE_TRIANGLES,
+ KX_MODE_QUADS
+ };
+
+ /**
* Valid SetDepthMask parameters
*/
enum DepthMask {
@@ -199,45 +220,37 @@ public:
* IndexPrimitives: Renders primitives.
* @param vertexarrays is an array of vertex arrays
* @param indexarrays is an array of index arrays
- * @param mode determines the type of primitive stored in the vertex/index arrays:
- * 0 triangles
- * 1 lines (default)
- * 2 quads
- * @param polymat (reserved)
+ * @param mode determines the type of primitive stored in the vertex/index arrays
* @param useObjectColor will render the object using @param rgbacolor instead of
* vertex colors.
*/
- virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
+ virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)=0;
+ virtual void IndexPrimitivesMulti(
+ const vecVertexArray& vertexarrays,
+ const vecIndexArrays & indexarrays,
+ DrawMode mode,
+ bool useObjectColor,
+ const MT_Vector4& rgbacolor,
+ class KX_ListSlot** slot)=0;
+
/**
* IndexPrimitives_3DText will render text into the polygons.
* The text to be rendered is from @param rendertools client object's text property.
*/
virtual void IndexPrimitives_3DText( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
+ DrawMode mode,
class RAS_IPolyMaterial* polymat,
class RAS_IRenderTools* rendertools,
bool useObjectColor,
const MT_Vector4& rgbacolor)=0;
- virtual void IndexPrimitivesMulti(
- const vecVertexArray& vertexarrays,
- const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
- bool useObjectColor,
- const MT_Vector4& rgbacolor,
- class KX_ListSlot** slot)=0;
-
virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat)=0;
/* This one should become our final version, methinks. */
/**
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 705b3ea47d7..e295d69e48e 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -167,7 +167,7 @@ RAS_MaterialBucket::T_MeshSlotList::iterator RAS_MaterialBucket::msEnd()
}
bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools *rendertools, int &drawmode)
+ RAS_IRenderTools *rendertools, RAS_IRasterizer::DrawMode &drawmode)
{
rendertools->SetViewMat(cameratrans);
@@ -179,14 +179,18 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I
else
rendertools->ProcessLighting(-1);
- drawmode = (rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID ?
- 1: (m_material->UsesTriangles() ? 0 : 2));
+ if(rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID)
+ drawmode = RAS_IRasterizer::KX_MODE_LINES;
+ else if(m_material->UsesTriangles())
+ drawmode = RAS_IRasterizer::KX_MODE_TRIANGLES;
+ else
+ drawmode = RAS_IRasterizer::KX_MODE_QUADS;
return true;
}
void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools* rendertools, const KX_MeshSlot &ms, int drawmode)
+ RAS_IRenderTools* rendertools, const KX_MeshSlot &ms, RAS_IRasterizer::DrawMode drawmode)
{
if (!ms.m_bVisible)
return;
@@ -244,8 +248,6 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
ms.m_mesh->GetVertexCache(m_material),
ms.m_mesh->GetIndexCache(m_material),
drawmode,
- m_material,
- rendertools,
ms.m_bObjectColor,
ms.m_RGBAcolor,
displaylist);
@@ -258,8 +260,6 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
ms.m_mesh->GetVertexCache(m_material),
ms.m_mesh->GetIndexCache(m_material),
drawmode,
- m_material,
- rendertools, // needed for textprinting on polys
ms.m_bObjectColor,
ms.m_RGBAcolor,
displaylist);
@@ -284,7 +284,7 @@ void RAS_MaterialBucket::Render(const MT_Transform& cameratrans,
//rasty->SetMaterial(*m_material);
- int drawmode;
+ RAS_IRasterizer::DrawMode drawmode;
for (T_MeshSlotList::const_iterator it = m_meshSlots.begin();
! (it == m_meshSlots.end()); ++it)
{
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 5ad0c173a56..13d8a53714a 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -35,17 +35,13 @@
#include "MT_Transform.h"
#include "RAS_IPolygonMaterial.h"
+#include "RAS_IRasterizer.h"
#include "RAS_Deformer.h" // __NLA
#include <vector>
#include <map>
#include <set>
using namespace std;
-typedef vector<unsigned short> KX_IndexArray;
-typedef vector<RAS_TexVert> KX_VertexArray;
-typedef vector< KX_VertexArray* > vecVertexArray;
-typedef vector< KX_IndexArray* > vecIndexArrays;
-
/**
* KX_VertexIndex
*/
@@ -146,9 +142,9 @@ public:
const MT_Vector4& rgbavec);
void RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools* rendertools, const KX_MeshSlot &ms, int drawmode);
+ RAS_IRenderTools* rendertools, const KX_MeshSlot &ms, RAS_IRasterizer::DrawMode drawmode);
bool ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools *rendertools, int &drawmode);
+ RAS_IRenderTools *rendertools, RAS_IRasterizer::DrawMode& drawmode);
unsigned int NumMeshSlots();
T_MeshSlotList::iterator msBegin();
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 39080b80492..c2687319717 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -161,9 +161,7 @@ void RAS_ListRasterizer::ReleaseAlloc()
void RAS_ListRasterizer::IndexPrimitives(
const vecVertexArray & vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)
@@ -185,15 +183,13 @@ void RAS_ListRasterizer::IndexPrimitives(
if (mUseVertexArrays) {
RAS_VAOpenGLRasterizer::IndexPrimitives(
vertexarrays, indexarrays,
- mode, polymat,
- rendertools, useObjectColor,
+ mode, useObjectColor,
rgbacolor,slot
);
} else {
RAS_OpenGLRasterizer::IndexPrimitives(
vertexarrays, indexarrays,
- mode, polymat,
- rendertools, useObjectColor,
+ mode, useObjectColor,
rgbacolor,slot
);
}
@@ -208,9 +204,7 @@ void RAS_ListRasterizer::IndexPrimitives(
void RAS_ListRasterizer::IndexPrimitivesMulti(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)
@@ -230,18 +224,19 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(
}
}
- if (mUseVertexArrays) {
+ // workaround: note how we do not use vertex arrays for making display
+ // lists, since glVertexAttribPointerARB doesn't seem to work correct
+ // in display lists on ATI? either a bug in the driver or in Blender ..
+ if (mUseVertexArrays && !localSlot) {
RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(
vertexarrays, indexarrays,
- mode, polymat,
- rendertools, useObjectColor,
+ mode, useObjectColor,
rgbacolor,slot
);
} else {
RAS_OpenGLRasterizer::IndexPrimitivesMulti(
vertexarrays, indexarrays,
- mode, polymat,
- rendertools, useObjectColor,
+ mode, useObjectColor,
rgbacolor,slot
);
}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
index 4b3304d7396..b1b19144c12 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
@@ -52,9 +52,7 @@ public:
virtual void IndexPrimitives(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot
@@ -63,9 +61,7 @@ public:
virtual void IndexPrimitivesMulti(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index df77d8e0524..dcc36bf5a39 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -591,33 +591,14 @@ void RAS_OpenGLRasterizer::GetViewMatrix(MT_Matrix4x4 &mat) const
void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot
)
{
- GLenum drawmode;
- switch (mode)
- {
- case 0:
- drawmode = GL_TRIANGLES;
- break;
- case 1:
- drawmode = GL_LINES;
- break;
- case 2:
- drawmode = GL_QUADS;
- break;
- default:
- drawmode = GL_LINES;
- break;
- }
-
- const RAS_TexVert* vertexarray ;
- unsigned int numindices,vt;
+ const RAS_TexVert* vertexarray;
+ unsigned int numindices, vt;
for (vt=0;vt<vertexarrays.size();vt++)
{
@@ -631,7 +612,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
int vindex=0;
switch (mode)
{
- case 1:
+ case KX_MODE_LINES:
{
glBegin(GL_LINES);
vindex=0;
@@ -643,7 +624,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
glEnd();
}
break;
- case 2:
+ case KX_MODE_QUADS:
{
glBegin(GL_QUADS);
vindex=0;
@@ -711,7 +692,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
glEnd();
break;
}
- case 0:
+ case KX_MODE_TRIANGLES:
{
glBegin(GL_TRIANGLES);
vindex=0;
@@ -776,32 +757,14 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
+ DrawMode mode,
class RAS_IPolyMaterial* polymat,
class RAS_IRenderTools* rendertools,
bool useObjectColor,
const MT_Vector4& rgbacolor
)
{
- GLenum drawmode;
- switch (mode)
- {
- case 0:
- drawmode = GL_TRIANGLES;
- break;
- case 1:
- drawmode = GL_LINES;
- break;
- case 2:
- drawmode = GL_QUADS;
- break;
- default:
- drawmode = GL_LINES;
- break;
- }
-
- const RAS_TexVert* vertexarray ;
-
+ const RAS_TexVert* vertexarray;
unsigned int numindices, vt;
if (useObjectColor)
@@ -826,7 +789,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
int vindex=0;
switch (mode)
{
- case 1:
+ case KX_MODE_LINES:
{
glBegin(GL_LINES);
vindex=0;
@@ -838,7 +801,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
glEnd();
}
break;
- case 2:
+ case KX_MODE_QUADS:
{
vindex=0;
for (unsigned int i=0;i<numindices;i+=4)
@@ -871,7 +834,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
}
break;
}
- case 0:
+ case KX_MODE_TRIANGLES:
{
glBegin(GL_TRIANGLES);
vindex=0;
@@ -1028,32 +991,14 @@ void RAS_OpenGLRasterizer::Tangent( const RAS_TexVert& v1,
void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot
)
{
- GLenum drawmode;
- switch (mode)
- {
- case 0:
- drawmode = GL_TRIANGLES;
- break;
- case 1:
- drawmode = GL_LINES;
- break;
- case 2:
- drawmode = GL_QUADS;
- break;
- default:
- drawmode = GL_LINES;
- break;
- }
- const RAS_TexVert* vertexarray ;
+ const RAS_TexVert* vertexarray;
unsigned int numindices,vt;
for (vt=0;vt<vertexarrays.size();vt++)
@@ -1068,7 +1013,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
int vindex=0;
switch (mode)
{
- case 1:
+ case KX_MODE_LINES:
{
glBegin(GL_LINES);
vindex=0;
@@ -1080,7 +1025,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
glEnd();
}
break;
- case 2:
+ case KX_MODE_QUADS:
{
glBegin(GL_QUADS);
vindex=0;
@@ -1157,7 +1102,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
glEnd();
break;
}
- case 0:
+ case KX_MODE_TRIANGLES:
{
glBegin(GL_TRIANGLES);
vindex=0;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index 1f0709e081a..0d54552db05 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -148,9 +148,7 @@ public:
virtual void IndexPrimitives(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot
@@ -159,7 +157,7 @@ public:
virtual void IndexPrimitives_3DText(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
+ DrawMode mode,
class RAS_IPolyMaterial* polymat,
class RAS_IRenderTools* rendertools,
bool useObjectColor,
@@ -169,9 +167,7 @@ public:
virtual void IndexPrimitivesMulti(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
index b692bdf5f12..3efc00880df 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
@@ -60,9 +60,9 @@ bool RAS_VAOpenGLRasterizer::Init(void)
if (result)
{
glEnableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
@@ -78,14 +78,16 @@ void RAS_VAOpenGLRasterizer::SetDrawingMode(int drawingmode)
{
case KX_BOUNDINGBOX:
case KX_WIREFRAME:
- glDisable (GL_CULL_FACE);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisable(GL_CULL_FACE);
+ break;
+ case KX_SOLID:
+ glDisableClientState(GL_COLOR_ARRAY);
break;
case KX_TEXTURED:
case KX_SHADED:
case KX_SHADOW:
glEnableClientState(GL_COLOR_ARRAY);
- case KX_SOLID:
- break;
default:
break;
}
@@ -104,30 +106,23 @@ void RAS_VAOpenGLRasterizer::Exit()
void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)
{
static const GLsizei vtxstride = sizeof(RAS_TexVert);
GLenum drawmode;
- switch (mode)
- {
- case 0:
- drawmode = GL_TRIANGLES;
- break;
- case 2:
- drawmode = GL_QUADS;
- break;
- case 1: //lines
- default:
- drawmode = GL_LINES;
- break;
- }
+ if(mode == KX_MODE_TRIANGLES)
+ drawmode = GL_TRIANGLES;
+ else if(mode == KX_MODE_QUADS)
+ drawmode = GL_QUADS;
+ else
+ drawmode = GL_LINES;
+
const RAS_TexVert* vertexarray;
unsigned int numindices, vt;
+
if (drawmode != GL_LINES)
{
if (useObjectColor)
@@ -159,9 +154,10 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
continue;
glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ());
- glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1());
- glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA());
glNormalPointer(GL_FLOAT,vtxstride,vertexarray->getNormal());
+ glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1());
+ if(glIsEnabled(GL_COLOR_ARRAY))
+ glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA());
//if(m_Lock)
// local->Begin(vertexarrays[vt]->size());
@@ -171,8 +167,6 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
//if(m_Lock)
// local->End();
-
-
}
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -180,28 +174,21 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)
{
static const GLsizei vtxstride = sizeof(RAS_TexVert);
+
GLenum drawmode;
- switch (mode)
- {
- case 0:
- drawmode = GL_TRIANGLES;
- break;
- case 2:
- drawmode = GL_QUADS;
- break;
- case 1: //lines
- default:
- drawmode = GL_LINES;
- break;
- }
+ if(mode == KX_MODE_TRIANGLES)
+ drawmode = GL_TRIANGLES;
+ else if(mode == KX_MODE_QUADS)
+ drawmode = GL_QUADS;
+ else
+ drawmode = GL_LINES;
+
const RAS_TexVert* vertexarray;
unsigned int numindices, vt;
@@ -234,10 +221,10 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti( const vecVertexArray& vertexa
continue;
glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ());
- TexCoordPtr(vertexarray);
-
- glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA());
glNormalPointer(GL_FLOAT,vtxstride,vertexarray->getNormal());
+ TexCoordPtr(vertexarray);
+ if(glIsEnabled(GL_COLOR_ARRAY))
+ glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA());
//if(m_Lock)
// local->Begin(vertexarrays[vt]->size());
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
index ea08887028f..e4cc4ace0e8 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
@@ -52,9 +52,7 @@ public:
virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot);
@@ -62,9 +60,7 @@ public:
virtual void IndexPrimitivesMulti(
const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot);