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:
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp')
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp84
1 files changed, 26 insertions, 58 deletions
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index c2687319717..2c4b55ff964 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -9,6 +9,7 @@
#include "GL/glew.h"
+#include "RAS_MaterialBucket.h"
#include "RAS_TexVert.h"
#include "MT_assert.h"
@@ -125,20 +126,20 @@ void RAS_ListRasterizer::RemoveListSlot(RAS_ListSlot* list)
}
}
-RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(const vecVertexArray& vertexarrays, KX_ListSlot** slot)
+RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
{
/*
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
+ :: sorted by mesh slot
*/
- RAS_ListSlot* localSlot = (RAS_ListSlot*)*slot;
+ RAS_ListSlot* localSlot = (RAS_ListSlot*)ms.m_DisplayList;
if(!localSlot) {
- RAS_Lists::iterator it = mLists.find(vertexarrays);
+ RAS_Lists::iterator it = mLists.find(&ms);
if(it == mLists.end()) {
localSlot = new RAS_ListSlot(this);
- mLists.insert(std::pair<vecVertexArray, RAS_ListSlot*>(vertexarrays, localSlot));
+ mLists.insert(std::pair<RAS_MeshSlot*, RAS_ListSlot*>(&ms, localSlot));
} else {
localSlot = static_cast<RAS_ListSlot*>(it->second->AddRef());
}
@@ -157,69 +158,45 @@ void RAS_ListRasterizer::ReleaseAlloc()
mLists.clear();
}
-
-void RAS_ListRasterizer::IndexPrimitives(
- const vecVertexArray & vertexarrays,
- const vecIndexArrays & indexarrays,
- DrawMode mode,
- bool useObjectColor,
- const MT_Vector4& rgbacolor,
- class KX_ListSlot** slot)
+void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
{
RAS_ListSlot* localSlot =0;
- // useObjectColor(are we updating every frame?)
- if(!useObjectColor && slot) {
- localSlot = FindOrAdd(vertexarrays, slot);
+ if(ms.m_bDisplayList) {
+ localSlot = FindOrAdd(ms);
localSlot->DrawList();
if(localSlot->End()) {
// save slot here too, needed for replicas and object using same mesh
// => they have the same vertexarray but different mesh slot
- *slot = localSlot;
+ ms.m_DisplayList = localSlot;
return;
}
}
- if (mUseVertexArrays) {
- RAS_VAOpenGLRasterizer::IndexPrimitives(
- vertexarrays, indexarrays,
- mode, useObjectColor,
- rgbacolor,slot
- );
- } else {
- RAS_OpenGLRasterizer::IndexPrimitives(
- vertexarrays, indexarrays,
- mode, useObjectColor,
- rgbacolor,slot
- );
- }
+ if (mUseVertexArrays)
+ RAS_VAOpenGLRasterizer::IndexPrimitives(ms);
+ else
+ RAS_OpenGLRasterizer::IndexPrimitives(ms);
- if(!useObjectColor && slot) {
+ if(ms.m_bDisplayList) {
localSlot->EndList();
- *slot = localSlot;
+ ms.m_DisplayList = localSlot;
}
}
-void RAS_ListRasterizer::IndexPrimitivesMulti(
- const vecVertexArray& vertexarrays,
- const vecIndexArrays & indexarrays,
- DrawMode mode,
- bool useObjectColor,
- const MT_Vector4& rgbacolor,
- class KX_ListSlot** slot)
+void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
{
RAS_ListSlot* localSlot =0;
- // useObjectColor(are we updating every frame?)
- if(!useObjectColor && slot) {
- localSlot = FindOrAdd(vertexarrays, slot);
+ if(ms.m_bDisplayList) {
+ localSlot = FindOrAdd(ms);
localSlot->DrawList();
if(localSlot->End()) {
// save slot here too, needed for replicas and object using same mesh
// => they have the same vertexarray but different mesh slot
- *slot = localSlot;
+ ms.m_DisplayList = localSlot;
return;
}
}
@@ -227,23 +204,14 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(
// 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, useObjectColor,
- rgbacolor,slot
- );
- } else {
- RAS_OpenGLRasterizer::IndexPrimitivesMulti(
- vertexarrays, indexarrays,
- mode, useObjectColor,
- rgbacolor,slot
- );
- }
+ if (mUseVertexArrays && !localSlot)
+ RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(ms);
+ else
+ RAS_OpenGLRasterizer::IndexPrimitivesMulti(ms);
- if(!useObjectColor && slot) {
+ if(ms.m_bDisplayList) {
localSlot->EndList();
- *slot = localSlot;
+ ms.m_DisplayList = localSlot;
}
}