2011-02-22 10:33:14 +00:00
|
|
|
|
|
|
|
/** \file KX_BlenderMaterial.h
|
|
|
|
* \ingroup ketsji
|
|
|
|
*/
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
#ifndef __KX_BLENDER_MATERIAL_H__
|
|
|
|
#define __KX_BLENDER_MATERIAL_H__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
#include "RAS_IPolygonMaterial.h"
|
|
|
|
#include "BL_Material.h"
|
|
|
|
#include "BL_Texture.h"
|
|
|
|
#include "BL_Shader.h"
|
Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====
Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.
* According to the GLEW website it works on Windows, Linux, Mac OS X,
FreeBSD, Irix, and Solaris. There might still be platform specific
issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
regardless of the glext.h on the platform where compilation happens.
Game Engine
===========
Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.
The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.
For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.
* The game engine now also uses GLEW for extensions, replacing the
custom opengl extensions code that was there. Removes a lot of
#ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
work around a specific bug and only disabled multitexturing anyway.
It might also have caused a slowdown since it was retrieving the
environment variable for every vertex in immediate mode (bug #13680).
* Refactored the code to allow drawing skinned meshes with vertex
arrays too, removing some specific immediate mode drawing functions
for this that only did extra normal calculation. Now it always splits
vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
attributes for vertex arrays. These were not being enabled/disabled
correct according to the opengl spec, leading to crashes. Also tangent
attributes used an immediate mode call for vertex arrays, which can't
work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
|
|
|
#include "BL_BlenderShader.h"
|
2006-01-06 03:46:54 +00:00
|
|
|
|
|
|
|
#include "PyObjectPlus.h"
|
|
|
|
|
|
|
|
#include "MT_Vector3.h"
|
|
|
|
#include "MT_Vector4.h"
|
|
|
|
|
2009-08-18 15:37:31 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
#endif
|
|
|
|
|
2009-11-15 23:58:56 +00:00
|
|
|
#include "SCA_IScene.h" /* only for Replace_IScene */
|
|
|
|
#include "KX_Scene.h"
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
struct MTFace;
|
2006-01-06 03:46:54 +00:00
|
|
|
class KX_Scene;
|
|
|
|
|
|
|
|
class KX_BlenderMaterial : public PyObjectPlus, public RAS_IPolyMaterial
|
|
|
|
{
|
|
|
|
Py_Header;
|
|
|
|
public:
|
|
|
|
// --------------------------------
|
2009-06-28 11:22:26 +00:00
|
|
|
KX_BlenderMaterial();
|
2009-06-08 20:08:19 +00:00
|
|
|
void Initialize(
|
2006-02-13 05:45:32 +00:00
|
|
|
class KX_Scene* scene,
|
TexFace to Material Settings big patch
Summary:
========
The idea here is to move the texface options into the material panel.
For images with the change please visit:
http://code.blender.org/index.php/2011/09/bge-material-texface-changes
1 - Some of the legacy problems 2.49 and 2.5x has with the texface system:
==========================================================================
1.1) Shadow, Bilboard and Halo are mutual exclusive (in the code), yet you can
select a face to be more than one mode.
1.2) Sort only works for blend Alpha yet it's an option regardless of the
Transparency Blend you pick.
1.3) Shared doesn't affect anything in BGE.
1.4) ObColor only works for Text objects (old bitmap texts) when using Texture
Face Materials. (not address yet, I so far ignored obcolor)
2 - Notes:
============
2.1) Now "Use Face Textures" in material Option panel will work in Multitexture
even if there is no texture channel.
2.2) In FaceTexture mode it will use TexFace all the time, even if you don't
check the "Use Texture Face" option in the UI. It's a matter of decision, since
the code for either way is there. I decided by the solution that makes the
creation of a material fast - in this mode the user doesn't need to mess with
textures or this "Use Texture Face" option at all. I'm not strong in my opinion
here. But I think if we don't have this then what is the point of the Texture
Face mode?
2.3) I kept references for tface only when we need the image, UV or the tiling
setting. It should help later when/if we split the Image and UV layers from the
tface struct (Campbell and Brecht proposal).
3 - Changes in a Nutshell:
==========================
3.1) "Texture Face" panel (in the Mesh/Object Data panel) no longer exists. Those settings are all part of the material properties, visible when Game Render is set.
3.2) "Texture Face" Shading mode (in the Render panel) is now called “Single Texture”, it needs a material for special settings (e.g. Billboard, Alpha Sort, …).
3.3) New options in the Material Panel
* Shadeless option in the Material panel is now supported for all three Shading modes.
* Physics is now toggleable, this is the old Collision option.
* Two Side (on) is now called Back Culling (off).
* Alpha Sort is one of the Alpha options, together (and mutually exclusive) to Alpha Blend, Alpha Clip, Add and Opaque (i.e. solid).
* Shadow, Billboard and Halo are grouped in the “Face Orientation” property.
* "Face Textures" and "Face Textures Alpha" (under Options) can be used for all but GLSL shading mode (to be supported in GLSL eventually).
* The backend in the game engine is still the same as before. The only changes are in the interface and in the way you need to think your materials. The bottomline is: It’s no longer possible to share materials between faces that do not share the same game properties.
4 - Acknowledgment:
==================
Mike Pan for the design discussions, and testing along the whole development process.
Vitor Balbio for the first hands-on code with the interface changes. That helped me a lot to push me into work on that.
Benoit Bolsee and Brecht van Lommel for patch review (* no one reviewed the whole patch, or the latest iteractions, so I still hold liability for any problems).
Blender artists that gave feedback and helped testing the patch.
Patch review and original documentation can be found here:
http://wiki.blender.org/index.php/User:Dfelinto/TexFace
http://codereview.appspot.com/4289041/
2011-09-19 19:55:59 +00:00
|
|
|
BL_Material* mat,
|
|
|
|
GameSettings* game
|
2006-01-06 03:46:54 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
virtual ~KX_BlenderMaterial();
|
|
|
|
|
|
|
|
// --------------------------------
|
2006-02-13 05:45:32 +00:00
|
|
|
virtual TCachingInfo GetCachingInfo(void) const {
|
2006-01-06 03:46:54 +00:00
|
|
|
return (void*) this;
|
|
|
|
}
|
|
|
|
|
2006-02-13 05:45:32 +00:00
|
|
|
virtual
|
|
|
|
bool Activate(
|
2006-01-06 03:46:54 +00:00
|
|
|
RAS_IRasterizer* rasty,
|
2006-02-13 05:45:32 +00:00
|
|
|
TCachingInfo& cachingInfo
|
|
|
|
) const;
|
|
|
|
|
|
|
|
virtual
|
|
|
|
void ActivateMeshSlot(
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
const RAS_MeshSlot & ms,
|
2006-02-13 05:45:32 +00:00
|
|
|
RAS_IRasterizer* rasty
|
|
|
|
) const;
|
2006-01-06 03:46:54 +00:00
|
|
|
|
|
|
|
void ActivateMat(
|
2006-02-13 05:45:32 +00:00
|
|
|
RAS_IRasterizer* rasty,
|
|
|
|
TCachingInfo& cachingInfo
|
|
|
|
)const;
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
void ActivatShaders(
|
|
|
|
RAS_IRasterizer* rasty,
|
2006-02-13 05:45:32 +00:00
|
|
|
TCachingInfo& cachingInfo
|
|
|
|
)const;
|
|
|
|
|
Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====
Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.
* According to the GLEW website it works on Windows, Linux, Mac OS X,
FreeBSD, Irix, and Solaris. There might still be platform specific
issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
regardless of the glext.h on the platform where compilation happens.
Game Engine
===========
Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.
The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.
For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.
* The game engine now also uses GLEW for extensions, replacing the
custom opengl extensions code that was there. Removes a lot of
#ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
work around a specific bug and only disabled multitexturing anyway.
It might also have caused a slowdown since it was retrieving the
environment variable for every vertex in immediate mode (bug #13680).
* Refactored the code to allow drawing skinned meshes with vertex
arrays too, removing some specific immediate mode drawing functions
for this that only did extra normal calculation. Now it always splits
vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
attributes for vertex arrays. These were not being enabled/disabled
correct according to the opengl spec, leading to crashes. Also tangent
attributes used an immediate mode call for vertex arrays, which can't
work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
|
|
|
void ActivateBlenderShaders(
|
|
|
|
RAS_IRasterizer* rasty,
|
|
|
|
TCachingInfo& cachingInfo
|
|
|
|
)const;
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2009-11-15 23:58:56 +00:00
|
|
|
Material* GetBlenderMaterial() const;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
MTFace* GetMTFace(void) const;
|
|
|
|
unsigned int* GetMCol(void) const;
|
2008-10-31 21:06:48 +00:00
|
|
|
BL_Texture * getTex (unsigned int idx) {
|
|
|
|
return (idx < MAXTEX) ? mTextures + idx : NULL;
|
|
|
|
}
|
2008-11-05 13:22:10 +00:00
|
|
|
Image * getImage (unsigned int idx) {
|
|
|
|
return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL;
|
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
unsigned int* getBlendFunc() {
|
|
|
|
return mBlendFunc;
|
|
|
|
}
|
2006-01-06 03:46:54 +00:00
|
|
|
// for ipos
|
|
|
|
void UpdateIPO(
|
|
|
|
MT_Vector4 rgba, MT_Vector3 specrgb,
|
|
|
|
MT_Scalar hard, MT_Scalar spec,
|
|
|
|
MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha
|
|
|
|
);
|
|
|
|
|
2009-11-15 23:58:56 +00:00
|
|
|
virtual void Replace_IScene(SCA_IScene *val)
|
|
|
|
{
|
2011-02-21 23:41:47 +00:00
|
|
|
mScene= static_cast<KX_Scene *>(val);
|
2010-07-11 09:31:19 +00:00
|
|
|
if (mBlenderShader)
|
|
|
|
{
|
|
|
|
mBlenderShader->SetScene(mScene);
|
|
|
|
}
|
2009-11-15 23:58:56 +00:00
|
|
|
};
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2006-01-06 03:46:54 +00:00
|
|
|
// --------------------------------
|
2009-06-29 02:25:54 +00:00
|
|
|
virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
static PyObject* pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
|
|
|
static PyObject* pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
|
|
|
static PyObject* pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
|
|
|
static int pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
|
|
|
|
KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
|
|
|
|
KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture );
|
|
|
|
KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
|
|
|
|
|
2006-01-15 11:34:55 +00:00
|
|
|
KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
|
2010-10-31 04:11:39 +00:00
|
|
|
#endif // WITH_PYTHON
|
2006-02-13 05:45:32 +00:00
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
// --------------------------------
|
|
|
|
// pre calculate to avoid pops/lag at startup
|
2009-06-08 20:08:19 +00:00
|
|
|
virtual void OnConstruction(int layer);
|
2008-07-29 15:48:31 +00:00
|
|
|
|
|
|
|
static void EndFrame();
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
private:
|
Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====
Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.
* According to the GLEW website it works on Windows, Linux, Mac OS X,
FreeBSD, Irix, and Solaris. There might still be platform specific
issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
regardless of the glext.h on the platform where compilation happens.
Game Engine
===========
Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.
The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.
For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.
* The game engine now also uses GLEW for extensions, replacing the
custom opengl extensions code that was there. Removes a lot of
#ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
work around a specific bug and only disabled multitexturing anyway.
It might also have caused a slowdown since it was retrieving the
environment variable for every vertex in immediate mode (bug #13680).
* Refactored the code to allow drawing skinned meshes with vertex
arrays too, removing some specific immediate mode drawing functions
for this that only did extra normal calculation. Now it always splits
vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
attributes for vertex arrays. These were not being enabled/disabled
correct according to the opengl spec, leading to crashes. Also tangent
attributes used an immediate mode call for vertex arrays, which can't
work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
|
|
|
BL_Material* mMaterial;
|
|
|
|
BL_Shader* mShader;
|
|
|
|
BL_BlenderShader* mBlenderShader;
|
2006-01-06 03:46:54 +00:00
|
|
|
KX_Scene* mScene;
|
|
|
|
BL_Texture mTextures[MAXTEX]; // texture array
|
2006-01-15 11:34:55 +00:00
|
|
|
bool mUserDefBlend;
|
|
|
|
unsigned int mBlendFunc[2];
|
2006-01-18 06:04:11 +00:00
|
|
|
bool mModified;
|
2008-05-04 21:14:38 +00:00
|
|
|
bool mConstructed; // if false, don't clean on exit
|
2006-01-15 11:34:55 +00:00
|
|
|
|
2009-06-08 20:08:19 +00:00
|
|
|
void SetBlenderGLSLShader(int layer);
|
Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====
Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.
* According to the GLEW website it works on Windows, Linux, Mac OS X,
FreeBSD, Irix, and Solaris. There might still be platform specific
issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
regardless of the glext.h on the platform where compilation happens.
Game Engine
===========
Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.
The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.
For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.
* The game engine now also uses GLEW for extensions, replacing the
custom opengl extensions code that was there. Removes a lot of
#ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
work around a specific bug and only disabled multitexturing anyway.
It might also have caused a slowdown since it was retrieving the
environment variable for every vertex in immediate mode (bug #13680).
* Refactored the code to allow drawing skinned meshes with vertex
arrays too, removing some specific immediate mode drawing functions
for this that only did extra normal calculation. Now it always splits
vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
attributes for vertex arrays. These were not being enabled/disabled
correct according to the opengl spec, leading to crashes. Also tangent
attributes used an immediate mode call for vertex arrays, which can't
work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
|
|
|
|
2006-04-02 21:04:20 +00:00
|
|
|
void ActivatGLMaterials( RAS_IRasterizer* rasty )const;
|
|
|
|
void ActivateTexGen( RAS_IRasterizer *ras ) const;
|
|
|
|
|
2008-07-10 12:47:20 +00:00
|
|
|
bool UsesLighting(RAS_IRasterizer *rasty) const;
|
2009-06-08 20:08:19 +00:00
|
|
|
void GetMaterialRGBAColor(unsigned char *rgba) const;
|
|
|
|
Scene* GetBlenderScene() const;
|
|
|
|
void ReleaseMaterial();
|
2006-02-13 05:45:32 +00:00
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
// message centers
|
2006-02-13 05:45:32 +00:00
|
|
|
void setTexData( bool enable,RAS_IRasterizer *ras);
|
Merge of apricot branch game engine changes into trunk, excluding GLSL.
GLEW
====
Added the GLEW opengl extension library into extern/, always compiled
into Blender now. This is much nicer than doing this kind of extension
management manually, and will be used in the game engine, for GLSL, and
other opengl extensions.
* According to the GLEW website it works on Windows, Linux, Mac OS X,
FreeBSD, Irix, and Solaris. There might still be platform specific
issues due to this commit, so let me know and I'll look into it.
* This means also that all extensions will now always be compiled in,
regardless of the glext.h on the platform where compilation happens.
Game Engine
===========
Refactoring of the use of opengl extensions and other drawing code
in the game engine, and cleaning up some hacks related to GLSL
integration. These changes will be merged into trunk too after this.
The game engine graphics demos & apricot level survived my tests,
but this could use some good testing of course.
For users: please test with the options "Generate Display Lists" and
"Vertex Arrays" enabled, these should be the fastest and are supposed
to be "unreliable", but if that's the case that's probably due to bugs
that can be fixed.
* The game engine now also uses GLEW for extensions, replacing the
custom opengl extensions code that was there. Removes a lot of
#ifdef's, but the runtime checks stay of course.
* Removed the WITHOUT_GLEXT environment variable. This was added to
work around a specific bug and only disabled multitexturing anyway.
It might also have caused a slowdown since it was retrieving the
environment variable for every vertex in immediate mode (bug #13680).
* Refactored the code to allow drawing skinned meshes with vertex
arrays too, removing some specific immediate mode drawing functions
for this that only did extra normal calculation. Now it always splits
vertices of flat faces instead.
* Refactored normal recalculation with some minor optimizations,
required for the above change.
* Removed some outdated code behind the __NLA_OLDDEFORM #ifdef.
* Fixed various bugs in setting of multitexture coordinates and vertex
attributes for vertex arrays. These were not being enabled/disabled
correct according to the opengl spec, leading to crashes. Also tangent
attributes used an immediate mode call for vertex arrays, which can't
work.
* Fixed use of uninitialized variable in RAS_TexVert.
* Exporting skinned meshes was doing O(n^2) lookups for vertices and
deform weights, now uses same trick as regular meshes.
2008-06-17 10:27:34 +00:00
|
|
|
void setBlenderShaderData( bool enable, RAS_IRasterizer *ras);
|
2006-02-13 05:45:32 +00:00
|
|
|
void setShaderData( bool enable, RAS_IRasterizer *ras);
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2006-02-13 05:45:32 +00:00
|
|
|
void setObjectMatrixData(int i, RAS_IRasterizer *ras);
|
|
|
|
void setTexMatrixData(int i);
|
|
|
|
|
|
|
|
void setLightData();
|
2006-01-06 03:46:54 +00:00
|
|
|
|
|
|
|
// cleanup stuff
|
|
|
|
void OnExit();
|
|
|
|
|
2008-07-29 15:48:31 +00:00
|
|
|
// shader chacing
|
|
|
|
static BL_BlenderShader *mLastBlenderShader;
|
|
|
|
static BL_Shader *mLastShader;
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
mutable int mPass;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|