mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-06 18:20:26 +02:00
Merging r6468 through r6486 from trunk to ogl-es branch
Also updating ES&ES2 interface to work with removal of IMaterialRendererServices::setBasicRenderStates git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6487 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -17,7 +17,11 @@ namespace scene
|
||||
//! Only transform the position of the node transformation matrix
|
||||
//! by the parent transformation matrix.
|
||||
//! Parent will not affect the rotation/scale of the node transformation.
|
||||
ESNUA_TRANSFORM_POSITION
|
||||
ESNUA_TRANSFORM_POSITION,
|
||||
|
||||
//! Use the relative matrix as absolute transformation matrix
|
||||
//! Parent node transformation is ignored just like when the parent is set to 0
|
||||
ESNUA_RELATIVE
|
||||
};
|
||||
|
||||
//! Names for culling type
|
||||
@ -25,6 +29,7 @@ namespace scene
|
||||
{
|
||||
"matrix",
|
||||
"pos",
|
||||
"relative",
|
||||
0
|
||||
};
|
||||
|
||||
|
@ -24,20 +24,6 @@ public:
|
||||
//! Destructor
|
||||
virtual ~IMaterialRendererServices() {}
|
||||
|
||||
//! Can be called by an IMaterialRenderer to make its work easier.
|
||||
/** Sets all basic renderstates if needed.
|
||||
Basic render states are diffuse, ambient, specular, and emissive color,
|
||||
specular power, bilinear and trilinear filtering, wireframe mode,
|
||||
gouraudshading, lighting, zbuffer, zwriteenable, backfaceculling and
|
||||
fog enabling.
|
||||
\param material The new material to be used.
|
||||
\param lastMaterial The material used until now.
|
||||
\param resetAllRenderstates Set to true if all renderstates should be
|
||||
set, regardless of their current state. */
|
||||
virtual void setBasicRenderStates(const SMaterial& material,
|
||||
const SMaterial& lastMaterial,
|
||||
bool resetAllRenderstates) = 0;
|
||||
|
||||
//! Return an index constant for the vertex shader based on a name.
|
||||
virtual s32 getVertexShaderConstantID(const c8* name) = 0;
|
||||
|
||||
|
@ -15,6 +15,20 @@ namespace scene
|
||||
class IShadowVolumeSceneNode;
|
||||
class IMesh;
|
||||
|
||||
//! Option for nodes how to register themeselves at the SceneManager
|
||||
enum ENodeRegistration
|
||||
{
|
||||
//! Each node registers once and renders all it's mesh-buffers
|
||||
ENR_DEFAULT,
|
||||
|
||||
//! Register a new node per mesh-buffer at the SceneManager
|
||||
//! It allows the SceneManager to sort in each render stage per buffer instead of per node.
|
||||
//! This can be useful when having several transparent buffers in a mesh.
|
||||
//! Depending on the scene (and hardware) this can have a positive or negative effect on performance.
|
||||
//! It can avoid texture-switches, but adds nodes to sort and more matrix transformations are set.
|
||||
ENR_PER_MESH_BUFFER
|
||||
};
|
||||
|
||||
|
||||
//! A scene node displaying a static mesh
|
||||
class IMeshSceneNode : public ISceneNode
|
||||
@ -28,9 +42,11 @@ public:
|
||||
const core::vector3df& position = core::vector3df(0,0,0),
|
||||
const core::vector3df& rotation = core::vector3df(0,0,0),
|
||||
const core::vector3df& scale = core::vector3df(1,1,1))
|
||||
: ISceneNode(parent, mgr, id, position, rotation, scale) {}
|
||||
: ISceneNode(parent, mgr, id, position, rotation, scale)
|
||||
, NodeRegistration(ENR_DEFAULT)
|
||||
{}
|
||||
|
||||
//! Sets a new mesh to display
|
||||
//! Sets a new mesh to display or update mesh when it changed
|
||||
/** \param mesh Mesh to display. */
|
||||
virtual void setMesh(IMesh* mesh) = 0;
|
||||
|
||||
@ -73,6 +89,23 @@ public:
|
||||
/** This flag can be set by setReadOnlyMaterials().
|
||||
\return Whether the materials are read-only. */
|
||||
virtual bool isReadOnlyMaterials() const = 0;
|
||||
|
||||
//! Set how the node registers itself to the SceneManager
|
||||
/** Note: Derived classes can ignore this flag, so think of it as a hint. */
|
||||
virtual void setNodeRegistration(ENodeRegistration nodeRegistration)
|
||||
{
|
||||
NodeRegistration = nodeRegistration;
|
||||
}
|
||||
|
||||
//! How does a node register itself to the SceneManager
|
||||
/** Note: Derived classes may ignore this flag */
|
||||
virtual ENodeRegistration getNodeRegistration() const
|
||||
{
|
||||
return NodeRegistration;
|
||||
}
|
||||
|
||||
protected:
|
||||
ENodeRegistration NodeRegistration;
|
||||
};
|
||||
|
||||
} // end namespace scene
|
||||
|
@ -66,7 +66,7 @@ namespace scene
|
||||
//! In this pass, lights are transformed into camera space and added to the driver
|
||||
ESNRP_LIGHT =2,
|
||||
|
||||
//! This is used for sky boxes.
|
||||
//! This is mostly used for sky boxes. Stage between light and solid.
|
||||
ESNRP_SKY_BOX =4,
|
||||
|
||||
//! All normal objects can use this for registering themselves.
|
||||
|
@ -79,7 +79,7 @@ namespace scene
|
||||
|
||||
//! This method is called just before the rendering process of the whole scene.
|
||||
/** Nodes may register themselves in the render pipeline during this call,
|
||||
precalculate the geometry which should be rendered, and prevent their
|
||||
pre-calculate the geometry which should be rendered, and prevent their
|
||||
children from being able to register themselves if they are clipped by simply
|
||||
not calling their OnRegisterSceneNode method.
|
||||
If you are implementing your own scene node, you should overwrite this method
|
||||
@ -95,7 +95,7 @@ namespace scene
|
||||
{
|
||||
if (IsVisible)
|
||||
{
|
||||
ISceneNodeList::Iterator it = Children.begin();
|
||||
ISceneNodeList::ConstIterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->OnRegisterSceneNode();
|
||||
}
|
||||
@ -114,7 +114,7 @@ namespace scene
|
||||
{
|
||||
// animate this node with all animators
|
||||
|
||||
ISceneNodeAnimatorList::Iterator ait = Animators.begin();
|
||||
ISceneNodeAnimatorList::ConstIterator ait = Animators.begin();
|
||||
while (ait != Animators.end())
|
||||
{
|
||||
// continue to the next node before calling animateNode()
|
||||
@ -133,7 +133,7 @@ namespace scene
|
||||
|
||||
// perform the post render process on all children
|
||||
|
||||
ISceneNodeList::Iterator it = Children.begin();
|
||||
ISceneNodeList::ConstIterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
(*it)->OnAnimate(timeMs);
|
||||
}
|
||||
@ -543,7 +543,7 @@ namespace scene
|
||||
|
||||
|
||||
//! Set a culling style or disable culling completely.
|
||||
/** Box cullling (EAC_BOX) is set by default. Note that not
|
||||
/** Box culling (EAC_BOX) is set by default. Note that not
|
||||
all SceneNodes support culling and that some nodes always cull
|
||||
their geometry because it is their only reason for existence,
|
||||
for example the OctreeSceneNode.
|
||||
@ -682,16 +682,24 @@ namespace scene
|
||||
{
|
||||
if (Parent)
|
||||
{
|
||||
if ( AbsPosUpdateBehavior == ESNUA_TRANSFORM_MATRIX )
|
||||
switch ( AbsPosUpdateBehavior )
|
||||
{
|
||||
case ESNUA_TRANSFORM_MATRIX:
|
||||
{
|
||||
AbsoluteTransformation =
|
||||
Parent->getAbsoluteTransformation() * getRelativeTransformation();
|
||||
}
|
||||
else if ( AbsPosUpdateBehavior == ESNUA_TRANSFORM_POSITION )
|
||||
break;
|
||||
case ESNUA_TRANSFORM_POSITION:
|
||||
{
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
Parent->getAbsoluteTransformation().transformVect(reinterpret_cast<irr::core::vector3df&>(AbsoluteTransformation[12]));
|
||||
}
|
||||
break;
|
||||
case ESNUA_RELATIVE:
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
@ -821,7 +829,7 @@ namespace scene
|
||||
|
||||
// clone children
|
||||
|
||||
ISceneNodeList::Iterator it = toCopyFrom->Children.begin();
|
||||
ISceneNodeList::ConstIterator it = toCopyFrom->Children.begin();
|
||||
for (; it != toCopyFrom->Children.end(); ++it)
|
||||
(*it)->clone(this, newManager);
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace video
|
||||
"texture_clamp_mirror_clamp_to_border", 0};
|
||||
|
||||
//! Struct for holding material parameters which exist per texture layer
|
||||
// Note for implementors: Serialization is in CNullDriver
|
||||
// Note for implementers: Serialization is in CNullDriver
|
||||
class SMaterialLayer
|
||||
{
|
||||
public:
|
||||
@ -153,6 +153,25 @@ namespace video
|
||||
*TextureMatrix = mat;
|
||||
}
|
||||
|
||||
//! Check if we have set a custom texture matrix
|
||||
//! Note that otherwise we get an IdentityMatrix as default
|
||||
inline bool hasSetTextureMatrix() const
|
||||
{
|
||||
return TextureMatrix != 0;
|
||||
}
|
||||
|
||||
//! Reset texture matrix to identity matrix
|
||||
//! Releases memory, which is expensive, but ver rarely useful for optimizations
|
||||
void resetTextureMatrix()
|
||||
{
|
||||
if ( TextureMatrix )
|
||||
{
|
||||
MatrixAllocator.destruct(TextureMatrix);
|
||||
MatrixAllocator.deallocate(TextureMatrix);
|
||||
TextureMatrix = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//! Inequality operator
|
||||
/** \param b Layer to compare to.
|
||||
\return True if layers are different, else false. */
|
||||
|
Reference in New Issue
Block a user