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:
authorturjuque <turjuque@gmail.com>2016-01-07 00:14:30 +0300
committerturjuque <turjuque@gmail.com>2016-01-07 00:14:30 +0300
commit44aeca90237030287586e7e88ee7d582248956be (patch)
treec7497834de39e7cbafa106af09fb150266f6e4de /source/gameengine/Rasterizer
parentc89ced47bb887567e0aae9ce6dc6162254867756 (diff)
parentbe28706bacfb95e7c3c1b58b183acda0e35977f8 (diff)
Merge branch 'master' of git://git.blender.org/blender
# Conflicts: # source/blender/editors/space_view3d/drawmesh.c # source/blender/gpu/GPU_extensions.h # source/blender/gpu/SConscript # source/blender/gpu/intern/gpu_compositing.c # source/blender/gpu/intern/gpu_extensions.c # source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
Diffstat (limited to 'source/gameengine/Rasterizer')
-rw-r--r--source/gameengine/Rasterizer/RAS_2DFilterManager.cpp8
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_CameraData.h8
-rw-r--r--source/gameengine/Rasterizer/RAS_FramingManager.cpp8
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp24
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h10
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp14
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp73
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h43
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h1
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp28
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h3
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp18
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp281
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h16
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp310
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h69
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp63
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h1
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp71
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h5
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript40
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.cpp16
-rw-r--r--source/gameengine/Rasterizer/SConscript63
26 files changed, 306 insertions, 875 deletions
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index cedc27c3b92..82b26749fd1 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -495,10 +495,10 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glBegin(GL_QUADS);
glColor4f(1.f, 1.f, 1.f, 1.f);
- glTexCoord2f(1.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1,1);
- glTexCoord2f(0.0, 1.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1,1);
- glTexCoord2f(0.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1,-1);
- glTexCoord2f(1.0, 0.0); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1,-1);
+ glTexCoord2f(1.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[3]); glVertex2f(1.0f,1.0f);
+ glTexCoord2f(0.0f, 1.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[3]); glVertex2f(-1.0f,1.0f);
+ glTexCoord2f(0.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[0], canvascoord[2]); glVertex2f(-1.0f,-1.0f);
+ glTexCoord2f(1.0f, 0.0f); glMultiTexCoord2fARB(GL_TEXTURE3_ARB, canvascoord[1], canvascoord[2]); glVertex2f(1.0f,-1.0f);
glEnd();
}
}
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index f90b5959f76..d131891cb90 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -282,7 +282,7 @@ void RAS_BucketManager::OptimizeBuckets(MT_Scalar distance)
{
BucketList::iterator bit;
- distance = 10.0;
+ distance = 10.0f;
for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit)
(*bit)->Optimize(distance);
diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h
index e2024a4a55d..bc8433afd05 100644
--- a/source/gameengine/Rasterizer/RAS_CameraData.h
+++ b/source/gameengine/Rasterizer/RAS_CameraData.h
@@ -51,10 +51,10 @@ struct RAS_CameraData
int m_viewporttop;
float m_focallength;
- RAS_CameraData(float lens = 35.0, float scale = 6.0, float sensor_x = 32.0, float sensor_y = 18.0, short sensor_fit = 0,
- float shift_x = 0.0, float shift_y = 0.0,
- float clipstart = 0.1, float clipend = 5000.0, bool perspective = true,
- float focallength = 3.0, bool viewport = false, int viewportleft = 0, int viewportbottom = 0,
+ RAS_CameraData(float lens = 35.0f, float scale = 6.0f, float sensor_x = 32.0f, float sensor_y = 18.0f, short sensor_fit = 0,
+ float shift_x = 0.0f, float shift_y = 0.0f,
+ float clipstart = 0.1f, float clipend = 5000.0f, bool perspective = true,
+ float focallength = 3.0f, bool viewport = false, int viewportleft = 0, int viewportbottom = 0,
int viewportright = 0, int viewporttop = 0) :
m_lens(lens),
m_scale(scale),
diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
index c5f15c9ad21..8b0ec22fde3 100644
--- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
@@ -283,14 +283,14 @@ ComputeFrustum(
switch (sensor_fit) {
case RAS_SENSORFIT_HOR:
{
- x_scale = 1.0;
+ x_scale = 1.0f;
y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth());
break;
}
case RAS_SENSORFIT_VERT:
{
x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight());
- y_scale = 1.0;
+ y_scale = 1.0f;
break;
}
case RAS_SENSORFIT_AUTO:
@@ -377,14 +377,14 @@ RAS_FramingManager::
switch (sensor_fit) {
case RAS_SENSORFIT_HOR:
{
- x_scale = 1.0;
+ x_scale = 1.0f;
y_scale = float(viewport.GetHeight()) / float(viewport.GetWidth());
break;
}
case RAS_SENSORFIT_VERT:
{
x_scale = float(viewport.GetWidth()) / float(viewport.GetHeight());
- y_scale = 1.0;
+ y_scale = 1.0f;
break;
}
case RAS_SENSORFIT_AUTO:
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index d07b4910968..2a736aa7deb 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -62,10 +62,10 @@ void RAS_IPolyMaterial::Initialize(
m_polymatid = m_newpolymatid++;
m_flag = 0;
m_multimode = 0;
- m_shininess = 35.0;
- m_specular.setValue(0.5,0.5,0.5);
- m_specularity = 1.0;
- m_diffuse.setValue(0.5,0.5,0.5);
+ m_shininess = 35.0f;
+ m_specular.setValue(0.5f,0.5f,0.5f);
+ m_specularity = 1.0f;
+ m_diffuse.setValue(0.5f,0.5f,0.5f);
m_drawingmode = ConvertFaceMode(game, image);
}
@@ -85,10 +85,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial()
m_flag(0),
m_multimode(0)
{
- m_shininess = 35.0;
- m_specular = MT_Vector3(0.5,0.5,0.5);
- m_specularity = 1.0;
- m_diffuse = MT_Vector3(0.5,0.5,0.5);
+ m_shininess = 35.0f;
+ m_specular = MT_Vector3(0.5f,0.5f,0.5f);
+ m_specularity = 1.0f;
+ m_diffuse = MT_Vector3(0.5f,0.5f,0.5f);
}
RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname,
@@ -113,10 +113,10 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname,
m_flag(0),
m_multimode(0)
{
- m_shininess = 35.0;
- m_specular = MT_Vector3(0.5,0.5,0.5);
- m_specularity = 1.0;
- m_diffuse = MT_Vector3(0.5,0.5,0.5);
+ m_shininess = 35.0f;
+ m_specular = MT_Vector3(0.5f,0.5f,0.5f);
+ m_specularity = 1.0f;
+ m_diffuse = MT_Vector3(0.5f,0.5f,0.5f);
}
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 7fbaf076d25..a92b87773c7 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -267,7 +267,6 @@ public:
* IndexPrimitives: Renders primitives from mesh slot.
*/
virtual void IndexPrimitives(class RAS_MeshSlot &ms) = 0;
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot &ms) = 0;
/**
* IndexPrimitives_3DText will render text into the polygons.
@@ -423,7 +422,7 @@ public:
/**
* Render Tools
*/
- virtual void applyTransform(double *oglmatrix, int drawingmode) = 0;
+ virtual void applyTransform(float *oglmatrix, int drawingmode) = 0;
/**
* Renders 2D boxes.
@@ -447,7 +446,7 @@ public:
*/
virtual void RenderText3D(
int fontid, const char *text, int size, int dpi,
- const float color[4], const double mat[16], float aspect) = 0;
+ const float color[4], const float mat[16], float aspect) = 0;
/**
* Renders 2D text string.
@@ -480,6 +479,11 @@ public:
virtual void SetAuxilaryClientInfo(void *inf) = 0;
+ /**
+ * Prints information about what the hardware supports.
+ */
+ virtual void PrintHardwareInfo() = 0;
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_IRasterizer")
#endif
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 2078fc99f2e..9cd8f77adfd 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -58,7 +58,7 @@ RAS_MeshSlot::RAS_MeshSlot() : SG_QList()
m_bVisible = false;
m_bCulled = true;
m_bObjectColor = false;
- m_RGBAcolor = MT_Vector4(0.0, 0.0, 0.0, 0.0);
+ m_RGBAcolor = MT_Vector4(0.0f, 0.0f, 0.0f, 0.0f);
m_DisplayList = NULL;
m_bDisplayList = true;
m_joinSlot = NULL;
@@ -649,15 +649,13 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
else
ms.m_bDisplayList = true;
- // for text drawing using faces
- if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT)
+ if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT) {
+ // for text drawing using faces
rasty->IndexPrimitives_3DText(ms, m_material);
- // for multitexturing
- else if ((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL)))
- rasty->IndexPrimitivesMulti(ms);
- // use normal IndexPrimitives
- else
+ }
+ else {
rasty->IndexPrimitives(ms);
+ }
rasty->PopMatrix();
}
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 1eee99f896b..75cc382c78c 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -128,7 +128,7 @@ public:
void* m_clientObj;
RAS_Deformer* m_pDeformer;
DerivedMesh* m_pDerivedMesh;
- double* m_OpenGLMatrix;
+ float* m_OpenGLMatrix;
// visibility
bool m_bVisible;
bool m_bCulled;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
index 888a7114f50..9f95e2c82af 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
@@ -49,20 +49,16 @@ set(INC_SYS
)
set(SRC
- RAS_GLExtensionManager.cpp
RAS_ListRasterizer.cpp
RAS_OpenGLLight.cpp
RAS_OpenGLRasterizer.cpp
- RAS_StorageIM.cpp
RAS_StorageVA.cpp
RAS_StorageVBO.cpp
- RAS_GLExtensionManager.h
RAS_IStorage.h
RAS_ListRasterizer.h
RAS_OpenGLLight.h
RAS_OpenGLRasterizer.h
- RAS_StorageIM.h
RAS_StorageVA.h
RAS_StorageVBO.h
)
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
deleted file mode 100644
index bc22d68e218..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * ***** BEGIN GPL 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.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 LICENSE BLOCK *****
- */
-
-/** \file gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
- * \ingroup bgerastogl
- */
-
-
-#include <iostream>
-
-#include "glew-mx.h"
-
-#include "RAS_GLExtensionManager.h"
-
-namespace bgl
-{
- void InitExtensions(bool debug)
- {
- static bool firsttime = true;
-
- if (firsttime) {
- firsttime = false;
-
- if (debug) {
- if (GLEW_ATI_pn_triangles)
- std::cout << "Enabled GL_ATI_pn_triangles" << std::endl;
- if (GLEW_ARB_texture_env_combine)
- std::cout << "Detected GL_ARB_texture_env_combine" << std::endl;
- if (GLEW_ARB_texture_cube_map)
- std::cout << "Detected GL_ARB_texture_cube_map" << std::endl;
- if (GLEW_ARB_multitexture)
- std::cout << "Detected GL_ARB_multitexture" << std::endl;
- if (GLEW_ARB_shader_objects)
- std::cout << "Detected GL_ARB_shader_objects" << std::endl;
- if (GLEW_ARB_vertex_shader)
- std::cout << "Detected GL_ARB_vertex_shader" << std::endl;
- if (GLEW_ARB_fragment_shader)
- std::cout << "Detected GL_ARB_fragment_shader" << std::endl;
- if (GLEW_ARB_vertex_program)
- std::cout << "Detected GL_ARB_vertex_program" << std::endl;
- if (GLEW_ARB_depth_texture)
- std::cout << "Detected GL_ARB_depth_texture" << std::endl;
- if (GLEW_EXT_separate_specular_color)
- std::cout << "Detected GL_EXT_separate_specular_color" << std::endl;
- }
- }
- }
-} // namespace bgl
-
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
deleted file mode 100644
index 9f2039b4c6f..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * ***** BEGIN GPL 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.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 LICENSE BLOCK *****
- */
-
-/** \file RAS_GLExtensionManager.h
- * \ingroup bgerastogl
- */
-
-#ifndef __RAS_GLEXTENSIONMANAGER_H__
-#define __RAS_GLEXTENSIONMANAGER_H__
-
-/** Note: this used to have a lot more code, but now extension handling
- * is done by GLEW, so it does mostly debug stuff */
-
-namespace bgl
-{
- void InitExtensions(bool debug);
-} /* namespace bgl */
-
-#endif /* __RAS_GLEXTENSIONMANAGER_H__ */
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
index bfa6e1a6cb7..ae0cdcd84af 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
@@ -44,7 +44,6 @@ public:
virtual void Exit()=0;
virtual void IndexPrimitives(RAS_MeshSlot& ms)=0;
- virtual void IndexPrimitivesMulti(RAS_MeshSlot& ms)=0;
virtual void SetDrawingMode(int drawingmode)=0;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 34184f73953..b2d580161ca 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -122,7 +122,7 @@ bool RAS_ListSlot::End()
-RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas, bool lock, int storage)
+RAS_ListRasterizer::RAS_ListRasterizer(RAS_ICanvas* canvas, bool lock, RAS_STORAGE_TYPE storage)
: RAS_OpenGLRasterizer(canvas, storage)
{
}
@@ -243,30 +243,6 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
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
- ms.m_DisplayList = localSlot;
- return;
- }
- }
-
- RAS_OpenGLRasterizer::IndexPrimitives(ms);
-
- if (ms.m_bDisplayList) {
- localSlot->EndList();
- ms.m_DisplayList = localSlot;
- }
-}
-
-
-void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
-{
- RAS_ListSlot* localSlot =0;
-
- if (ms.m_bDisplayList) {
- localSlot = FindOrAdd(ms);
- localSlot->DrawList();
if (localSlot->End()) {
// save slot here too, needed for replicas and object using same mesh
@@ -276,7 +252,7 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
}
}
- RAS_OpenGLRasterizer::IndexPrimitivesMulti(ms);
+ RAS_OpenGLRasterizer::IndexPrimitives(ms);
if (ms.m_bDisplayList) {
localSlot->EndList();
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
index 5e1c662bc17..e3e6931311b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
@@ -56,11 +56,10 @@ class RAS_ListRasterizer : public RAS_OpenGLRasterizer
public:
void RemoveListSlot(RAS_ListSlot* list);
- RAS_ListRasterizer(RAS_ICanvas* canvas, bool lock=false, int storage=RAS_AUTO_STORAGE);
+ RAS_ListRasterizer(RAS_ICanvas* canvas, bool lock, RAS_STORAGE_TYPE storage);
virtual ~RAS_ListRasterizer();
virtual void IndexPrimitives(class RAS_MeshSlot& ms);
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms);
virtual bool Init();
virtual void Exit();
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
index 0755077615b..a14a211b90d 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
@@ -100,13 +100,13 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer,
//vec[0] = base->object->obmat[2][0];
//vec[1] = base->object->obmat[2][1];
//vec[2] = base->object->obmat[2][2];
- vec[3] = 0.0;
+ vec[3] = 0.0f;
glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec);
}
else {
- //vec[3] = 1.0;
+ //vec[3] = 1.0f;
glLightfv((GLenum)(GL_LIGHT0+slot), GL_POSITION, vec);
- glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0);
+ glLightf((GLenum)(GL_LIGHT0+slot), GL_CONSTANT_ATTENUATION, 1.0f);
glLightf((GLenum)(GL_LIGHT0+slot), GL_LINEAR_ATTENUATION, m_att1/m_distance);
// without this next line it looks backward compatible.
//attennuation still is acceptable
@@ -124,30 +124,30 @@ bool RAS_OpenGLLight::ApplyFixedFunctionLighting(KX_Scene *kxscene, int oblayer,
glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_EXPONENT, 128.0f * m_spotblend);
}
else {
- glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0);
+ glLightf((GLenum)(GL_LIGHT0+slot), GL_SPOT_CUTOFF, 180.0f);
}
}
if (m_nodiffuse) {
- vec[0] = vec[1] = vec[2] = vec[3] = 0.0;
+ vec[0] = vec[1] = vec[2] = vec[3] = 0.0f;
}
else {
vec[0] = m_energy*m_color[0];
vec[1] = m_energy*m_color[1];
vec[2] = m_energy*m_color[2];
- vec[3] = 1.0;
+ vec[3] = 1.0f;
}
glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec);
if (m_nospecular)
{
- vec[0] = vec[1] = vec[2] = vec[3] = 0.0;
+ vec[0] = vec[1] = vec[2] = vec[3] = 0.0f;
}
else if (m_nodiffuse) {
vec[0] = m_energy*m_color[0];
vec[1] = m_energy*m_color[1];
vec[2] = m_energy*m_color[2];
- vec[3] = 1.0;
+ vec[3] = 1.0f;
}
glLightfv((GLenum)(GL_LIGHT0+slot), GL_SPECULAR, vec);
@@ -262,7 +262,7 @@ void RAS_OpenGLLight::Update()
// lights don't get their openGL matrix updated, do it now
if (kxlight->GetSGNode()->IsDirty())
kxlight->GetOpenGLMatrix();
- double *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer();
+ float *dobmat = kxlight->GetOpenGLMatrixPtr()->getPointer();
for (int i=0; i<4; i++)
for (int j=0; j<4; j++, dobmat++)
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 28545576f05..1589bc7efa2 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -47,15 +47,17 @@
#include "RAS_OpenGLLight.h"
-#include "RAS_StorageIM.h"
#include "RAS_StorageVA.h"
#include "RAS_StorageVBO.h"
#include "GPU_draw.h"
+#include "GPU_extensions.h"
#include "GPU_material.h"
+#include "GPU_shader.h"
extern "C"{
#include "BLF_api.h"
+ #include "BKE_DerivedMesh.h"
}
@@ -83,21 +85,21 @@ static GLuint right_eye_vinterlace_mask[32];
*/
static GLuint hinterlace_mask[33];
-RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, int storage)
+RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE storage)
:RAS_IRasterizer(canvas),
m_2DCanvas(canvas),
m_fogenabled(false),
- m_time(0.0),
+ m_time(0.0f),
m_campos(0.0f, 0.0f, 0.0f),
m_camortho(false),
m_stereomode(RAS_STEREO_NOSTEREO),
m_curreye(RAS_STEREO_LEFTEYE),
- m_eyeseparation(0.0),
- m_focallength(0.0),
+ m_eyeseparation(0.0f),
+ m_focallength(0.0f),
m_setfocallength(false),
m_noOfScanlines(32),
m_motionblur(0),
- m_motionblurvalue(-1.0),
+ m_motionblurvalue(-1.0f),
m_usingoverrideshader(false),
m_clientobject(NULL),
m_auxilaryClientInfo(NULL),
@@ -122,27 +124,22 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, int storage)
m_prevafvalue = GPU_get_anisotropic();
- if (m_storage_type == RAS_VBO /*|| m_storage_type == RAS_AUTO_STORAGE && GLEW_ARB_vertex_buffer_object*/)
- {
+ if (m_storage_type == RAS_VBO /*|| m_storage_type == RAS_AUTO_STORAGE && GLEW_ARB_vertex_buffer_object*/) {
m_storage = new RAS_StorageVBO(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
- m_failsafe_storage = new RAS_StorageIM(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
- m_storage_type = RAS_VBO;
}
- else if ((m_storage_type == RAS_VA) || (m_storage_type == RAS_AUTO_STORAGE && GLEW_VERSION_1_1))
- {
+ else if ((m_storage_type == RAS_VA) || (m_storage_type == RAS_AUTO_STORAGE)) {
m_storage = new RAS_StorageVA(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
- m_failsafe_storage = new RAS_StorageIM(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
- m_storage_type = RAS_VA;
}
- else
- {
- m_storage = m_failsafe_storage = new RAS_StorageIM(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
- m_storage_type = RAS_IMMEDIATE;
+ else {
+ printf("Unknown rasterizer storage type, falling back to vertex arrays\n");
+ m_storage = new RAS_StorageVA(&m_texco_num, m_texco, &m_attrib_num, m_attrib, m_attrib_layer);
}
glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights);
if (m_numgllights < 8)
m_numgllights = 8;
+
+ PrintHardwareInfo();
}
@@ -151,8 +148,6 @@ RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer()
{
// Restore the previous AF value
GPU_set_anisotropic(m_prevafvalue);
- if (m_failsafe_storage && m_failsafe_storage != m_storage)
- delete m_failsafe_storage;
if (m_storage)
delete m_storage;
@@ -176,10 +171,10 @@ bool RAS_OpenGLRasterizer::Init()
glFrontFace(GL_CCW);
m_last_frontface = true;
- m_redback = 0.4375;
- m_greenback = 0.4375;
- m_blueback = 0.4375;
- m_alphaback = 0.0;
+ m_redback = 0.4375f;
+ m_greenback = 0.4375f;
+ m_blueback = 0.4375f;
+ m_alphaback = 0.0f;
glClearColor(m_redback,m_greenback,m_blueback,m_alphaback);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -254,7 +249,7 @@ void RAS_OpenGLRasterizer::Exit()
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
- glClearDepth(1.0);
+ glClearDepth(1.0f);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(m_redback, m_greenback, m_blueback, m_alphaback);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -321,9 +316,6 @@ void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode)
glDisable(GL_CULL_FACE);
m_storage->SetDrawingMode(drawingmode);
- if (m_failsafe_storage && m_failsafe_storage != m_storage) {
- m_failsafe_storage->SetDrawingMode(drawingmode);
- }
}
int RAS_OpenGLRasterizer::GetDrawingMode()
@@ -379,8 +371,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene)
glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f);
const MT_Scalar *fromPtr = &debugShapes[i].m_pos.x();
const MT_Scalar *toPtr= &debugShapes[i].m_param.x();
- glVertex3dv(fromPtr);
- glVertex3dv(toPtr);
+ glVertex3fv(fromPtr);
+ glVertex3fv(toPtr);
}
glEnd();
@@ -391,7 +383,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene)
glBegin(GL_LINE_LOOP);
glColor4f(debugShapes[i].m_color[0], debugShapes[i].m_color[1], debugShapes[i].m_color[2], 1.0f);
- static const MT_Vector3 worldUp(0.0, 0.0, 1.0);
+ static const MT_Vector3 worldUp(0.0f, 0.0f, 1.0f);
MT_Vector3 norm = debugShapes[i].m_param;
MT_Matrix3x3 tr;
if (norm.fuzzyZero() || norm == worldUp)
@@ -411,12 +403,12 @@ void RAS_OpenGLRasterizer::FlushDebugShapes(SCA_IScene *scene)
int n = (int)debugShapes[i].m_param2.y();
for (int j = 0; j<n; j++)
{
- MT_Scalar theta = j*M_PI*2/n;
- MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0);
+ MT_Scalar theta = j*(float)M_PI*2/n;
+ MT_Vector3 pos(cosf(theta) * rad, sinf(theta) * rad, 0.0f);
pos = pos*tr;
pos += debugShapes[i].m_pos;
const MT_Scalar* posPtr = &pos.x();
- glVertex3dv(posPtr);
+ glVertex3fv(posPtr);
}
glEnd();
}
@@ -554,13 +546,15 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye)
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
}
else {
- //glAccum(GL_LOAD, 1.0);
+ //glAccum(GL_LOAD, 1.0f);
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
ClearDepthBuffer();
}
break;
case RAS_STEREO_VINTERLACE:
{
+ // OpenGL stippling is deprecated, it is no longer possible to affect all shaders
+ // this way, offscreen rendering and then compositing may be the better solution
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple((const GLubyte*) ((m_curreye == RAS_STEREO_LEFTEYE) ? left_eye_vinterlace_mask : right_eye_vinterlace_mask));
if (m_curreye == RAS_STEREO_RIGHTEYE)
@@ -735,38 +729,118 @@ void RAS_OpenGLRasterizer::SetAttrib(TexCoGen coords, int unit, int layer)
void RAS_OpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
{
if (ms.m_pDerivedMesh)
- m_failsafe_storage->IndexPrimitives(ms);
+ DrawDerivedMesh(ms);
else
m_storage->IndexPrimitives(ms);
}
-void RAS_OpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
+// Code for hooking into Blender's mesh drawing for derived meshes.
+// If/when we use more of Blender's drawing code, we may be able to
+// clean this up
+static bool current_wireframe;
+static RAS_MaterialBucket *current_bucket;
+static RAS_IPolyMaterial *current_polymat;
+static RAS_MeshSlot *current_ms;
+static RAS_MeshObject *current_mesh;
+static int current_blmat_nr;
+static GPUVertexAttribs current_gpu_attribs;
+static Image *current_image;
+static int CheckMaterialDM(int matnr, void *attribs)
+{
+ // only draw the current material
+ if (matnr != current_blmat_nr)
+ return 0;
+ GPUVertexAttribs *gattribs = (GPUVertexAttribs *)attribs;
+ if (gattribs)
+ memcpy(gattribs, &current_gpu_attribs, sizeof(GPUVertexAttribs));
+ return 1;
+}
+
+static DMDrawOption CheckTexDM(MTexPoly *mtexpoly, const bool has_mcol, int matnr)
+{
+
+ // index is the original face index, retrieve the polygon
+ if (matnr == current_blmat_nr &&
+ (mtexpoly == NULL || mtexpoly->tpage == current_image)) {
+ // must handle color.
+ if (current_wireframe)
+ return DM_DRAW_OPTION_NO_MCOL;
+ if (current_ms->m_bObjectColor) {
+ MT_Vector4& rgba = current_ms->m_RGBAcolor;
+ glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
+ // don't use mcol
+ return DM_DRAW_OPTION_NO_MCOL;
+ }
+ if (!has_mcol) {
+ // we have to set the color from the material
+ unsigned char rgba[4];
+ current_polymat->GetMaterialRGBAColor(rgba);
+ glColor4ubv((const GLubyte *)rgba);
+ return DM_DRAW_OPTION_NORMAL;
+ }
+ return DM_DRAW_OPTION_NORMAL;
+ }
+ return DM_DRAW_OPTION_SKIP;
+}
+
+void RAS_OpenGLRasterizer::DrawDerivedMesh(class RAS_MeshSlot &ms)
{
- if (ms.m_pDerivedMesh)
- m_failsafe_storage->IndexPrimitivesMulti(ms);
+ // mesh data is in derived mesh,
+ current_bucket = ms.m_bucket;
+ current_polymat = current_bucket->GetPolyMaterial();
+ current_ms = &ms;
+ current_mesh = ms.m_mesh;
+ current_wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME;
+ // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */
+
+ // handle two-side
+ if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_BACKCULL)
+ this->SetCullFace(true);
else
- m_storage->IndexPrimitivesMulti(ms);
+ this->SetCullFace(false);
+
+ if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
+ // GetMaterialIndex return the original mface material index,
+ // increment by 1 to match what derived mesh is doing
+ current_blmat_nr = current_polymat->GetMaterialIndex()+1;
+ // For GLSL we need to retrieve the GPU material attribute
+ Material* blmat = current_polymat->GetBlenderMaterial();
+ Scene* blscene = current_polymat->GetBlenderScene();
+ if (!current_wireframe && blscene && blmat)
+ GPU_material_vertex_attributes(GPU_material_from_blender(blscene, blmat, false), &current_gpu_attribs);
+ else
+ memset(&current_gpu_attribs, 0, sizeof(current_gpu_attribs));
+ // DM draw can mess up blending mode, restore at the end
+ int current_blend_mode = GPU_get_material_alpha_blend();
+ ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
+ GPU_set_material_alpha_blend(current_blend_mode);
+ } else {
+ //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
+ current_blmat_nr = current_polymat->GetMaterialIndex();
+ current_image = current_polymat->GetBlenderImage();
+ ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM, NULL, NULL, DM_DRAW_USE_ACTIVE_UV);
+ }
}
void RAS_OpenGLRasterizer::SetProjectionMatrix(MT_CmMatrix4x4 &mat)
{
glMatrixMode(GL_PROJECTION);
- double* matrix = &mat(0, 0);
- glLoadMatrixd(matrix);
+ float* matrix = &mat(0, 0);
+ glLoadMatrixf(matrix);
- m_camortho = (mat(3, 3) != 0.0);
+ m_camortho = (mat(3, 3) != 0.0f);
}
void RAS_OpenGLRasterizer::SetProjectionMatrix(const MT_Matrix4x4 & mat)
{
glMatrixMode(GL_PROJECTION);
- double matrix[16];
+ float matrix[16];
/* Get into argument. Looks a bit dodgy, but it's ok. */
mat.getValue(matrix);
/* Internally, MT_Matrix4x4 uses doubles (MT_Scalar). */
- glLoadMatrixd(matrix);
+ glLoadMatrixf(matrix);
- m_camortho= (mat[3][3] != 0.0);
+ m_camortho= (mat[3][3] != 0.0f);
}
MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
@@ -780,7 +854,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
bool
) {
MT_Matrix4x4 result;
- double mat[16];
+ float mat[16];
// correction for stereo
if (Stereo())
@@ -819,7 +893,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
glLoadIdentity();
glFrustum(left, right, bottom, top, frustnear, frustfar);
- glGetDoublev(GL_PROJECTION_MATRIX, mat);
+ glGetFloatv(GL_PROJECTION_MATRIX, mat);
result.setValue(mat);
return result;
@@ -834,14 +908,14 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix(
float frustfar
) {
MT_Matrix4x4 result;
- double mat[16];
+ float mat[16];
// stereo is meaning less for orthographic, disable it
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(left, right, bottom, top, frustnear, frustfar);
- glGetDoublev(GL_PROJECTION_MATRIX, mat);
+ glGetFloatv(GL_PROJECTION_MATRIX, mat);
result.setValue(mat);
return result;
@@ -859,8 +933,8 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
// correction for stereo
if (Stereo() && perspective)
{
- MT_Vector3 unitViewDir(0.0, -1.0, 0.0); // minus y direction, Blender convention
- MT_Vector3 unitViewupVec(0.0, 0.0, 1.0);
+ MT_Vector3 unitViewDir(0.0f, -1.0f, 0.0f); // minus y direction, Blender convention
+ MT_Vector3 unitViewupVec(0.0f, 0.0f, 1.0f);
MT_Vector3 viewDir, viewupVec;
MT_Vector3 eyeline;
@@ -878,7 +952,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
// translate to left by half the eye distance
MT_Transform transform;
transform.setIdentity();
- transform.translate(-(eyeline * m_eyeseparation / 2.0));
+ transform.translate(-(eyeline * m_eyeseparation / 2.0f));
m_viewmatrix *= transform;
}
break;
@@ -887,7 +961,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
// translate to right by half the eye distance
MT_Transform transform;
transform.setIdentity();
- transform.translate(eyeline * m_eyeseparation / 2.0);
+ transform.translate(eyeline * m_eyeseparation / 2.0f);
m_viewmatrix *= transform;
}
break;
@@ -902,7 +976,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
m_viewmatrix.getValue(glviewmat);
glMatrixMode(GL_MODELVIEW);
- glLoadMatrixd(glviewmat);
+ glLoadMatrixf(glviewmat);
m_campos = pos;
}
@@ -994,7 +1068,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue)
void RAS_OpenGLRasterizer::DisableMotionBlur()
{
m_motionblur = 0;
- m_motionblurvalue = -1.0;
+ m_motionblurvalue = -1.0f;
}
void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
@@ -1215,7 +1289,7 @@ void RAS_OpenGLRasterizer::RemoveLight(RAS_ILightObject* lightobject)
m_lights.erase(lit);
}
-bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, double *oglmatrix)
+bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast *result, float *oglmatrix)
{
if (result->m_hitMesh) {
@@ -1229,14 +1303,14 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast
left = (dir.cross(resultnormal)).safe_normalized();
// for the up vector, we take the 'resultnormal' returned by the physics
- double maat[16] = {left[0], left[1], left[2], 0,
+ float maat[16] = {left[0], left[1], left[2], 0,
dir[0], dir[1], dir[2], 0,
resultnormal[0], resultnormal[1], resultnormal[2], 0,
0, 0, 0, 1};
- glTranslated(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
+ glTranslatef(oglmatrix[12],oglmatrix[13],oglmatrix[14]);
//glMultMatrixd(oglmatrix);
- glMultMatrixd(maat);
+ glMultMatrixf(maat);
return true;
}
else {
@@ -1244,7 +1318,7 @@ bool RAS_OpenGLRasterizer::RayHit(struct KX_ClientObjectInfo *client, KX_RayCast
}
}
-void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
+void RAS_OpenGLRasterizer::applyTransform(float* oglmatrix,int objectdrawmode )
{
/* FIXME:
blender: intern/moto/include/MT_Vector3.inl:42: MT_Vector3 operator/(const
@@ -1265,14 +1339,14 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
//page 360/361 3D Game Engine Design, David Eberly for a discussion
// on screen aligned and axis aligned billboards
// assumed is that the preprocessor transformed all billboard polygons
- // so that their normal points into the positive x direction (1.0, 0.0, 0.0)
+ // so that their normal points into the positive x direction (1.0f, 0.0f, 0.0f)
// when new parenting for objects is done, this rotation
// will be moved into the object
MT_Point3 objpos (oglmatrix[12],oglmatrix[13],oglmatrix[14]);
MT_Point3 campos = GetCameraPosition();
MT_Vector3 dir = (campos - objpos).safe_normalized();
- MT_Vector3 up(0,0,1.0);
+ MT_Vector3 up(0,0,1.0f);
KX_GameObject* gameobj = (KX_GameObject*)m_clientobject;
// get scaling of halo object
@@ -1297,13 +1371,13 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
dir *= size[1];
up *= size[2];
- double maat[16] = {left[0], left[1], left[2], 0,
+ float maat[16] = {left[0], left[1], left[2], 0,
dir[0], dir[1], dir[2], 0,
up[0], up[1], up[2], 0,
0, 0, 0, 1};
glTranslatef(objpos[0],objpos[1],objpos[2]);
- glMultMatrixd(maat);
+ glMultMatrixf(maat);
}
else {
@@ -1327,11 +1401,11 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
if (!physics_controller && parent)
physics_controller = parent->GetPhysicsController();
- KX_RayCast::Callback<RAS_OpenGLRasterizer, double> callback(this, physics_controller, oglmatrix);
+ KX_RayCast::Callback<RAS_OpenGLRasterizer, float> callback(this, physics_controller, oglmatrix);
if (!KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback))
{
// couldn't find something to cast the shadow on...
- glMultMatrixd(oglmatrix);
+ glMultMatrixf(oglmatrix);
}
else
{ // we found the "ground", but the cast matrix doesn't take
@@ -1343,7 +1417,7 @@ void RAS_OpenGLRasterizer::applyTransform(double* oglmatrix,int objectdrawmode )
{
// 'normal' object
- glMultMatrixd(oglmatrix);
+ glMultMatrixf(oglmatrix);
}
}
}
@@ -1432,7 +1506,7 @@ void RAS_OpenGLRasterizer::RenderBox2D(int xco,
void RAS_OpenGLRasterizer::RenderText3D(
int fontid, const char *text, int size, int dpi,
- const float color[4], const double mat[16], float aspect)
+ const float color[4], const float mat[16], float aspect)
{
/* gl prepping */
DisableForText();
@@ -1519,13 +1593,13 @@ void RAS_OpenGLRasterizer::MotionBlur()
if (state==1)
{
//bugfix:load color buffer into accum buffer for the first time(state=1)
- glAccum(GL_LOAD, 1.0);
+ glAccum(GL_LOAD, 1.0f);
SetMotionBlurState(2);
}
else if (motionblurvalue >= 0.0f && motionblurvalue <= 1.0f) {
glAccum(GL_MULT, motionblurvalue);
glAccum(GL_ACCUM, 1-motionblurvalue);
- glAccum(GL_RETURN, 1.0);
+ glAccum(GL_RETURN, 1.0f);
glFlush();
}
}
@@ -1547,3 +1621,68 @@ void RAS_OpenGLRasterizer::SetAuxilaryClientInfo(void* inf)
m_auxilaryClientInfo = inf;
}
+void RAS_OpenGLRasterizer::PrintHardwareInfo()
+{
+ #define pprint(x) std::cout << x << std::endl;
+
+ pprint("GL_VENDOR: " << glGetString(GL_VENDOR));
+ pprint("GL_RENDERER: " << glGetString(GL_RENDERER));
+ pprint("GL_VERSION: " << glGetString(GL_VERSION));
+ bool support=0;
+ pprint("Supported Extensions...");
+ pprint(" GL_ARB_shader_objects supported? "<< (GLEW_ARB_shader_objects?"yes.":"no."));
+
+ support= GLEW_ARB_vertex_shader;
+ pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no."));
+ if (support) {
+ pprint(" ----------Details----------");
+ int max=0;
+ glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
+ pprint(" Max uniform components." << max);
+
+ glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, (GLint*)&max);
+ pprint(" Max varying floats." << max);
+
+ glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max);
+ pprint(" Max vertex texture units." << max);
+
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max);
+ pprint(" Max combined texture units." << max);
+ pprint("");
+ }
+
+ support=GLEW_ARB_fragment_shader;
+ pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no."));
+ if (support) {
+ pprint(" ----------Details----------");
+ int max=0;
+ glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
+ pprint(" Max uniform components." << max);
+ pprint("");
+ }
+
+ support = GLEW_ARB_texture_cube_map;
+ pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no."));
+ if (support) {
+ pprint(" ----------Details----------");
+ int size=0;
+ glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size);
+ pprint(" Max cubemap size." << size);
+ pprint("");
+ }
+
+ support = GLEW_ARB_multitexture;
+ pprint(" GL_ARB_multitexture supported? "<< (support?"yes.":"no."));
+ if (support) {
+ pprint(" ----------Details----------");
+ int units=0;
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units);
+ pprint(" Max texture units available. " << units);
+ pprint("");
+ }
+
+ pprint(" GL_ARB_texture_env_combine supported? "<< (GLEW_ARB_texture_env_combine?"yes.":"no."));
+
+ pprint(" GL_ARB_texture_non_power_of_two supported " << (GPU_full_non_power_of_two_support()?"yes.":"no."));
+}
+
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index 67a11f64726..4c22d1de611 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -56,7 +56,6 @@ class RAS_OpenGLLight;
enum RAS_STORAGE_TYPE {
RAS_AUTO_STORAGE,
- RAS_IMMEDIATE,
RAS_VA,
RAS_VBO,
};
@@ -139,11 +138,10 @@ protected:
* Examples of concrete strategies: Vertex Arrays, VBOs, Immediate Mode*/
int m_storage_type;
RAS_IStorage *m_storage;
- RAS_IStorage *m_failsafe_storage; /* So derived mesh can use immediate mode */
public:
double GetTime();
- RAS_OpenGLRasterizer(RAS_ICanvas *canv, int storage=RAS_AUTO_STORAGE);
+ RAS_OpenGLRasterizer(RAS_ICanvas *canv, RAS_STORAGE_TYPE storage);
virtual ~RAS_OpenGLRasterizer();
/*enum DrawType
@@ -186,8 +184,8 @@ public:
virtual void SwapBuffers();
virtual void IndexPrimitives(class RAS_MeshSlot &ms);
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot &ms);
virtual void IndexPrimitives_3DText(class RAS_MeshSlot &ms, class RAS_IPolyMaterial *polymat);
+ virtual void DrawDerivedMesh(class RAS_MeshSlot &ms);
virtual void SetProjectionMatrix(MT_CmMatrix4x4 &mat);
virtual void SetProjectionMatrix(const MT_Matrix4x4 &mat);
@@ -299,17 +297,17 @@ public:
void RenderBox2D(int xco, int yco, int width, int height, float percentage);
void RenderText3D(int fontid, const char *text, int size, int dpi,
- const float color[4], const double mat[16], float aspect);
+ const float color[4], const float mat[16], float aspect);
void RenderText2D(RAS_TEXT_RENDER_MODE mode, const char *text,
int xco, int yco, int width, int height);
- void applyTransform(double *oglmatrix, int objectdrawmode);
+ void applyTransform(float *oglmatrix, int objectdrawmode);
void PushMatrix();
void PopMatrix();
/// \see KX_RayCast
- bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, double *oglmatrix);
+ bool RayHit(struct KX_ClientObjectInfo *client, class KX_RayCast *result, float *oglmatrix);
/// \see KX_RayCast
bool NeedRayCast(struct KX_ClientObjectInfo *, void *UNUSED(data)) { return true; }
@@ -325,6 +323,10 @@ public:
void SetAuxilaryClientInfo(void *inf);
+ /**
+ * Prints information about what the hardware supports.
+ */
+ virtual void PrintHardwareInfo();
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_OpenGLRasterizer")
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
deleted file mode 100644
index 8cdc1b77f61..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * ***** BEGIN GPL 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.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 LICENSE BLOCK *****
- */
-
-#include "RAS_StorageIM.h"
-#include "RAS_MaterialBucket.h"
-#include "RAS_IPolygonMaterial.h"
-
-#include "glew-mx.h"
-#include "GPU_draw.h"
-#include "GPU_extensions.h"
-#include "GPU_material.h"
-
-extern "C"{
- #include "BKE_DerivedMesh.h"
-}
-
-RAS_StorageIM::RAS_StorageIM(int *texco_num, RAS_IRasterizer::TexCoGen *texco, int *attrib_num, RAS_IRasterizer::TexCoGen *attrib, int *attrib_layer) :
- m_drawingmode(RAS_IRasterizer::KX_TEXTURED),
- m_texco_num(texco_num),
- m_attrib_num(attrib_num),
- m_texco(texco),
- m_attrib(attrib),
- m_attrib_layer(attrib_layer)
-{
-}
-RAS_StorageIM::~RAS_StorageIM()
-{
-}
-
-bool RAS_StorageIM::Init()
-{
- return true;
-}
-void RAS_StorageIM::Exit()
-{
-}
-
-void RAS_StorageIM::IndexPrimitives(RAS_MeshSlot& ms)
-{
- IndexPrimitivesInternal(ms, false);
-}
-
-void RAS_StorageIM::IndexPrimitivesMulti(class RAS_MeshSlot& ms)
-{
- IndexPrimitivesInternal(ms, true);
-}
-
-void RAS_StorageIM::TexCoord(const RAS_TexVert &tv)
-{
- int unit;
-
- if (GLEW_ARB_multitexture) {
- for (unit = 0; unit < *m_texco_num; unit++) {
- switch (m_texco[unit]) {
- case RAS_IRasterizer::RAS_TEXCO_ORCO:
- case RAS_IRasterizer::RAS_TEXCO_GLOB:
- glMultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, tv.getXYZ());
- break;
- case RAS_IRasterizer::RAS_TEXCO_UV:
- glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + unit, tv.getUV(unit));
- break;
- case RAS_IRasterizer::RAS_TEXCO_NORM:
- glMultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, tv.getNormal());
- break;
- case RAS_IRasterizer::RAS_TEXTANGENT:
- glMultiTexCoord4fvARB(GL_TEXTURE0_ARB + unit, tv.getTangent());
- break;
- default:
- break;
- }
- }
- }
-
- if (GLEW_ARB_vertex_program) {
- for (unit = 0; unit < *m_attrib_num; unit++) {
- switch (m_attrib[unit]) {
- case RAS_IRasterizer::RAS_TEXCO_ORCO:
- case RAS_IRasterizer::RAS_TEXCO_GLOB:
- glVertexAttrib3fvARB(unit, tv.getXYZ());
- break;
- case RAS_IRasterizer::RAS_TEXCO_UV:
- glVertexAttrib2fvARB(unit, tv.getUV(m_attrib_layer[unit]));
- break;
- case RAS_IRasterizer::RAS_TEXCO_NORM:
- glVertexAttrib3fvARB(unit, tv.getNormal());
- break;
- case RAS_IRasterizer::RAS_TEXTANGENT:
- glVertexAttrib4fvARB(unit, tv.getTangent());
- break;
- case RAS_IRasterizer::RAS_TEXCO_VCOL:
- glVertexAttrib4ubvARB(unit, tv.getRGBA());
- break;
- default:
- break;
- }
- }
- }
-
-}
-
-void RAS_StorageIM::SetCullFace(bool enable)
-{
- if (enable)
- glEnable(GL_CULL_FACE);
- else
- glDisable(GL_CULL_FACE);
-}
-
-static bool current_wireframe;
-static RAS_MaterialBucket *current_bucket;
-static RAS_IPolyMaterial *current_polymat;
-static RAS_MeshSlot *current_ms;
-static RAS_MeshObject *current_mesh;
-static int current_blmat_nr;
-static GPUVertexAttribs current_gpu_attribs;
-static Image *current_image;
-static int CheckMaterialDM(int matnr, void *attribs)
-{
- // only draw the current material
- if (matnr != current_blmat_nr)
- return 0;
- GPUVertexAttribs *gattribs = (GPUVertexAttribs *)attribs;
- if (gattribs)
- memcpy(gattribs, &current_gpu_attribs, sizeof(GPUVertexAttribs));
- return 1;
-}
-
-/*
-static int CheckTexfaceDM(void *mcol, int index)
-{
-
- // index is the original face index, retrieve the polygon
- RAS_Polygon* polygon = (index >= 0 && index < current_mesh->NumPolygons()) ?
- current_mesh->GetPolygon(index) : NULL;
- if (polygon && polygon->GetMaterial() == current_bucket) {
- // must handle color.
- if (current_wireframe)
- return 2;
- if (current_ms->m_bObjectColor) {
- MT_Vector4& rgba = current_ms->m_RGBAcolor;
- glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
- // don't use mcol
- return 2;
- }
- if (!mcol) {
- // we have to set the color from the material
- unsigned char rgba[4];
- current_polymat->GetMaterialRGBAColor(rgba);
- glColor4ubv((const GLubyte *)rgba);
- return 2;
- }
- return 1;
- }
- return 0;
-}
-*/
-
-static DMDrawOption CheckTexDM(MTexPoly *mtexpoly, const bool has_mcol, int matnr)
-{
-
- // index is the original face index, retrieve the polygon
- if (matnr == current_blmat_nr &&
- (mtexpoly == NULL || mtexpoly->tpage == current_image)) {
- // must handle color.
- if (current_wireframe)
- return DM_DRAW_OPTION_NO_MCOL;
- if (current_ms->m_bObjectColor) {
- MT_Vector4& rgba = current_ms->m_RGBAcolor;
- glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
- // don't use mcol
- return DM_DRAW_OPTION_NO_MCOL;
- }
- if (!has_mcol) {
- // we have to set the color from the material
- unsigned char rgba[4];
- current_polymat->GetMaterialRGBAColor(rgba);
- glColor4ubv((const GLubyte *)rgba);
- return DM_DRAW_OPTION_NO_MCOL;
- }
- return DM_DRAW_OPTION_NORMAL;
- }
- return DM_DRAW_OPTION_SKIP;
-}
-
-void RAS_StorageIM::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
-{
- bool obcolor = ms.m_bObjectColor;
- bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME;
- MT_Vector4& rgba = ms.m_RGBAcolor;
- RAS_MeshSlot::iterator it;
-
- if (ms.m_pDerivedMesh) {
- // mesh data is in derived mesh,
- current_bucket = ms.m_bucket;
- current_polymat = current_bucket->GetPolyMaterial();
- current_ms = &ms;
- current_mesh = ms.m_mesh;
- current_wireframe = wireframe;
- // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */
-
- // handle two-side
- if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_BACKCULL)
- this->SetCullFace(true);
- else
- this->SetCullFace(false);
-
- if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
- // GetMaterialIndex return the original mface material index,
- // increment by 1 to match what derived mesh is doing
- current_blmat_nr = current_polymat->GetMaterialIndex()+1;
- // For GLSL we need to retrieve the GPU material attribute
- Material* blmat = current_polymat->GetBlenderMaterial();
- Scene* blscene = current_polymat->GetBlenderScene();
- if (!wireframe && blscene && blmat)
- GPU_material_vertex_attributes(GPU_material_from_blender(blscene, blmat, false, false), &current_gpu_attribs);
- else
- memset(&current_gpu_attribs, 0, sizeof(current_gpu_attribs));
- // DM draw can mess up blending mode, restore at the end
- int current_blend_mode = GPU_get_material_alpha_blend();
- ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
- GPU_set_material_alpha_blend(current_blend_mode);
- } else {
- //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
- current_blmat_nr = current_polymat->GetMaterialIndex();
- current_image = current_polymat->GetBlenderImage();
- ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM, NULL, NULL, DM_DRAW_USE_ACTIVE_UV);
- }
- return;
- }
- // iterate over display arrays, each containing an index + vertex array
- for (ms.begin(it); !ms.end(it); ms.next(it)) {
- RAS_TexVert *vertex;
- size_t i, j, numvert;
-
- numvert = it.array->m_type;
-
- if (it.array->m_type == RAS_DisplayArray::LINE) {
- // line drawing
- glBegin(GL_LINES);
-
- for (i = 0; i < it.totindex; i += 2)
- {
- vertex = &it.vertex[it.index[i]];
- glVertex3fv(vertex->getXYZ());
-
- vertex = &it.vertex[it.index[i+1]];
- glVertex3fv(vertex->getXYZ());
- }
-
- glEnd();
- }
- else {
- // triangle and quad drawing
- if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
- glBegin(GL_TRIANGLES);
- else
- glBegin(GL_QUADS);
-
- for (i = 0; i < it.totindex; i += numvert)
- {
- if (obcolor)
- glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
-
- for (j = 0; j < numvert; j++) {
- vertex = &it.vertex[it.index[i+j]];
-
- if (!wireframe) {
- if (!obcolor)
- glColor4ubv((const GLubyte *)(vertex->getRGBA()));
-
- glNormal3fv(vertex->getNormal());
-
- if (multi)
- TexCoord(*vertex);
- else
- glTexCoord2fv(vertex->getUV(0));
- }
-
- glVertex3fv(vertex->getXYZ());
- }
- }
-
- glEnd();
- }
- }
-}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h
deleted file mode 100644
index 54ba2a57b61..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * ***** BEGIN GPL 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.
- *
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 LICENSE BLOCK *****
- */
-
-#ifndef __KX_IMMEDIATEMODESTORAGE
-#define __KX_IMMEDIATEMODESTORAGE
-
-#include "RAS_IStorage.h"
-#include "RAS_IRasterizer.h"
-
-class RAS_StorageIM : public RAS_IStorage
-{
-public:
- RAS_StorageIM(int *texco_num, RAS_IRasterizer::TexCoGen *texco, int *attrib_num, RAS_IRasterizer::TexCoGen *attrib, int *attrib_layer);
- virtual ~RAS_StorageIM();
-
- virtual bool Init();
- virtual void Exit();
-
- virtual void IndexPrimitives(RAS_MeshSlot& ms);
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms);
-
- virtual void SetDrawingMode(int drawingmode){m_drawingmode=drawingmode;};
-
-protected:
- int m_drawingmode;
- int* m_texco_num;
- int* m_attrib_num;
- RAS_IRasterizer::TexCoGen* m_texco;
- RAS_IRasterizer::TexCoGen* m_attrib;
- int* m_attrib_layer;
-
- void TexCoord(const RAS_TexVert &tv);
- void SetCullFace(bool enable);
-
- void IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi);
-
-
-#ifdef WITH_CXX_GUARDEDALLOC
-public:
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_StorageIM"); }
- void operator delete( void *mem ) { MEM_freeN(mem); }
-#endif
-};
-
-#endif //__KX_IMMEDIATEMODESTORAGE
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
index c2980a6c15f..cf77ebfbeb9 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
@@ -56,68 +56,7 @@ void RAS_StorageVA::Exit()
{
}
-void RAS_StorageVA::IndexPrimitives(RAS_MeshSlot& ms)
-{
- static const GLsizei stride = sizeof(RAS_TexVert);
- bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME;
- RAS_MeshSlot::iterator it;
- GLenum drawmode;
-
- if (!wireframe)
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
-
- // use glDrawElements to draw each vertexarray
- for (ms.begin(it); !ms.end(it); ms.next(it)) {
- if (it.totindex == 0)
- continue;
-
- // drawing mode
- if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
- drawmode = GL_TRIANGLES;
- else if (it.array->m_type == RAS_DisplayArray::QUAD)
- drawmode = GL_QUADS;
- else
- drawmode = GL_LINES;
-
- // colors
- if (drawmode != GL_LINES && !wireframe) {
- if (ms.m_bObjectColor) {
- const MT_Vector4& rgba = ms.m_RGBAcolor;
-
- glDisableClientState(GL_COLOR_ARRAY);
- glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
- }
- else {
- glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
- glEnableClientState(GL_COLOR_ARRAY);
- }
- }
- else
- glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
-
- glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ());
- glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal());
- if (!wireframe) {
- glTexCoordPointer(2, GL_FLOAT, stride, it.vertex->getUV(0));
- if (glIsEnabled(GL_COLOR_ARRAY))
- glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA());
- }
-
- // here the actual drawing takes places
- glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
- }
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
- if (!wireframe) {
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- }
-}
-
-void RAS_StorageVA::IndexPrimitivesMulti(class RAS_MeshSlot& ms)
+void RAS_StorageVA::IndexPrimitives(class RAS_MeshSlot& ms)
{
static const GLsizei stride = sizeof(RAS_TexVert);
bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME, use_color_array = true;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h
index e4d00310a11..34fdca23ee6 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h
@@ -44,7 +44,6 @@ public:
virtual void Exit();
virtual void IndexPrimitives(RAS_MeshSlot& ms);
- virtual void IndexPrimitivesMulti(class RAS_MeshSlot& ms);
virtual void SetDrawingMode(int drawingmode){m_drawingmode=drawingmode;};
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
index 58f3d4c05da..08d27cbc3fc 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
@@ -80,7 +80,7 @@ void VBO::UpdateIndices()
&data->m_index[0], GL_STATIC_DRAW);
}
-void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num, RAS_IRasterizer::TexCoGen* attrib, int *attrib_layer, bool multi)
+void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num, RAS_IRasterizer::TexCoGen* attrib, int *attrib_layer)
{
int unit;
@@ -100,41 +100,32 @@ void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num,
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, this->stride, this->color_offset);
- if (multi)
+ for (unit = 0; unit < texco_num; ++unit)
{
- for (unit = 0; unit < texco_num; ++unit)
- {
- glClientActiveTexture(GL_TEXTURE0_ARB + unit);
- switch (texco[unit]) {
- case RAS_IRasterizer::RAS_TEXCO_ORCO:
- case RAS_IRasterizer::RAS_TEXCO_GLOB:
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(3, GL_FLOAT, this->stride, this->vertex_offset);
- break;
- case RAS_IRasterizer::RAS_TEXCO_UV:
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, this->stride, (void*)((intptr_t)this->uv_offset+(sizeof(GLfloat)*2*unit)));
- break;
- case RAS_IRasterizer::RAS_TEXCO_NORM:
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(3, GL_FLOAT, this->stride, this->normal_offset);
- break;
- case RAS_IRasterizer::RAS_TEXTANGENT:
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(4, GL_FLOAT, this->stride, this->tangent_offset);
- break;
- default:
- break;
- }
+ glClientActiveTexture(GL_TEXTURE0_ARB + unit);
+ switch (texco[unit]) {
+ case RAS_IRasterizer::RAS_TEXCO_ORCO:
+ case RAS_IRasterizer::RAS_TEXCO_GLOB:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(3, GL_FLOAT, this->stride, this->vertex_offset);
+ break;
+ case RAS_IRasterizer::RAS_TEXCO_UV:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(2, GL_FLOAT, this->stride, (void*)((intptr_t)this->uv_offset+(sizeof(GLfloat)*2*unit)));
+ break;
+ case RAS_IRasterizer::RAS_TEXCO_NORM:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(3, GL_FLOAT, this->stride, this->normal_offset);
+ break;
+ case RAS_IRasterizer::RAS_TEXTANGENT:
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glTexCoordPointer(4, GL_FLOAT, this->stride, this->tangent_offset);
+ break;
+ default:
+ break;
}
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- else //TexFace
- {
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, this->stride, this->uv_offset);
}
+ glClientActiveTextureARB(GL_TEXTURE0_ARB);
if (GLEW_ARB_vertex_program)
{
@@ -163,7 +154,7 @@ void VBO::Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num,
}
}
}
-
+
glDrawElements(this->mode, this->indices, GL_UNSIGNED_SHORT, 0);
glDisableClientState(GL_VERTEX_ARRAY);
@@ -207,16 +198,6 @@ void RAS_StorageVBO::Exit()
void RAS_StorageVBO::IndexPrimitives(RAS_MeshSlot& ms)
{
- IndexPrimitivesInternal(ms, false);
-}
-
-void RAS_StorageVBO::IndexPrimitivesMulti(RAS_MeshSlot& ms)
-{
- IndexPrimitivesInternal(ms, true);
-}
-
-void RAS_StorageVBO::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
-{
RAS_MeshSlot::iterator it;
VBO *vbo;
@@ -233,6 +214,6 @@ void RAS_StorageVBO::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
vbo->UpdateData();
}
- vbo->Draw(*m_texco_num, m_texco, *m_attrib_num, m_attrib, m_attrib_layer, multi);
+ vbo->Draw(*m_texco_num, m_texco, *m_attrib_num, m_attrib, m_attrib_layer);
}
}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
index f156722247c..f78faa97b16 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
@@ -42,7 +42,7 @@ public:
VBO(RAS_DisplayArray *data, unsigned int indices);
~VBO();
- void Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num, RAS_IRasterizer::TexCoGen* attrib, int *attrib_layer, bool multi);
+ void Draw(int texco_num, RAS_IRasterizer::TexCoGen* texco, int attrib_num, RAS_IRasterizer::TexCoGen* attrib, int *attrib_layer);
void UpdateData();
void UpdateIndices();
@@ -73,7 +73,6 @@ public:
virtual void Exit();
virtual void IndexPrimitives(RAS_MeshSlot& ms);
- virtual void IndexPrimitivesMulti(RAS_MeshSlot& ms);
virtual void SetDrawingMode(int drawingmode){m_drawingmode=drawingmode;};
@@ -89,8 +88,6 @@ protected:
std::map<RAS_DisplayArray*, class VBO*> m_vbo_lookup;
- virtual void IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi);
-
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_StorageVA"); }
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
deleted file mode 100644
index ce520df2a21..00000000000
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = env.Glob('*.cpp')
-
-defs = []
-defs += env['BF_GL_DEFINITIONS']
-
-incs = [
- '.',
- '#intern/container',
- '#intern/guardedalloc',
- '#intern/string',
- env['BF_GLEW_INC'],
- '#/intern/glew-mx',
- '#intern/moto/include',
- '#source/blender/blenkernel',
- '#source/blender/blenfont',
- '#source/blender/blenlib',
- '#source/blender/gpu',
- '#source/blender/makesdna',
- '#source/gameengine/BlenderRoutines',
- '#source/gameengine/Expressions',
- '#source/gameengine/GameLogic',
- '#source/gameengine/Physics/common',
- '#source/gameengine/Rasterizer',
- '#source/gameengine/SceneGraph',
- '#source/gameengine/Ketsji',
- env['BF_OPENGL_INC'],
- ]
-incs = ' '.join(incs)
-
-if env['WITH_BF_CXX_GUARDEDALLOC']:
- defs.append('WITH_CXX_GUARDEDALLOC')
-
-if env['WITH_BF_PYTHON']:
- incs += ' ' + env['BF_PYTHON_INC']
- defs.append('WITH_PYTHON')
-
-env.BlenderLib ( 'ge_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS'])
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index e6edc064200..2e176360d61 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -66,10 +66,10 @@ const MT_Point3& RAS_TexVert::xyz()
void RAS_TexVert::SetRGBA(const MT_Vector4& rgba)
{
unsigned char *colp = (unsigned char*) &m_rgba;
- colp[0] = (unsigned char) (rgba[0] * 255.0);
- colp[1] = (unsigned char) (rgba[1] * 255.0);
- colp[2] = (unsigned char) (rgba[2] * 255.0);
- colp[3] = (unsigned char) (rgba[3] * 255.0);
+ colp[0] = (unsigned char) (rgba[0] * 255.0f);
+ colp[1] = (unsigned char) (rgba[1] * 255.0f);
+ colp[2] = (unsigned char) (rgba[2] * 255.0f);
+ colp[3] = (unsigned char) (rgba[3] * 255.0f);
}
@@ -153,12 +153,12 @@ unsigned int RAS_TexVert::getUnit() const
void RAS_TexVert::Transform(const MT_Matrix4x4& mat, const MT_Matrix4x4& nmat)
{
- SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0)).getValue());
- SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0)).getValue());
- SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0)).getValue());
+ SetXYZ((mat * MT_Vector4(m_localxyz[0], m_localxyz[1], m_localxyz[2], 1.0f)).getValue());
+ SetNormal((nmat * MT_Vector4(m_normal[0], m_normal[1], m_normal[2], 1.0f)).getValue());
+ SetTangent((nmat * MT_Vector4(m_tangent[0], m_tangent[1], m_tangent[2], 1.0f)).getValue());
}
void RAS_TexVert::TransformUV(int index, const MT_Matrix4x4& mat)
{
- SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0, 1.0)).getValue());
+ SetUV(index, (mat * MT_Vector4(m_uvs[index][0], m_uvs[index][1], 0.0f, 1.0f)).getValue());
}
diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript
deleted file mode 100644
index a29acda545a..00000000000
--- a/source/gameengine/Rasterizer/SConscript
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-#
-# ***** BEGIN GPL 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.
-#
-# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2006, Blender Foundation
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): Nathan Letwory.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-Import ('env')
-
-sources = env.Glob('*.cpp')
-
-incs = [
- '.',
- '#intern/guardedalloc',
- '#intern/string',
- '#intern/moto/include',
- '#intern/container',
- '#source/gameengine/BlenderRoutines',
- env['BF_GLEW_INC'],
- '#/intern/glew-mx',
- '#source/gameengine/Expressions',
- '#source/gameengine/SceneGraph',
- '#source/blender/blenlib',
- '#source/blender/blenkernel',
- '#source/blender/gpu',
- '#source/blender/makesdna',
- '#source/blender/imbuf',
- ]
-
-defs = []
-defs += env['BF_GL_DEFINITIONS']
-
-if env['WITH_BF_PYTHON']:
- incs.extend(Split(env['BF_PYTHON_INC']))
- defs.append('WITH_PYTHON')
-
-if env['WITH_BF_CXX_GUARDEDALLOC']:
- defs.append('WITH_CXX_GUARDEDALLOC')
-
-env.BlenderLib('ge_rasterizer', sources,
- includes=incs, defines=defs,
- libtype=['core', 'player'], priority=[350, 70],
- cxx_compileflags=env['BGE_CXXFLAGS'])