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 @@
#ifndef __I_SCENE_NODE_H_INCLUDED__
#define __I_SCENE_NODE_H_INCLUDED__
#include "IReferenceCounted.h"
#include "IAttributeExchangingObject.h"
#include "ESceneNodeTypes.h"
#include "ECullingTypes.h"
#include "EDebugSceneTypes.h"
#include "ISceneManager.h"
#include "ISceneNodeAnimator.h"
#include "ITriangleSelector.h"
#include "SMaterial.h"
......@@ -18,12 +17,13 @@
#include "matrix4.h"
#include "irrList.h"
#include "IAttributes.h"
#include "IAttributeExchangingObject.h"
namespace irr
{
namespace scene
{
class ISceneManager;
//! Scene node interface.
/** A scene node is a node in the hierarchical scene graph. Every scene
node may have children, which are also scene nodes. Children move
......
......@@ -71,8 +71,8 @@ namespace video
EmissiveColor(0,0,0,0), SpecularColor(255,255,255,255),
Shininess(0.0f), MaterialTypeParam(0.0f), MaterialTypeParam2(0.0f), Thickness(1.0f),
Wireframe(false), PointCloud(false), GouraudShading(true), Lighting(true),
ZBuffer(1), ZWriteEnable(true), BackfaceCulling(true),
FogEnable(false), NormalizeNormals(false)
ZWriteEnable(true), BackfaceCulling(true),
FogEnable(false), NormalizeNormals(false), ZBuffer(1)
{ }
//! copy constructor
......@@ -106,11 +106,11 @@ namespace video
PointCloud = other.PointCloud;
GouraudShading = other.GouraudShading;
Lighting = other.Lighting;
ZBuffer = other.ZBuffer;
ZWriteEnable = other.ZWriteEnable;
BackfaceCulling = other.BackfaceCulling;
FogEnable = other.FogEnable;
NormalizeNormals = other.NormalizeNormals;
ZBuffer = other.ZBuffer;
return *this;
}
......@@ -196,11 +196,6 @@ namespace video
//! Will this material be lighted? Default: true
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.
/** Default: 1 This flag is ignored, if the MaterialType
is a transparent type. */
......@@ -215,6 +210,11 @@ namespace video
//! Should normals be normalized? Default: false
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
core::matrix4& getTextureMatrix(u32 i)
{
......
......@@ -418,32 +418,32 @@ public:
//! 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;
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])
return false;
// if one (or both) of the strings was smaller then they
// 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
bool equalsn(const T* const str, int len) const
bool equalsn(const T* const str, u32 n) const
{
if (!str)
return false;
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])
return false;
// if one (or both) of the strings was smaller then they
// 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:
if (!c)
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)
if (array[i] == c[j])
return i;
......@@ -692,7 +692,7 @@ public:
if (len > used-1)
return -1;
for (u32 i=0; i<used-len; ++i)
for (s32 i=0; i<used-len; ++i)
{
u32 j=0;
......@@ -804,7 +804,7 @@ public:
//! trims the string.
/** Removes whitespace from begin and end of the string. */
void trim()
string<T>& trim()
{
const c8 whitespace[] = " \t\n\r";
const u32 whitespacecount = 4;
......@@ -812,14 +812,11 @@ public:
// find start and end of real string without whitespace
s32 begin = findFirstCharNotInList(whitespace, whitespacecount);
if (begin == -1)
{
*this="";
return;
}
return (*this="");
s32 end = findLastCharNotInList(whitespace, whitespacecount);
*this = subString(begin, (end +1) - begin);
return (*this = subString(begin, (end +1) - begin));
}
......
......@@ -105,6 +105,7 @@
#include "ISceneNodeAnimatorFactory.h"
#include "ISceneNodeAnimatorCollisionResponse.h"
#include "IShaderConstantSetCallBack.h"
#include "IShadowVolumeSceneNode.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
#include "ISkinnedMesh.h"
#include "ITerrainSceneNode.h"
......
......@@ -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.
IMesh* CAnimatedMeshMD2::getMesh(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
{
if ((u32)frame > (FrameCount<<MD2_FRAME_SHIFT))
frame = (frame % (FrameCount<<MD2_FRAME_SHIFT));
if ((u32)frame > getFrameCount())
frame = (frame % getFrameCount());
if (startFrameLoop == -1 && endFrameLoop == -1)
{
startFrameLoop = 0;
endFrameLoop = FrameCount<<MD2_FRAME_SHIFT;
endFrameLoop = getFrameCount();
}
updateInterpolationBuffer(frame, startFrameLoop, endFrameLoop);
......
......@@ -9,7 +9,6 @@
#include "IVideoDriver.h"
#include "IAnimatedMesh.h"
#include "IMesh.h"
#include "irrMath.h"
#include "os.h"
#include "IGUISkin.h"
......@@ -47,18 +46,16 @@ void CGUIMeshViewer::setMesh(scene::IAnimatedMesh* mesh)
Mesh = mesh;
if (!Mesh)
return;
else
Mesh->grab();
/* This might be used for proper transformation etc.
core::vector3df center(0.0f,0.0f,0.0f);
core::aabbox3d<f32> box;
if (mesh->getFrameCount())
{
box = mesh->getMesh(0)->getBoundingBox();
box = Mesh->getMesh(0)->getBoundingBox();
center = (box.MaxEdge + box.MinEdge) / 2;
}
if (Mesh)
Mesh->grab();
*/
}
......@@ -150,7 +147,10 @@ void CGUIMeshViewer::draw()
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)
{
scene::IMeshBuffer* mb = m->getMeshBuffer(i);
......
......@@ -10,7 +10,6 @@
#include "IGUIMeshViewer.h"
#include "SMaterial.h"
#include "vector3d.h"
namespace irr
{
......
......@@ -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.Shininess = material->Shininess;
core::stringc TexturePath=(const c8*)material->Texture;
core::stringc TexturePath(material->Texture);
TexturePath.trim();
if (TexturePath!="")
{
......
......@@ -2556,7 +2556,7 @@ IImage* COpenGLDriver::createScreenShot()
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();
u8* p2 = pPixels + (ScreenSize.Height - 1) * pitch;
u8* tmpBuffer = new u8[pitch];
......
......@@ -7,6 +7,7 @@
#ifdef _IRR_COMPILE_WITH_BSP_LOADER_
#include "CQuake3ShaderSceneNode.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
#include "ICameraSceneNode.h"
#include "SViewFrustum.h"
......
......@@ -4,7 +4,6 @@
#include "IrrCompileConfig.h"
#include "CTRTextureGouraud.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
......
......@@ -11,6 +11,7 @@
#include "fast_atof.h"
#include "coreutil.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
#include "IFileSystem.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