Commit 4e6e236e authored by hybrid's avatar hybrid

Merged from branch 1.4, revisions 1275:1289

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1290 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ca91742a
...@@ -5,11 +5,10 @@ ...@@ -5,11 +5,10 @@
#ifndef __I_SCENE_NODE_H_INCLUDED__ #ifndef __I_SCENE_NODE_H_INCLUDED__
#define __I_SCENE_NODE_H_INCLUDED__ #define __I_SCENE_NODE_H_INCLUDED__
#include "IReferenceCounted.h" #include "IAttributeExchangingObject.h"
#include "ESceneNodeTypes.h" #include "ESceneNodeTypes.h"
#include "ECullingTypes.h" #include "ECullingTypes.h"
#include "EDebugSceneTypes.h" #include "EDebugSceneTypes.h"
#include "ISceneManager.h"
#include "ISceneNodeAnimator.h" #include "ISceneNodeAnimator.h"
#include "ITriangleSelector.h" #include "ITriangleSelector.h"
#include "SMaterial.h" #include "SMaterial.h"
...@@ -18,12 +17,13 @@ ...@@ -18,12 +17,13 @@
#include "matrix4.h" #include "matrix4.h"
#include "irrList.h" #include "irrList.h"
#include "IAttributes.h" #include "IAttributes.h"
#include "IAttributeExchangingObject.h"
namespace irr namespace irr
{ {
namespace scene namespace scene
{ {
class ISceneManager;
//! Scene node interface. //! Scene node interface.
/** A scene node is a node in the hierarchical scene graph. Every scene /** A scene node is a node in the hierarchical scene graph. Every scene
node may have children, which are also scene nodes. Children move node may have children, which are also scene nodes. Children move
......
...@@ -71,8 +71,8 @@ namespace video ...@@ -71,8 +71,8 @@ namespace video
EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255), EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f), Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true), Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true),
ZBuffer(1), ZWriteEnable(true), BackfaceCulling(true), ZWriteEnable(true), BackfaceCulling(true),
FogEnable(false), NormalizeNormals(false) FogEnable(false), NormalizeNormals(false), ZBuffer(1)
{ } { }
//! copy constructor //! copy constructor
...@@ -106,11 +106,11 @@ namespace video ...@@ -106,11 +106,11 @@ namespace video
PointCloud = other.PointCloud; PointCloud = other.PointCloud;
GouraudShading = other.GouraudShading; GouraudShading = other.GouraudShading;
Lighting = other.Lighting; Lighting = other.Lighting;
ZBuffer = other.ZBuffer;
ZWriteEnable = other.ZWriteEnable; ZWriteEnable = other.ZWriteEnable;
BackfaceCulling = other.BackfaceCulling; BackfaceCulling = other.BackfaceCulling;
FogEnable = other.FogEnable; FogEnable = other.FogEnable;
NormalizeNormals = other.NormalizeNormals; NormalizeNormals = other.NormalizeNormals;
ZBuffer = other.ZBuffer;
return *this; return *this;
} }
...@@ -196,11 +196,6 @@ namespace video ...@@ -196,11 +196,6 @@ namespace video
//! Will this material be lighted? Default: true //! Will this material be lighted? Default: true
bool Lighting; bool Lighting;
//! Is the ZBuffer enabled? Default: true
//! Changed from bool to integer
// ( 0 == ZBuffer Off, 1 == ZBuffer LessEqual, 2 == ZBuffer Equal )
u32 ZBuffer;
//! Is the zbuffer writeable or is it read-only. //! Is the zbuffer writeable or is it read-only.
/** Default: 1 This flag is ignored, if the MaterialType /** Default: 1 This flag is ignored, if the MaterialType
is a transparent type. */ is a transparent type. */
...@@ -215,6 +210,11 @@ namespace video ...@@ -215,6 +210,11 @@ namespace video
//! Should normals be normalized? Default: false //! Should normals be normalized? Default: false
bool NormalizeNormals; bool NormalizeNormals;
//! Is the ZBuffer enabled? Default: true
//! Changed from bool to integer
// ( 0 == ZBuffer Off, 1 == ZBuffer LessEqual, 2 == ZBuffer Equal )
u32 ZBuffer;
//! Gets the texture transformation matrix for level i //! Gets the texture transformation matrix for level i
core::matrix4& getTextureMatrix(u32 i) core::matrix4& getTextureMatrix(u32 i)
{ {
......
...@@ -418,32 +418,32 @@ public: ...@@ -418,32 +418,32 @@ public:
//! compares the first n characters of the strings //! compares the first n characters of the strings
bool equalsn(const string<T>& other, int len) const bool equalsn(const string<T>& other, u32 n) const
{ {
u32 i; u32 i;
for(i=0; array[i] && other[i] && i < len; ++i) for(i=0; array[i] && other[i] && i < n; ++i)
if (array[i] != other[i]) if (array[i] != other[i])
return false; return false;
// if one (or both) of the strings was smaller then they // if one (or both) of the strings was smaller then they
// are only equal if they have the same length // are only equal if they have the same length
return (i == len) || (used == other.used); return (i == n) || (used == other.used);
} }
//! compares the first n characters of the strings //! compares the first n characters of the strings
bool equalsn(const T* const str, int len) const bool equalsn(const T* const str, u32 n) const
{ {
if (!str) if (!str)
return false; return false;
u32 i; u32 i;
for(i=0; array[i] && str[i] && i < len; ++i) for(i=0; array[i] && str[i] && i < n; ++i)
if (array[i] != str[i]) if (array[i] != str[i])
return false; return false;
// if one (or both) of the strings was smaller then they // if one (or both) of the strings was smaller then they
// are only equal if they have the same length // are only equal if they have the same length
return (i == len) || (array[i] == 0 && str[i] == 0); return (i == n) || (array[i] == 0 && str[i] == 0);
} }
...@@ -666,7 +666,7 @@ public: ...@@ -666,7 +666,7 @@ public:
if (!c) if (!c)
return -1; return -1;
for (u32 i=(used-1); i>=0; --i) for (s32 i=used-1; i>=0; --i)
for (u32 j=0; j<count; ++j) for (u32 j=0; j<count; ++j)
if (array[i] == c[j]) if (array[i] == c[j])
return i; return i;
...@@ -692,7 +692,7 @@ public: ...@@ -692,7 +692,7 @@ public:
if (len > used-1) if (len > used-1)
return -1; return -1;
for (u32 i=0; i<used-len; ++i) for (s32 i=0; i<used-len; ++i)
{ {
u32 j=0; u32 j=0;
...@@ -804,7 +804,7 @@ public: ...@@ -804,7 +804,7 @@ public:
//! trims the string. //! trims the string.
/** Removes whitespace from begin and end of the string. */ /** Removes whitespace from begin and end of the string. */
void trim() string<T>& trim()
{ {
const c8 whitespace[] = " \t\n\r"; const c8 whitespace[] = " \t\n\r";
const u32 whitespacecount = 4; const u32 whitespacecount = 4;
...@@ -812,14 +812,11 @@ public: ...@@ -812,14 +812,11 @@ public:
// find start and end of real string without whitespace // find start and end of real string without whitespace
s32 begin = findFirstCharNotInList(whitespace, whitespacecount); s32 begin = findFirstCharNotInList(whitespace, whitespacecount);
if (begin == -1) if (begin == -1)
{ return (*this="");
*this="";
return;
}
s32 end = findLastCharNotInList(whitespace, whitespacecount); s32 end = findLastCharNotInList(whitespace, whitespacecount);
*this = subString(begin, (end +1) - begin); return (*this = subString(begin, (end +1) - begin));
} }
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
#include "ISceneNodeAnimatorFactory.h" #include "ISceneNodeAnimatorFactory.h"
#include "ISceneNodeAnimatorCollisionResponse.h" #include "ISceneNodeAnimatorCollisionResponse.h"
#include "IShaderConstantSetCallBack.h" #include "IShaderConstantSetCallBack.h"
#include "IShadowVolumeSceneNode.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors #include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
#include "ISkinnedMesh.h" #include "ISkinnedMesh.h"
#include "ITerrainSceneNode.h" #include "ITerrainSceneNode.h"
......
...@@ -329,13 +329,13 @@ u32 CAnimatedMeshMD2::getFrameCount() const ...@@ -329,13 +329,13 @@ u32 CAnimatedMeshMD2::getFrameCount() const
//! returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail. Note, that some Meshes will ignore the detail level. //! returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail. Note, that some Meshes will ignore the detail level.
IMesh* CAnimatedMeshMD2::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) IMesh* CAnimatedMeshMD2::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
{ {
if ((u32)frame > (FrameCount<<MD2_FRAME_SHIFT)) if ((u32)frame > getFrameCount())
frame = (frame % (FrameCount<<MD2_FRAME_SHIFT)); frame = (frame % getFrameCount());
if (startFrameLoop == -1 && endFrameLoop == -1) if (startFrameLoop == -1 && endFrameLoop == -1)
{ {
startFrameLoop = 0; startFrameLoop = 0;
endFrameLoop = FrameCount<<MD2_FRAME_SHIFT; endFrameLoop = getFrameCount();
} }
updateInterpolationBuffer(frame, startFrameLoop, endFrameLoop); updateInterpolationBuffer(frame, startFrameLoop, endFrameLoop);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "IAnimatedMesh.h" #include "IAnimatedMesh.h"
#include "IMesh.h" #include "IMesh.h"
#include "irrMath.h"
#include "os.h" #include "os.h"
#include "IGUISkin.h" #include "IGUISkin.h"
...@@ -47,18 +46,16 @@ void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh) ...@@ -47,18 +46,16 @@ void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
Mesh = mesh; Mesh = mesh;
if (!Mesh) if (!Mesh)
return; return;
else
Mesh->grab();
/* This might be used for proper transformation etc.
core::vector3df center(0.0f,0.0f,0.0f); core::vector3df center(0.0f,0.0f,0.0f);
core::aabbox3d<f32> box; core::aabbox3d<f32> box;
if (mesh->getFrameCount()) box = Mesh->getMesh(0)->getBoundingBox();
{ center = (box.MaxEdge + box.MinEdge) / 2;
box = mesh->getMesh(0)->getBoundingBox(); */
center = (box.MaxEdge + box.MinEdge) / 2;
}
if (Mesh)
Mesh->grab();
} }
...@@ -150,7 +147,10 @@ void CGUIMeshViewer::draw() ...@@ -150,7 +147,10 @@ void CGUIMeshViewer::draw()
driver->setMaterial(Material); driver->setMaterial(Material);
scene::IMesh* m = Mesh->getMesh(os::Timer::getTime()/20); u32 frame = 0;
if(Mesh->getFrameCount())
frame = (os::Timer::getTime()/20)%Mesh->getFrameCount();
const scene::IMesh* const m = Mesh->getMesh(frame);
for (u32 i=0; i<m->getMeshBufferCount(); ++i) for (u32 i=0; i<m->getMeshBufferCount(); ++i)
{ {
scene::IMeshBuffer* mb = m->getMeshBuffer(i); scene::IMeshBuffer* mb = m->getMeshBuffer(i);
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "IGUIMeshViewer.h" #include "IGUIMeshViewer.h"
#include "SMaterial.h" #include "SMaterial.h"
#include "vector3d.h"
namespace irr namespace irr
{ {
......
...@@ -345,7 +345,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file) ...@@ -345,7 +345,7 @@ bool CMS3DMeshFileLoader::load(io::IReadFile* file)
tmpBuffer->Material.SpecularColor = video::SColorf(material->Specular[0], material->Specular[1], material->Specular[2], material->Specular[3]).toSColor (); tmpBuffer->Material.SpecularColor = video::SColorf(material->Specular[0], material->Specular[1], material->Specular[2], material->Specular[3]).toSColor ();
tmpBuffer->Material.Shininess = material->Shininess; tmpBuffer->Material.Shininess = material->Shininess;
core::stringc TexturePath=(const c8*)material->Texture; core::stringc TexturePath(material->Texture);
TexturePath.trim(); TexturePath.trim();
if (TexturePath!="") if (TexturePath!="")
{ {
......
...@@ -2556,7 +2556,7 @@ IImage* COpenGLDriver::createScreenShot() ...@@ -2556,7 +2556,7 @@ IImage* COpenGLDriver::createScreenShot()
glReadPixels(0, 0, ScreenSize.Width, ScreenSize.Height, GL_RGB, GL_UNSIGNED_BYTE, pPixels); glReadPixels(0, 0, ScreenSize.Width, ScreenSize.Height, GL_RGB, GL_UNSIGNED_BYTE, pPixels);
// opengl images are inverted, so we have to fix that here. // opengl images are horizontally flipped, so we have to fix that here.
s32 pitch=newImage->getPitch(); s32 pitch=newImage->getPitch();
u8* p2 = pPixels + (ScreenSize.Height - 1) * pitch; u8* p2 = pPixels + (ScreenSize.Height - 1) * pitch;
u8* tmpBuffer = new u8[pitch]; u8* tmpBuffer = new u8[pitch];
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#ifdef _IRR_COMPILE_WITH_BSP_LOADER_ #ifdef _IRR_COMPILE_WITH_BSP_LOADER_
#include "CQuake3ShaderSceneNode.h" #include "CQuake3ShaderSceneNode.h"
#include "ISceneManager.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "ICameraSceneNode.h" #include "ICameraSceneNode.h"
#include "SViewFrustum.h" #include "SViewFrustum.h"
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
#include "CTRTextureGouraud.h" #include "CTRTextureGouraud.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SOFTWARE_ #ifdef _IRR_COMPILE_WITH_SOFTWARE_
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "fast_atof.h" #include "fast_atof.h"
#include "coreutil.h" #include "coreutil.h"
#include "ISceneManager.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "IFileSystem.h" #include "IFileSystem.h"
#include "IReadFile.h" #include "IReadFile.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment