diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-04-03 01:04:20 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-04-03 01:04:20 +0400 |
commit | 6839ec66405f366d95641b1d5685369a1b19757c (patch) | |
tree | ecd65680f673221994758ab86dd563cf9462d8df /source/gameengine/Rasterizer | |
parent | 756bad72c4ca4538834aed7bbdc46a2cce41393f (diff) |
applied Charlies patch for game engine graphics. display list support, and bumpmapping shader improvements.
Diffstat (limited to 'source/gameengine/Rasterizer')
13 files changed, 589 insertions, 216 deletions
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 7f44afec74e..66e0fe0678d 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -214,7 +214,8 @@ public: class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor)=0; + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot)=0; /** * @copydoc IndexPrimitives * IndexPrimitivesEx will renormalize faces if @param vertexarrays[i].getFlag() & TV_CALCFACENORMAL @@ -245,7 +246,8 @@ public: class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor)=0; + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot)=0; virtual void IndexPrimitivesMulti_Ex( const vecVertexArray& vertexarrays, @@ -390,9 +392,10 @@ public: virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0; virtual void SetTexCoords(TexCoGen coords, int unit) = 0; - virtual void SetAttrib(int type) = 0; virtual void GetViewMatrix(MT_Matrix4x4 &mat) const = 0; + virtual bool QueryLists(){return false;} + virtual bool QueryArrays(){return false;} }; #endif //__RAS_IRASTERIZER diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp index 3aded0568cb..ef89477c345 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp @@ -61,9 +61,6 @@ void KX_VertexIndex::SetIndex(short loc,unsigned int index) m_indexarray[loc]=index; } - - - bool KX_MeshSlot::Less(const KX_MeshSlot& lhs) const { bool result = ((m_mesh < lhs.m_mesh ) || @@ -205,8 +202,8 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa if (!ms.m_bVisible) return; - m_material->ActivateMeshSlot(ms, rasty); rendertools->SetClientObject(ms.m_clientObj); + m_material->ActivateMeshSlot(ms, rasty); /* __NLA Do the deformation */ if (ms.m_pDeformer) @@ -222,6 +219,12 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa rendertools->PushMatrix(); rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->GetDrawingMode()); + if(rasty->QueryLists()) + { + if(ms.m_DisplayList) + ms.m_DisplayList->SetModified(ms.m_mesh->MeshModified()); + } + // Use the text-specific IndexPrimitives for text faces if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT) { @@ -246,14 +249,15 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa m_material, rendertools, ms.m_bObjectColor, - ms.m_RGBAcolor + ms.m_RGBAcolor, + &ms.m_DisplayList ); } // for using glMultiTexCoord on deformer else if(m_material->GetFlag() & RAS_DEFMULTI ) { - rasty->IndexPrimitivesMulti( + rasty->IndexPrimitivesMulti_Ex( ms.m_mesh->GetVertexCache(m_material), ms.m_mesh->GetIndexCache(m_material), drawmode, @@ -287,10 +291,16 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa m_material, rendertools, // needed for textprinting on polys ms.m_bObjectColor, - ms.m_RGBAcolor + ms.m_RGBAcolor, + &ms.m_DisplayList ); } - + + if(rasty->QueryLists()) { + if(ms.m_DisplayList) + ms.m_mesh->SetMeshModified(false); + } + rendertools->PopMatrix(); } diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index 448cbc6e343..7d875242c2e 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -64,6 +64,17 @@ public: short m_size; }; +/** + * KX_ListSlot. + */ +class KX_ListSlot +{ +public: + KX_ListSlot(){} + virtual ~KX_ListSlot(){} + + virtual void SetModified(bool mod)=0; +}; /** * KX_MeshSlot. @@ -71,19 +82,21 @@ public: class KX_MeshSlot { public: - void* m_clientObj; + void* m_clientObj; RAS_Deformer* m_pDeformer; // __NLA - double* m_OpenGLMatrix; - class RAS_MeshObject* m_mesh; + double* m_OpenGLMatrix; + class RAS_MeshObject* m_mesh; mutable bool m_bVisible; // for visibility - mutable bool m_bObjectColor; + mutable bool m_bObjectColor; mutable MT_Vector4 m_RGBAcolor; + mutable KX_ListSlot* m_DisplayList; // for lists KX_MeshSlot() : m_pDeformer(NULL), - m_bVisible(true) + m_bVisible(true), + m_DisplayList(0) { } - ~KX_MeshSlot() {}; + ~KX_MeshSlot(){} bool Less(const KX_MeshSlot& lhs) const; }; diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp index 54e5364bc88..360939f71e0 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp @@ -70,11 +70,17 @@ RAS_MeshObject::RAS_MeshObject(int lightlayer) : m_bModified(true), m_lightlayer(lightlayer), m_zsort(false), + m_MeshMod(true), m_class(0) { } +bool RAS_MeshObject::MeshModified() +{ + return m_MeshMod; +} + RAS_MeshObject::~RAS_MeshObject() { @@ -686,5 +692,7 @@ void RAS_MeshObject::SchedulePolygons(const MT_Transform &transform, int drawing } m_bModified = false; + + m_MeshMod = true; } } diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h index d4884363731..7ca57093d90 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.h +++ b/source/gameengine/Rasterizer/RAS_MeshObject.h @@ -132,8 +132,9 @@ class RAS_MeshObject vector<class RAS_Polygon*> m_Polygons; STR_String m_name; static STR_String s_emptyname; - bool m_zsort; - + bool m_zsort; + bool m_MeshMod; + struct polygonSlot; struct backtofront; struct fronttoback; @@ -255,6 +256,10 @@ public: const vecIndexArrays& GetIndexCache (RAS_IPolyMaterial* mat); void SetName(STR_String name); const STR_String& GetName(); + + bool MeshModified(); + void SetMeshModified(bool v){m_MeshMod = v;} + }; #endif //__RAS_MESHOBJECT diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp index 58cd8dc2aa1..9e06fcda299 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp @@ -406,7 +406,7 @@ PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB; PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB; #endif - +#if 0 // TODO: GL_ARB_vertex/fragment_program support #ifdef GL_ARB_vertex_program PFNGLVERTEXATTRIB1FARBPROC blVertexAttrib1fARB; PFNGLVERTEXATTRIB1FVARBPROC blVertexAttrib1fvARB; @@ -421,6 +421,13 @@ PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB; PFNGLGETVERTEXATTRIBFVARBPROC blGetVertexAttribfvARB; PFNGLGETVERTEXATTRIBIVARBPROC blGetVertexAttribivARB; #endif +#endif + +#ifdef GL_EXT_compiled_vertex_array + PFNGLLOCKARRAYSEXTPROC blLockArraysEXT; + PFNGLUNLOCKARRAYSEXTPROC blUnlockArraysEXT; +#endif + } // namespace bgl @@ -605,6 +612,7 @@ static void LinkExtensions() } #endif +#if 0 // TODO: GL_ARB_vertex/fragment_program support #if defined(GL_ARB_vertex_program) if (QueryExtension("GL_ARB_vertex_program")) { @@ -629,6 +637,7 @@ static void LinkExtensions() } } #endif +#endif #ifdef GL_ARB_depth_texture @@ -643,6 +652,22 @@ static void LinkExtensions() } #endif +#ifdef GL_EXT_compiled_vertex_array + if (QueryExtension("GL_EXT_compiled_vertex_array")) + { + blLockArraysEXT = reinterpret_cast<PFNGLLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glLockArraysEXT")); + blUnlockArraysEXT = reinterpret_cast<PFNGLUNLOCKARRAYSEXTPROC>(bglGetProcAddress((const GLubyte *) "glUnlockArraysEXT")); + if (blLockArraysEXT && blUnlockArraysEXT) { + EnableExtension(_GL_EXT_compiled_vertex_array); + RAS_EXT_support._EXT_compiled_vertex_array = 1; + if (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 + if (QueryExtension("GL_EXT_separate_specular_color")) { EnableExtension(_GL_EXT_separate_specular_color); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h index 26217c1d78e..9e6df30708a 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h @@ -403,7 +403,8 @@ typedef struct BL_EXTInfo _ARB_fragment_shader(0), _EXT_texture3D(0), _ARB_vertex_program(0), - _ARB_depth_texture(0) + _ARB_depth_texture(0), + _EXT_compiled_vertex_array(0) { // } @@ -417,6 +418,7 @@ typedef struct BL_EXTInfo bool _EXT_texture3D; bool _ARB_vertex_program; bool _ARB_depth_texture; + bool _EXT_compiled_vertex_array; }BL_EXTInfo; extern BL_EXTInfo RAS_EXT_support; @@ -508,6 +510,7 @@ extern PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB; extern PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB; #endif +#if 0 // TODO: GL_ARB_vertex/fragment_program support #ifdef GL_ARB_vertex_program extern PFNGLVERTEXATTRIB1FARBPROC blVertexAttrib1fARB; extern PFNGLVERTEXATTRIB1FVARBPROC blVertexAttrib1fvARB; @@ -522,7 +525,12 @@ extern PFNGLGETVERTEXATTRIBDVARBPROC blGetVertexAttribdvARB; extern PFNGLGETVERTEXATTRIBFVARBPROC blGetVertexAttribfvARB; extern PFNGLGETVERTEXATTRIBIVARBPROC blGetVertexAttribivARB; #endif +#endif +#ifdef GL_EXT_compiled_vertex_array +extern PFNGLLOCKARRAYSEXTPROC blLockArraysEXT; +extern PFNGLUNLOCKARRAYSEXTPROC blUnlockArraysEXT; +#endif } /* namespace bgl */ diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp new file mode 100644 index 00000000000..5f0541f8bac --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -0,0 +1,207 @@ +// +#include <iostream> + +#include "RAS_ListRasterizer.h" + +#ifdef WIN32 +#include <windows.h> +#endif // WIN32 +#ifdef __APPLE__ +#define GL_GLEXT_LEGACY 1 +#include <OpenGL/gl.h> +#else +#include <GL/gl.h> +#endif + +#include "RAS_TexVert.h" +#include "RAS_GLExtensionManager.h" +#include "MT_assert.h" + +#ifndef NDEBUG +#define spit(x) std::cout << x << std::endl; +#else +#define spit(x) +#endif + +RAS_ListSlot::RAS_ListSlot() +: KX_ListSlot(), + m_flag(LIST_MODIFY|LIST_CREATE), + m_list(0) +{ +} + +RAS_ListSlot::~RAS_ListSlot() +{ + RemoveList(); +} + + +void RAS_ListSlot::RemoveList() +{ + if(m_list != 0) { + spit("Releasing display list (" << m_list << ")"); + glDeleteLists((GLuint)m_list, 1); + m_list =0; + } +} + +void RAS_ListSlot::DrawList() +{ + if(m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) { + RemoveList(); + return; + } + if(m_flag &LIST_MODIFY) { + if(m_flag &LIST_CREATE) { + if(m_list == 0) { + m_list = (unsigned int)glGenLists(1); + m_flag = m_flag &~ LIST_CREATE; + spit("Created display list (" << m_list << ")"); + } + } + if(m_list != 0) + glNewList((GLuint)m_list, GL_COMPILE_AND_EXECUTE); + + m_flag |= LIST_BEGIN; + return; + } + glCallList(m_list); +} + +void RAS_ListSlot::EndList() +{ + if(m_flag & LIST_BEGIN) { + glEndList(); + m_flag = m_flag &~(LIST_BEGIN|LIST_MODIFY); + m_flag |= LIST_END; + } +} + +void RAS_ListSlot::SetModified(bool mod) +{ + if(mod && !(m_flag & LIST_MODIFY)) { + spit("Modifying list (" << m_list << ")"); + m_flag = m_flag &~ LIST_END; + m_flag |= LIST_MODIFY; + } +} + +bool RAS_ListSlot::End() +{ + return (m_flag &LIST_END)!=0; +} + + + +RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas) +: RAS_OpenGLRasterizer(canvas) +{ + // -- +} + +RAS_ListRasterizer::~RAS_ListRasterizer() +{ + ReleaseAlloc(); +} + +RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(const vecVertexArray& vertexarrays, KX_ListSlot** slot) +{ + /* + Keep a copy of constant lists submitted for rendering, + this guards against (replicated)new...delete every frame, + and we can reuse lists! + :: sorted by vertex array + */ + RAS_ListSlot* localSlot = (RAS_ListSlot*)*slot; + if(!localSlot) { + RAS_Lists::iterator it = mLists.find(vertexarrays); + if(it == mLists.end()) { + localSlot = new RAS_ListSlot(); + mLists.insert(std::pair<vecVertexArray, RAS_ListSlot*>(vertexarrays, localSlot)); + } else { + localSlot = it->second; + } + } + MT_assert(localSlot); + return localSlot; +} + +void RAS_ListRasterizer::ReleaseAlloc() +{ + RAS_Lists::iterator it = mLists.begin(); + while(it != mLists.end()) { + delete it->second; + it++; + } + mLists.clear(); +} + + +void RAS_ListRasterizer::IndexPrimitives( + 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) +{ + RAS_ListSlot* localSlot =0; + + // useObjectColor(are we updating every frame?) + if(!useObjectColor) { + localSlot = FindOrAdd(vertexarrays, slot); + localSlot->DrawList(); + if(localSlot->End()) + return; + } + + RAS_OpenGLRasterizer::IndexPrimitives( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + + if(!useObjectColor) { + localSlot->EndList(); + *slot = localSlot; + } +} + + +void RAS_ListRasterizer::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) +{ + RAS_ListSlot* localSlot =0; + + // useObjectColor(are we updating every frame?) + if(!useObjectColor) { + localSlot = FindOrAdd(vertexarrays, slot); + localSlot->DrawList(); + + if(localSlot->End()) + return; + } + + RAS_OpenGLRasterizer::IndexPrimitivesMulti( + vertexarrays, indexarrays, + mode, polymat, + rendertools, useObjectColor, + rgbacolor,slot + ); + if(!useObjectColor) { + localSlot->EndList(); + *slot = localSlot; + } +} + +// eof diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h new file mode 100644 index 00000000000..82840cd1399 --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h @@ -0,0 +1,72 @@ +#ifndef __RAS_LISTRASTERIZER_H__ +#define __RAS_LISTRASTERIZER_H__ + +#include "RAS_MaterialBucket.h" +#include "RAS_OpenGLRasterizer.h" +#include <vector> + +class RAS_ListSlot : public KX_ListSlot +{ + unsigned int m_list; + unsigned int m_flag; +public: + RAS_ListSlot(); + virtual ~RAS_ListSlot(); + virtual void SetModified(bool mod); + + void RemoveList(); + void DrawList(); + void EndList(); + bool End(); + +}; + +enum RAS_ListSlotFlags { + LIST_CREATE =1, + LIST_MODIFY =2, + LIST_STREAM =4, + LIST_NOCREATE =8, + LIST_BEGIN =16, + LIST_END =32, + LIST_REGEN =64 +}; + +typedef std::map<const vecVertexArray, RAS_ListSlot*> RAS_Lists; + +class RAS_ListRasterizer : public RAS_OpenGLRasterizer +{ + RAS_Lists mLists; + + RAS_ListSlot* FindOrAdd(const vecVertexArray& vertexarrays, KX_ListSlot** slot); + void ReleaseAlloc(); + +public: + RAS_ListRasterizer(RAS_ICanvas* canvas); + virtual ~RAS_ListRasterizer(); + + virtual void IndexPrimitives( + 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 + ); + + 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 + ); + + virtual bool QueryLists(){return true;} +}; + +#endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index a576205b87c..8f7876f66a1 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -81,7 +81,6 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas) m_focallength(0.0), m_setfocallength(false), m_noOfScanlines(32), - m_useTang(0), m_materialCachingInfo(0) { m_viewmatrix.Identity(); @@ -619,7 +618,8 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays, class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot ) { GLenum drawmode; @@ -1201,12 +1201,6 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa } //for each vertexarray } -void RAS_OpenGLRasterizer::SetAttrib(int type) -{ - if(type == RAS_TEXTANGENT) m_useTang=true; -} - - void RAS_OpenGLRasterizer::SetTexCoords(TexCoGen coords,int unit) { // this changes from material to material @@ -1242,14 +1236,40 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv, int enabled) case RAS_TEXCO_NORM: bgl::blMultiTexCoord3fvARB(GL_TEXTURE0_ARB+unit, tv.getNormal()); break; - + case RAS_TEXTANGENT: + bgl::blMultiTexCoord4fvARB(GL_TEXTURE0_ARB+unit, tv.getTangent()); } } } #endif -#ifdef GL_ARB_vertex_program - if(m_useTang && bgl::RAS_EXT_support._ARB_vertex_program) - bgl::blVertexAttrib4fvARB(1/*tangent*/, tv.getTangent()); +} +void RAS_OpenGLRasterizer::Tangent( const RAS_TexVert& v1, + const RAS_TexVert& v2, + const RAS_TexVert& v3, + const MT_Vector3 &no) +{ +#ifdef GL_ARB_multitexture + // TODO: set for deformer... + MT_Vector3 x1(v1.getLocalXYZ()), x2(v2.getLocalXYZ()), x3(v3.getLocalXYZ()); + MT_Vector2 uv1(v1.getUV1()), uv2(v2.getUV1()), uv3(v3.getUV1()); + MT_Vector3 dx1(x2 - x1), dx2(x3 - x1); + MT_Vector2 duv1(uv2 - uv1), duv2(uv3 - uv1); + + MT_Scalar r = 1.0 / (duv1.x() * duv2.y() - duv2.x() * duv1.y()); + duv1 *= r; + duv2 *= r; + MT_Vector3 sdir(duv2.y() * dx1 - duv1.y() * dx2); + MT_Vector3 tdir(duv1.x() * dx2 - duv2.x() * dx1); + + // Gram-Schmidt orthogonalize + MT_Vector3 t(sdir - no.cross(no.cross(sdir))); + if (!MT_fuzzyZero(t)) + t /= t.length(); + + float tangent[4]; + t.getValue(tangent); + // Calculate handedness + tangent[3] = no.dot(sdir.cross(tdir)) < 0.0 ? -1.0 : 1.0; #endif } @@ -1261,7 +1281,8 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti( class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot ) { #ifdef GL_ARB_multitexture @@ -1455,14 +1476,14 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti( } -void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertexarrays, +void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex( + const vecVertexArray & vertexarrays, const vecIndexArrays & indexarrays, int mode, class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor - ) + const MT_Vector4& rgbacolor) { #ifdef GL_ARB_multitexture bool recalc; @@ -1492,7 +1513,6 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex const KX_IndexArray & indexarray = (*indexarrays[vt]); numindices = indexarray.size(); const unsigned int enabled = polymat->GetEnabled(); - unsigned int unit; if (!numindices) continue; @@ -1544,72 +1564,27 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; } @@ -1645,18 +1620,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; @@ -1664,18 +1628,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; @@ -1683,35 +1636,15 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ - + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA())); if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; } @@ -1748,49 +1681,19 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; } @@ -1820,51 +1723,21 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA())); if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA())); if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA())); if (!recalc) glNormal3fv(vertexarray[(indexarray[vindex])].getNormal()); - // ------------------------------ - for(unit =0; unit<enabled; unit++) { - if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV && - vertexarray[(indexarray[vindex])].getUnit() == unit ) - { - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2()); - continue; - } - bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1()); - } - // ------------------------------ + TexCoord(vertexarray[(indexarray[vindex])],enabled ); glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ()); vindex++; } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 6b1925340b2..b00832b9738 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -89,13 +89,12 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer float m_focallength; bool m_setfocallength; int m_noOfScanlines; - TexCoGen m_texco[RAS_MAX]; - bool m_useTang; - bool InterlacedStereo() const; protected: int m_drawingmode; + TexCoGen m_texco[RAS_MAX]; + /** Stores the caching information for the last material activated. */ RAS_IPolyMaterial::TCachingInfo m_materialCachingInfo; @@ -148,7 +147,8 @@ public: class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot ); virtual void IndexPrimitives_Ex( @@ -178,7 +178,8 @@ public: class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor); + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot); virtual void IndexPrimitivesMulti_Ex( const vecVertexArray& vertexarrays, @@ -284,9 +285,13 @@ public: virtual void SetTexCoords(TexCoGen coords,int enabled); void TexCoord(const RAS_TexVert &tv, int unit); - virtual void SetAttrib(int type); virtual void GetViewMatrix(MT_Matrix4x4 &mat) const; + void Tangent(const RAS_TexVert& v1, + const RAS_TexVert& v2, + const RAS_TexVert& v3, + const MT_Vector3 &no); + }; #endif //__RAS_OPENGLRASTERIZER diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp index b6d8e74c2d5..4928627c065 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp @@ -54,8 +54,9 @@ using namespace bgl; -RAS_VAOpenGLRasterizer::RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas) -:RAS_OpenGLRasterizer(canvas) +RAS_VAOpenGLRasterizer::RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas, bool lock) +: RAS_OpenGLRasterizer(canvas), + m_Lock(lock && RAS_EXT_support._EXT_compiled_vertex_array) { } @@ -65,8 +66,6 @@ RAS_VAOpenGLRasterizer::~RAS_VAOpenGLRasterizer() { } - - bool RAS_VAOpenGLRasterizer::Init(void) { @@ -138,7 +137,8 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor) + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot) { static const GLsizei vtxstride = sizeof(RAS_TexVert); GLenum drawmode; @@ -181,13 +181,13 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays { glColor3d(0,0,0); } + // use glDrawElements to draw each vertexarray for (vt=0;vt<vertexarrays.size();vt++) { vertexarray = &((*vertexarrays[vt]) [0]); const KX_IndexArray & indexarray = (*indexarrays[vt]); numindices = indexarray.size(); - // int numverts = vertexarrays[vt]->size(); if (!numindices) continue; @@ -196,14 +196,142 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1()); glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA()); glNormalPointer(GL_FLOAT,vtxstride,vertexarray->getNormal()); - //glLockArraysEXT(0,numverts); + + //if(m_Lock) + // local->Begin(vertexarrays[vt]->size()); + // here the actual drawing takes places glDrawElements(drawmode,numindices,GL_UNSIGNED_SHORT,&(indexarray[0])); - //glUnlockArraysEXT(); + + //if(m_Lock) + // local->End(); + + } } +void RAS_VAOpenGLRasterizer::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) +{ + 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; + } + } + const RAS_TexVert* vertexarray; + unsigned int numindices, vt; + const unsigned int enabled = polymat->GetEnabled(); + + if (drawmode != GL_LINES) + { + if (useObjectColor) + { + glDisableClientState(GL_COLOR_ARRAY); + glColor4d(rgbacolor[0], rgbacolor[1], rgbacolor[2], rgbacolor[3]); + } else + { + glColor4d(0,0,0,1.0); + glEnableClientState(GL_COLOR_ARRAY); + } + } + else + { + glColor3d(0,0,0); + } + + // use glDrawElements to draw each vertexarray + for (vt=0;vt<vertexarrays.size();vt++) + { + vertexarray = &((*vertexarrays[vt]) [0]); + const KX_IndexArray & indexarray = (*indexarrays[vt]); + numindices = indexarray.size(); + + if (!numindices) + continue; + + glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ()); + TexCoordPtr(vertexarray, enabled); + + //glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1()); + glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA()); + glNormalPointer(GL_FLOAT,vtxstride,vertexarray->getNormal()); + + //if(m_Lock) + // local->Begin(vertexarrays[vt]->size()); + + // here the actual drawing takes places + glDrawElements(drawmode,numindices,GL_UNSIGNED_SHORT,&(indexarray[0])); + + //if(m_Lock) + // local->End(); + } +} + +void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv, int enabled) +{ +#ifdef GL_ARB_multitexture + if(bgl::RAS_EXT_support._ARB_multitexture) + { + for(int unit=0; unit<enabled; unit++) + { + bgl::blClientActiveTextureARB(GL_TEXTURE0_ARB+unit); + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if( tv->getFlag() & TV_2NDUV && tv->getUnit() == unit ) { + glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert), tv->getUV2()); + continue; + } + switch(m_texco[unit]) + { + case RAS_TEXCO_DISABLE: + case RAS_TEXCO_OBJECT: + case RAS_TEXCO_GEN: + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + break; + case RAS_TEXCO_ORCO: + case RAS_TEXCO_GLOB: + glTexCoordPointer(3, GL_FLOAT, sizeof(RAS_TexVert),tv->getLocalXYZ()); + break; + case RAS_TEXCO_UV1: + glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert),tv->getUV1()); + break; + case RAS_TEXCO_NORM: + glTexCoordPointer(3, GL_FLOAT, sizeof(RAS_TexVert),tv->getNormal()); + break; + case RAS_TEXTANGENT: + glTexCoordPointer(4, GL_FLOAT, sizeof(RAS_TexVert),tv->getTangent()); + } + } + } +#endif +} + + void RAS_VAOpenGLRasterizer::EnableTextures(bool enable) { if (enable) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h index d0fd6006ab6..06a6fb4bb3a 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h @@ -36,8 +36,11 @@ class RAS_VAOpenGLRasterizer : public RAS_OpenGLRasterizer { + void TexCoordPtr(const RAS_TexVert *tv, int unit); + bool m_Lock; + public: - RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas); + RAS_VAOpenGLRasterizer(RAS_ICanvas* canvas, bool lock=false); virtual ~RAS_VAOpenGLRasterizer(); virtual bool Init(); @@ -51,10 +54,23 @@ public: class RAS_IPolyMaterial* polymat, class RAS_IRenderTools* rendertools, bool useObjectColor, - const MT_Vector4& rgbacolor); + const MT_Vector4& rgbacolor, + class KX_ListSlot** slot); + + 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); virtual void EnableTextures(bool enable); + //virtual bool QueryArrays(){return true;} + //virtual bool QueryLists(){return m_Lock;} }; |