Merging r5788 through r5805 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5806 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2019-04-23 20:17:39 +00:00
parent 902aa7fa5e
commit 291fb2ffac
39 changed files with 532 additions and 67 deletions

View File

@ -9,6 +9,10 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Add IMemoryReadFile interface which allows direct access to memory block used as file.
- Add IReadFile::getType() interface to all users to find out what kind of class implements that interface.
- .dae/Collada reader/writer now handle whitespace in texture-filenames with escape characters (handle them as xs:anyURI).
- Add function string::insert.
- EditBox now still allows overwriting characters when the text-length is at max.
- Bugfix: CMatrix4::transformPlane was calculating the wrong plane-normal before.
- SViewFrustum::recalculateBoundingBox no longer includes camera position in the bounding-box. Only using frustum corners now. Thx @DevSH for bugreport & patch.
@ -17,7 +21,7 @@ Changes in 1.9 (not yet released)
- Bugfix: CCameraSceneNode resets the IsOrthogonal flag to false now when it recalculates a projection matrix.
- SViewFrustum::setFrom and SViewFrustum constructor now use a parameter to allow to set the correct near clipping plane when the projection matrix doesn't use a target depth range of 0 to z, but for example -z to z. So OGL projections matrices can now also use it.
- Remove code to read boundingbox element in Collada reader as it's not in Collada specification.
- .dae/Collade reader now converts from Collada's right-handed to Irrlicht's left handed coordinate system (switching z to -z)
- .dae/Collada reader now converts from Collada's right-handed to Irrlicht's left handed coordinate system (switching z to -z)
- Add irr::string::eraseTrailingFloatZeros to kick out trailing 0's for strings generated from floats.
- .dae/Collada writer now converts from Irrlicht's left-handed to Collada's right-handed coordinate system (switching z to -z)
- Switch Collada writer to utf8 xml's.
@ -235,6 +239,9 @@ should now be fps independentn
--------------------------
Changes in 1.8.5
- Fix SViewFrustum::clipLine. Was before clipping at wrong points (inverse places along lines).
- Fix compilation on OSX and prevent capturing mouse cursor when Window is not on top (Patch #319)
Thanks at Artem Shoobovych for bugreport and patch (https://sourceforge.net/p/irrlicht/patches/319/)
- Fix serialization of OverrideTextColorEnabled flag in CGUITab. Thanks @ chronologicaldot for reporting (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52344&p=303891#p303891)
- CFileSystem::getAbsolutePath no longer wrongly converts an empty filename to "/" on unix platforms.
This fixes the bug that CFileSystem::createAndOpenFile("") returned a (strange behaving) non-null file pointer.

View File

@ -237,8 +237,8 @@ int main()
if (roomMesh)
{
// The Room mesh doesn't have proper Texture Mapping on the
// floor, so we can recreate them on runtime
// The room mesh doesn't have proper texture mapping on the
// floor, so we can recreate the mapping on runtime.
smgr->getMeshManipulator()->makePlanarTextureMapping(
roomMesh->getMesh(0), 0.003f);
@ -263,11 +263,7 @@ int main()
if (normalMap)
driver->makeNormalMapTexture(normalMap, 9.0f);
/*
// The Normal Map and the displacement map/height map in the alpha channel
video::ITexture* normalMap =
driver->getTexture(mediaPath + "rockwall_NRM.tga");
*/
/*
But just setting color and normal map is not everything. The
material we want to use needs some additional information per
@ -317,7 +313,7 @@ int main()
scene::IAnimatedMesh* earthMesh = smgr->getMesh(mediaPath + "earth.x");
if (earthMesh)
{
//perform various task with the mesh manipulator
//perform various tasks with the mesh manipulator
scene::IMeshManipulator *manipulator = smgr->getMeshManipulator();
// create mesh copy with tangent information from original earth.x mesh
@ -389,9 +385,9 @@ int main()
/*
Now the same again, with the second light. The difference is that we
add a particle system to it too. And because the light moves, the
particles of the particlesystem will follow. If you want to know more
particles of the particle system will follow. If you want to know more
about how particle systems are created in Irrlicht, take a look at the
specialFx example. Maybe you will have noticed that we only add 2
SpecialFX example. Maybe you will have noticed that we only add 2
lights, this has a simple reason: The low end version of this material
was written in ps1.1 and vs1.1, which doesn't allow more lights. You
could add a third light to the scene, but it won't be used to shade the

View File

@ -10,9 +10,7 @@ simple solution for building larger area on small heightmaps -> terrain
smoothing.
In the beginning there is nothing special. We include the needed header files
and create an event listener to listen if the user presses a key: The 'W' key
switches to wireframe mode, the 'P' key to pointcloud mode, and the 'D' key
toggles between solid and detail mapped material.
and create an event listener to listen if the user presses certain keys.
*/
#include <irrlicht.h>
#include "driverChoice.h"
@ -48,7 +46,7 @@ public:
!Terrain->getMaterial(0).Wireframe);
Terrain->setMaterialFlag(video::EMF_POINTCLOUD, false);
return true;
case irr::KEY_KEY_P: // switch wire frame mode
case irr::KEY_KEY_P: // switch point cloud mode
Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
!Terrain->getMaterial(0).PointCloud);
Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
@ -128,7 +126,7 @@ int main()
//set other font
env->getSkin()->setFont(env->getFont(mediaPath + "fontlucida.png"));
// add some help text
// add some help text (let's ignore 'P' and 'X' which are more about debugging)
env->addStaticText(
L"Press 'W' to change wireframe mode\nPress 'D' to toggle detail map\nPress 'S' to toggle skybox/skydome",
core::rect<s32>(10,421,250,475), true, true, 0, -1, true);
@ -147,13 +145,13 @@ int main()
/*
Here comes the terrain renderer scene node: We add it just like any
other scene node to the scene using
ISceneManager::addTerrainSceneNode(). The only parameter we use is a
ISceneManager::addTerrainSceneNode(). The first parameter is a
file name to the heightmap we use. A heightmap is simply a gray scale
texture. The terrain renderer loads it and creates the 3D terrain from
it.
To make the terrain look more big, we change the scale factor of
it to (40, 4.4, 40). Because we don't have any dynamic lights in the
To make the terrain look bigger, we change it's scale factor to
(40, 4.4, 40). Because we don't have any dynamic lights in the
scene, we switch off the lighting, and we set the file
terrain-texture.jpg as texture for the terrain and detailmap3.jpg as
second texture, called detail map. At last, we set the scale values for

View File

@ -1,11 +1,13 @@
/** Example 013 Render To Texture
This tutorial shows how to render to a texture using Irrlicht. Render to
texture is a feature with which it is possible to create nice special effects.
texture is a feature where everything which would usually be rendered to
the screen is instead written to a (special) texture. This can be used to
create nice special effects.
In addition, this tutorial shows how to enable specular highlights.
In the beginning, everything as usual. Include the needed headers, ask the user
for the rendering driver, create the Irrlicht Device:
for the rendering driver, create the Irrlicht device:
*/
#include <irrlicht.h>
@ -84,27 +86,36 @@ int main()
*/
// create test cube
scene::ISceneNode* test = smgr->addCubeSceneNode(60);
scene::ISceneNode* cube = smgr->addCubeSceneNode(60);
// let the cube rotate and set some light settings
scene::ISceneNodeAnimator* anim = smgr->createRotationAnimator(
core::vector3df(0.3f, 0.3f,0));
test->setPosition(core::vector3df(-100,0,-100));
test->setMaterialFlag(video::EMF_LIGHTING, false); // disable dynamic lighting
test->addAnimator(anim);
cube->setPosition(core::vector3df(-100,0,-100));
cube->setMaterialFlag(video::EMF_LIGHTING, false); // disable dynamic lighting
cube->addAnimator(anim);
anim->drop();
// set window caption
device->setWindowCaption(L"Irrlicht Engine - Render to Texture and Specular Highlights example");
/*
To test out the render to texture feature, we need a render target
texture. These are not like standard textures, but need to be created
first. To create one, we call IVideoDriver::addRenderTargetTexture()
and specify the size of the texture. Please don't use sizes bigger than
the frame buffer for this, because the render target shares the zbuffer
with the frame buffer.
To test out the render to texture feature, we need to define our
new rendertarget. The rendertarget will need one texture to receive
the result you would otherwise see on screen and one texture
which is used as depth-buffer.
(Note: If you worked with older Irrlicht versions (before 1.9) you might be
used to only create a rendertarget texture and no explicit rendertarget. While
that's still possible, it's no longer recommended.)
The rendertarget textures are not like standard textures, but need to be created
first. To create them, we call IVideoDriver::addRenderTargetTexture()
and specify the size of the texture and the type.
For depth-maps you can use types ECF_D16, ECF_D32 or ECF_D24S8. When ECF_D24S8
you can also use a stencil-buffer.
Because we want to render the scene not from the user camera into the
texture, we add another fixed camera to the scene. But before we do all
this, we check if the current running driver is able to render to
@ -113,19 +124,18 @@ int main()
// create render target
video::IRenderTarget* renderTarget = 0;
video::ITexture* renderTargetTex = 0;
scene::ICameraSceneNode* fixedCam = 0;
if (driver->queryFeature(video::EVDF_RENDER_TO_TARGET))
{
renderTargetTex = driver->addRenderTargetTexture(core::dimension2d<u32>(256, 256), "RTT1", video::ECF_A8R8G8B8);
video::ITexture* renderTargetDepth = driver->addRenderTargetTexture(core::dimension2d<u32>(256, 256), "DepthStencil", video::ECF_D16);
const core::dimension2d<u32> rtDim(256, 256); // always use same size for render target texture and it's depth-buffer
video::ITexture* renderTargetTex = driver->addRenderTargetTexture(rtDim, "RTT1", video::ECF_A8R8G8B8);
video::ITexture* renderTargetDepth = driver->addRenderTargetTexture(rtDim, "DepthStencil", video::ECF_D16);
renderTarget = driver->addRenderTarget();
renderTarget->setTexture(renderTargetTex, renderTargetDepth);
test->setMaterialTexture(0, renderTargetTex); // set material of cube to render target
cube->setMaterialTexture(0, renderTargetTex); // set material of cube to render target
// add fixed camera
fixedCam = smgr->addCameraSceneNode(0, core::vector3df(10,10,-80),
@ -174,22 +184,21 @@ int main()
{
// draw scene into render target
// set render target texture
// set render target
driver->setRenderTargetEx(renderTarget, video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,255));
// make cube invisible and set fixed camera as active camera
test->setVisible(false);
cube->setVisible(false);
smgr->setActiveCamera(fixedCam);
// draw whole scene into render buffer
smgr->drawAll();
// set back old render target
// The buffer might have been distorted, so clear it
driver->setRenderTargetEx(0, 0, video::SColor(0));
// set back old render target (the screen)
driver->setRenderTargetEx(0, 0);
// make the cube visible and set the user controlled camera as active one
test->setVisible(true);
cube->setVisible(true);
smgr->setActiveCamera(fpsCamera);
}

34
include/EReadFileType.h Normal file
View File

@ -0,0 +1,34 @@
// Copyright (C) Michael Zeilfelder
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __E_READ_FILE_TYPES_H_INCLUDED__
#define __E_READ_FILE_TYPES_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace io
{
//! An enumeration for different class types implementing IReadFile
enum EREAD_FILE_TYPE
{
//! CReadFile
ERFT_READ_FILE = MAKE_IRR_ID('r','e','a','d'),
//! CMemoryReadFile
ERFT_MEMORY_READ_FILE = MAKE_IRR_ID('r','m','e','m'),
//! CLimitReadFile
ERFT_LIMIT_READ_FILE = MAKE_IRR_ID('r','l','i','m'),
//! Unknown type
EFIT_UNKNOWN = MAKE_IRR_ID('u','n','k','n'),
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -154,6 +154,7 @@ namespace scene
//! Callback interface to use custom names on collada writing.
/** You can either modify names and id's written to collada or you can use
this interface to just find out which names are used on writing.
Names are often used later as xs:anyURI, so avoid whitespace, '#' and '%' in the names.
*/
class IColladaMeshWriterNames : public virtual IReferenceCounted
{
@ -165,7 +166,7 @@ namespace scene
/** Note that names really must be unique here per mesh-pointer, so
mostly it's a good idea to return the nameForMesh from
IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
the xs::NCName standard to be valid, you can run them through
the xs:NCName standard to be valid, you can run them through
IColladaMeshWriter::toNCName to ensure that.
\param mesh Pointer to the mesh which needs a name
\param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then
@ -177,7 +178,7 @@ namespace scene
/** Note that names really must be unique here per node-pointer, so
mostly it's a good idea to return the nameForNode from
IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
the xs::NCName standard to be valid, you can run them through
the xs:NCName standard to be valid, you can run them through
IColladaMeshWriter::toNCName to ensure that.
*/
virtual irr::core::stringc nameForNode(const scene::ISceneNode* node) = 0;
@ -190,7 +191,7 @@ namespace scene
instances per node are identical between different nodes you can reduce
the number of exported materials using that knowledge by using identical
names for such shared materials.
Names must follow the xs::NCName standard to be valid, you can run them
Names must follow the xs:NCName standard to be valid, you can run them
through IColladaMeshWriter::toNCName to ensure that.
*/
virtual irr::core::stringc nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0;
@ -382,7 +383,7 @@ namespace scene
return DefaultNameGenerator;
}
//! Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix.
//! Restrict the characters of oldString a set of allowed characters in xs:NCName and add the prefix.
/** A tool function to help when using a custom name generator to generative valid names for collada names and id's. */
virtual irr::core::stringc toNCName(const irr::core::stringc& oldString, const irr::core::stringc& prefix=irr::core::stringc("_NC_")) const = 0;

31
include/IMemoryReadFile.h Normal file
View File

@ -0,0 +1,31 @@
// Copyright Michael Zeilfelder
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_MEMORY_READ_FILE_H_INCLUDED__
#define __I_MEMORY_READ_FILE_H_INCLUDED__
#include "IReadFile.h"
namespace irr
{
namespace io
{
//! Interface providing read access to a memory read file.
class IMemoryReadFile : public IReadFile
{
public:
//! Get direct access to internal buffer of memory block used as file.
/** It's usually better to use the IReadFile functions to access
the file content. But as that buffer exist over the full life-time
of a CMemoryReadFile, it's sometimes nice to avoid the additional
data-copy which read() needs.
*/
virtual const void *getBuffer() const = 0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "coreutil.h"
#include "EReadFileType.h"
namespace irr
{
@ -42,6 +43,12 @@ namespace io
//! Get name of file.
/** \return File name as zero terminated character string. */
virtual const io::path& getFileName() const = 0;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const
{
return EFIT_UNKNOWN;
}
};
//! Internal function, please do not use.

View File

@ -439,6 +439,54 @@ tool <http://developer.nvidia.com/object/nvperfhud_home.html>. */
//! Uncomment the following line if you want to ignore the deprecated warnings
//#define IGNORE_DEPRECATED_WARNING
//! Define _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_ to support ShadowVolumes
#define _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#undef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_OCTREE_SCENENODE_ to support OctreeSceneNodes
#define _IRR_COMPILE_WITH_OCTREE_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_OCTREE_SCENENODE_
#undef _IRR_COMPILE_WITH_OCTREE_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_TERRAIN_SCENENODE_ to support TerrainSceneNodes
#define _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#undef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_ to support BillboardSceneNodes
#define _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#undef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_ to support WaterSurfaceSceneNodes
#define _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#undef _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_SKYDOME_SCENENODE_ to support SkydomeSceneNodes
#define _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#undef _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_CUBE_SCENENODE_ to support CubeSceneNodes
#define _IRR_COMPILE_WITH_CUBE_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_CUBE_SCENENODE_
#undef _IRR_COMPILE_WITH_CUBE_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_SPHERE_SCENENODE_ to support CubeSceneNodes
#define _IRR_COMPILE_WITH_SPHERE_SCENENODE_
#ifdef NO_IRR_COMPILE_WITH_SPHERE_SCENENODE_
#undef _IRR_COMPILE_WITH_SPHERE_SCENENODE_
#endif
//! Define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_ if you want to be able to load
/** .irr scenes using ISceneManager::loadScene */
#define _IRR_COMPILE_WITH_IRR_SCENE_LOADER_

View File

@ -92,6 +92,7 @@ struct S3DVertex
return EVT_STANDARD;
}
//\param d d=0 returns other, d=1 returns this, values between interpolate.
S3DVertex getInterpolated(const S3DVertex& other, f32 d)
{
d = core::clamp(d, 0.0f, 1.0f);
@ -170,6 +171,7 @@ struct S3DVertex2TCoords : public S3DVertex
return EVT_2TCOORDS;
}
//\param d d=0 returns other, d=1 returns this, values between interpolate.
S3DVertex2TCoords getInterpolated(const S3DVertex2TCoords& other, f32 d)
{
d = core::clamp(d, 0.0f, 1.0f);

View File

@ -448,7 +448,7 @@ namespace video
//! Interpolates the color with a f32 value to another color
/** \param other: Other color
\param d: value between 0.0f and 1.0f
\param d: value between 0.0f and 1.0f. d=0 returns other, d=1 returns this, values between interpolate.
\return Interpolated color. */
SColor getInterpolated(const SColor &other, f32 d) const
{

View File

@ -402,13 +402,13 @@ namespace scene
if (planes[i].classifyPointRelation(line.start) == core::ISREL3D_FRONT)
{
line.start = line.start.getInterpolated(line.end,
planes[i].getKnownIntersectionWithLine(line.start, line.end));
1.f-planes[i].getKnownIntersectionWithLine(line.start, line.end));
wasClipped = true;
}
if (planes[i].classifyPointRelation(line.end) == core::ISREL3D_FRONT)
{
line.end = line.start.getInterpolated(line.end,
planes[i].getKnownIntersectionWithLine(line.start, line.end));
1.f-planes[i].getKnownIntersectionWithLine(line.start, line.end));
wasClipped = true;
}
}

View File

@ -191,7 +191,7 @@ namespace core
//! Get the interpolated dimension
/** \param other Other dimension to interpolate with.
\param d Value between 0.0f and 1.0f.
\param d Value between 0.0f and 1.0f. d=0 returns other, d=1 returns this, values between interpolate.
\return Interpolated dimension. */
dimension2d<T> getInterpolated(const dimension2d<T>& other, f32 d) const
{

View File

@ -730,6 +730,32 @@ public:
return *this;
}
//! Insert a certain amount of characters into the string before the given index
//\param pos Insert the characters before this index
//\param s String to insert. Must be at least of size n
//\param n Number of characters from string s to use.
string<T,TAlloc>& insert(u32 pos, const char* s, u32 n)
{
if ( pos < used )
{
reserve(used+n);
// move stuff behind insert point
const u32 end = used+n-1;
for (u32 i=0; i<used-pos; ++i)
{
array[end-i] = array[end-(i+n)];
}
used += n;
for (u32 i=0; i<n; ++i)
{
array[pos+i] = s[i];
}
}
return *this;
}
//! Reserves some memory.
/** \param count: Amount of characters to reserve. */

View File

@ -7,7 +7,11 @@
#include "ISceneManager.h"
#include "S3DVertex.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "IAnimatedMeshMD3.h"
#include "CSkinnedMesh.h"
#include "IDummyTransformationSceneNode.h"
@ -556,6 +560,7 @@ u32 CAnimatedMeshSceneNode::getMaterialCount() const
IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -567,6 +572,9 @@ IShadowVolumeSceneNode* CAnimatedMeshSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}
//! Returns a pointer to a child node, which has the same transformation as

View File

@ -2,6 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#include "CBillboardSceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
@ -316,3 +318,4 @@ ISceneNode* CBillboardSceneNode::clone(ISceneNode* newParent, ISceneManager* new
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_

View File

@ -332,6 +332,22 @@ CColladaFileLoader::CColladaFileLoader(scene::ISceneManager* smgr,
setDebugName("CColladaFileLoader");
#endif
// Escape characters, see https://www.w3schools.com/tags/ref_urlencode.asp
// TODO: There should be more, but usually people just escape the space character anyway.
// And I'm not sure if our xml files are utf-8 or windows-1252, so let's avoid the ambiguous ones.
EscapeCharsAnyURI.push_back(EscapeCharacterURL(' ', "%20"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('"', "%22"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('#', "%23"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('$', "%24"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('%', "%25"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('&', "%26"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('\'', "%27"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('(', "%28"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL(')', "%29"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('/', "%2F"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('\\', "%5C"));
TextureLoader = new CMeshTextureLoader( FileSystem, SceneManager->getVideoDriver() );
}
@ -1209,6 +1225,7 @@ void CColladaFileLoader::readImage(io::IXMLReaderUTF8* reader)
reader->read();
image.Source = reader->getNodeData();
image.Source.trim();
unescape(image.Source);
image.SourceIsFilename=true;
}
else
@ -2742,8 +2759,8 @@ void CColladaFileLoader::clearData()
//! changes the XML URI into an internal id
void CColladaFileLoader::uriToId(core::stringc& str)
{
// currently, we only remove the # from the begin if there
// because we simply don't support referencing other files.
// Currently, we only remove the # from the beginning
// as we don't support referencing other files.
if (!str.size())
return;
@ -2942,6 +2959,47 @@ core::matrix4 CColladaFileLoader::flipZAxis(const core::matrix4& m)
return matrix;
}
void CColladaFileLoader::unescape(irr::core::stringc& uri)
{
u32 len = uri.size();
for (u32 i=0; i<len-1; ++i)
{
if (uri[i] == '%' )
{
if (uri[i+1] == '%')
{
++i;
continue;
}
for (u32 e = 0; e < EscapeCharsAnyURI.size(); ++e)
{
const irr::core::stringc& escapeString = EscapeCharsAnyURI[e].Escape;
const u32 escapeLen = escapeString.size();
bool equals = true;
for ( u32 c = 1; c<escapeLen; ++c) // string compare (and we already know first on fits as always '%')
{
if ( uri[i+c] != escapeString[c] )
{
equals = false;
break;
}
}
if ( equals )
{
uri[i] = EscapeCharsAnyURI[e].Character;
// TODO: core::string has no erase function which erases more than one char at a time currently
for ( u32 a=0;a<escapeLen-1; ++a)
uri.erase(i+1);
len -= escapeLen-1;
break;
}
}
}
}
}
} // end namespace scene
} // end namespace irr

View File

@ -344,6 +344,9 @@ private:
//! Note that function is symmetric (no difference if called before or after a transpose).
core::matrix4 flipZAxis(const core::matrix4& m);
//! replace escape characters with the unescaped ones
void unescape(irr::core::stringc& uri);
scene::ISceneManager* SceneManager;
io::IFileSystem* FileSystem;
@ -369,6 +372,19 @@ private:
core::array< core::array<irr::scene::IMeshBuffer*> > MeshesToBind;
bool CreateInstances;
struct EscapeCharacterURL
{
EscapeCharacterURL(irr::c8 c, const irr::c8* e)
: Character(c)
{
Escape = e;
}
irr::c8 Character; // unescaped (like ' ')
irr::core::stringc Escape; // escaped (like '%20')
};
irr::core::array<EscapeCharacterURL> EscapeCharsAnyURI;
};

View File

@ -178,7 +178,7 @@ irr::core::stringc CColladaMeshWriterNames::nameForMesh(const scene::IMesh* mesh
irr::core::stringc CColladaMeshWriterNames::nameForNode(const scene::ISceneNode* node)
{
irr::core::stringc name;
// Prefix, because xs::ID can't start with a number, also nicer name
// Prefix, because xs:ID can't start with a number, also nicer name
if ( node && node->getType() == ESNT_LIGHT )
name = "light";
else
@ -235,6 +235,17 @@ CColladaMeshWriter::CColladaMeshWriter( ISceneManager * smgr, video::IVideoDrive
if ( smgr )
setAmbientLight( smgr->getAmbientLight() );
// Escape some characters
// Slightly fuzzy definition for xs:anyURI.
// In theory not even spaces would need to be escaped,
// but it's strongly encouraged to do so and many Apps rely on it.
// If there are any apps out there which need more escapes we can add them.
// See https://www.w3schools.com/tags/ref_urlencode.asp for a list.
// NOTE: Never replace by empty characters (so not the place to delete chars!)
EscapeCharsAnyURI.push_back(EscapeCharacterURL(' ', "%20"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('#', "%23"));
EscapeCharsAnyURI.push_back(EscapeCharacterURL('%', "%25"));
CColladaMeshWriterProperties * p = new CColladaMeshWriterProperties();
setDefaultProperties(p);
setProperties(p);
@ -1214,7 +1225,7 @@ bool CColladaMeshWriter::isXmlNameChar(c8 c) const
*/
}
// Restrict the characters to a set of allowed characters in xs::NCName.
// Restrict the characters to a set of allowed characters in xs:NCName.
irr::core::stringc CColladaMeshWriter::toNCName(const irr::core::stringc& oldString, const irr::core::stringc& prefix) const
{
irr::core::stringc result(prefix); // help to ensure id starts with a valid char and reduce chance of name-conflicts
@ -1249,7 +1260,7 @@ const irr::core::stringc* CColladaMeshWriter::findGeometryNameForNode(ISceneNode
return &colladaMesh.findGeometryNameForNode(node);
}
// Restrict the characters to a set of allowed characters in xs::NCName.
// Restrict the characters to a set of allowed characters in xs:anyURI
irr::core::stringc CColladaMeshWriter::pathToURI(const irr::io::path& path) const
{
irr::core::stringc result;
@ -1269,7 +1280,25 @@ irr::core::stringc CColladaMeshWriter::pathToURI(const irr::io::path& path) cons
}
result.append(path);
// TODO: make correct URI (without whitespaces)
// Make correct URI (without whitespace)
u32 len = result.size();
for (u32 i=0; i<len; ++i)
{
for (u32 e = 0; e < EscapeCharsAnyURI.size(); ++e)
{
if (result[i] == EscapeCharsAnyURI[e].Character)
{
// escape characters should always be at least 3 characters
const u32 addLen = EscapeCharsAnyURI[e].Escape.size() - 1;
result[i] = EscapeCharsAnyURI[e].Escape[0]; // replace first one
result.insert(i+1, &EscapeCharsAnyURI[e].Escape[1], addLen); // insert rest
i += addLen;
len += addLen;
break;
}
}
}
return result;
}
@ -1375,7 +1404,7 @@ void CColladaMeshWriter::writeMaterialEffect(const irr::core::stringc& materialf
// <init_from>internal_texturename</init_from>
Writer->writeElement("init_from", false);
irr::io::path p(FileSystem->getRelativeFilename(layer.Texture->getName().getPath(), Directory));
Writer->writeText(toNCName(irr::core::stringc(p)).c_str());
Writer->writeText(toNCName(irr::core::stringc(p)).c_str()); // same ID for internal name as in writeLibraryImages
Writer->writeClosingTag("init_from");
Writer->writeLineBreak();

View File

@ -93,7 +93,7 @@ public:
//! writes a mesh
virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags=EMWF_NONE) _IRR_OVERRIDE_;
// Restrict the characters of oldString a set of allowed characters in xs::NCName and add the prefix.
// Restrict the characters of oldString a set of allowed characters in xs:NCName and add the prefix.
virtual irr::core::stringc toNCName(const irr::core::stringc& oldString, const irr::core::stringc& prefix=irr::core::stringc("_NC_")) const _IRR_OVERRIDE_;
//! After export you can find out which name had been used for writing the geometry for this node.
@ -260,6 +260,19 @@ protected:
irr::core::array< MaterialName > MaterialNameCache;
irr::core::stringc WriteBuffer; // use for writing short strings to avoid regular memory allocations
struct EscapeCharacterURL
{
EscapeCharacterURL(irr::c8 c, const irr::c8* e)
: Character(c)
{
Escape = e;
}
irr::c8 Character; // unescaped (like ' ')
irr::core::stringc Escape; // escaped (like '%20')
};
irr::core::array<EscapeCharacterURL> EscapeCharsAnyURI;
};

View File

@ -2,13 +2,19 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_CUBE_SCENENODE
#include "CCubeSceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
#include "S3DVertex.h"
#include "SMeshBuffer.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
namespace irr
{
@ -147,6 +153,7 @@ bool CCubeSceneNode::removeChild(ISceneNode* child)
IShadowVolumeSceneNode* CCubeSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -158,6 +165,9 @@ IShadowVolumeSceneNode* CCubeSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}
@ -233,3 +243,4 @@ ISceneNode* CCubeSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_CUBE_SCENENODE

View File

@ -46,6 +46,12 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_LIMIT_READ_FILE;
}
private:
io::path Filename;

View File

@ -5,7 +5,7 @@
#ifndef __C_MEMORY_READ_FILE_H_INCLUDED__
#define __C_MEMORY_READ_FILE_H_INCLUDED__
#include "IReadFile.h"
#include "IMemoryReadFile.h"
#include "IWriteFile.h"
#include "irrString.h"
@ -18,7 +18,7 @@ namespace io
/*!
Class for reading from memory.
*/
class CMemoryReadFile : public IReadFile
class CMemoryReadFile : public IMemoryReadFile
{
public:
@ -43,6 +43,18 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_MEMORY_READ_FILE;
}
//! Get direct access to internal buffer
virtual const void *getBuffer() const _IRR_OVERRIDE_
{
return Buffer;
}
private:
const void *Buffer;

View File

@ -11,7 +11,11 @@
#include "IAnimatedMesh.h"
#include "IMaterialRenderer.h"
#include "IFileSystem.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
namespace irr
{
@ -297,6 +301,7 @@ void CMeshSceneNode::setMesh(IMesh* mesh)
IShadowVolumeSceneNode* CMeshSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -308,6 +313,9 @@ IShadowVolumeSceneNode* CMeshSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}

View File

@ -1714,7 +1714,10 @@ IImage* CNullDriver::createImage(ITexture* texture, const core::position2d<s32>&
{
if ((pos==core::position2di(0,0)) && (size == texture->getSize()))
{
IImage* image = new CImage(texture->getColorFormat(), size, texture->lock(ETLM_READ_ONLY), false, false);
void * data = texture->lock(ETLM_READ_ONLY);
if ( !data)
return 0;
IImage* image = new CImage(texture->getColorFormat(), size, data, false, false);
texture->unlock();
return image;
}

View File

@ -2,6 +2,9 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_OCTREE_SCENENODE_
#include "COctreeSceneNode.h"
#include "Octree.h"
#include "ISceneManager.h"
@ -11,7 +14,11 @@
#include "IAnimatedMesh.h"
#include "IMaterialRenderer.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "EProfileIDs.h"
#include "IProfiler.h"
@ -339,6 +346,7 @@ EOCTREE_POLYGON_CHECKS COctreeSceneNode::getPolygonChecks() const
IShadowVolumeSceneNode* COctreeSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -350,6 +358,9 @@ IShadowVolumeSceneNode* COctreeSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}
@ -671,3 +682,4 @@ bool COctreeSceneNode::isReadOnlyMaterials() const
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_OCTREE_SCENENODE_

View File

@ -339,7 +339,9 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
if (status != GL_TRUE)
{
os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
core::stringc typeInfo("shaderType: ");
typeInfo += core::stringc((unsigned long)shaderType);
os::Printer::log("GLSL (> 2.x) shader failed to compile", typeInfo.c_str(), ELL_ERROR);
// check error message and log it
GLint maxLength=0;
GLint length;
@ -375,7 +377,9 @@ bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shad
if (!status)
{
os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
core::stringc typeInfo("shaderType: ");
typeInfo += core::stringc((unsigned long)shaderType);
os::Printer::log("GLSL shader failed to compile", typeInfo.c_str(), ELL_ERROR);
// check error message and log it
GLint maxLength=0;
GLsizei length;
@ -414,7 +418,7 @@ bool COpenGLSLMaterialRenderer::linkProgram()
if (!status)
{
os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
os::Printer::log("GLSL (> 2.x) shader program failed to link", ELL_ERROR);
// check error message and log it
GLint maxLength=0;
GLsizei length;
@ -452,7 +456,7 @@ bool COpenGLSLMaterialRenderer::linkProgram()
if (maxlen == 0)
{
os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
os::Printer::log("GLSL (> 2.x): failed to retrieve uniform information", ELL_ERROR);
return false;
}

View File

@ -14,7 +14,11 @@
#include "IMeshManipulator.h"
#include "SMesh.h"
#include "IMaterialRenderer.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif
namespace irr
{
@ -516,6 +520,7 @@ bool CQuake3ShaderSceneNode::removeChild(ISceneNode* child)
IShadowVolumeSceneNode* CQuake3ShaderSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -527,6 +532,9 @@ IShadowVolumeSceneNode* CQuake3ShaderSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}

View File

@ -47,6 +47,12 @@ namespace io
//! returns name of file
virtual const io::path& getFileName() const _IRR_OVERRIDE_;
//! Get the type of the class implementing this interface
virtual EREAD_FILE_TYPE getType() const _IRR_OVERRIDE_
{
return ERFT_READ_FILE;
}
//! create read file on disk.
static IReadFile* createReadFile(const io::path& fileName);

View File

@ -138,24 +138,38 @@
#include "CB3DMeshWriter.h"
#endif
#ifdef _IRR_COMPILE_WITH_CUBE_SCENENODE
#include "CCubeSceneNode.h"
#endif // _IRR_COMPILE_WITH_CUBE_SCENENODE
#ifdef _IRR_COMPILE_WITH_SPHERE_SCENENODE_
#include "CSphereSceneNode.h"
#endif
#include "CAnimatedMeshSceneNode.h"
#ifdef _IRR_COMPILE_WITH_OCTREE_SCENENODE_
#include "COctreeSceneNode.h"
#endif // #ifdef _IRR_COMPILE_WITH_OCTREE_SCENENODE_
#include "CCameraSceneNode.h"
#include "CLightSceneNode.h"
#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#include "CBillboardSceneNode.h"
#endif // _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
#include "CMeshSceneNode.h"
#include "CSkyBoxSceneNode.h"
#ifdef _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#include "CSkyDomeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#ifdef _IRR_COMPILE_WITH_PARTICLES_
#include "CParticleSystemSceneNode.h"
#endif // _IRR_COMPILE_WITH_PARTICLES_
#include "CDummyTransformationSceneNode.h"
#ifdef _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#include "CWaterSurfaceSceneNode.h"
#endif // _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CTerrainSceneNode.h"
#endif // _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CEmptySceneNode.h"
#include "CTextSceneNode.h"
#include "CQuake3ShaderSceneNode.h"
@ -168,7 +182,9 @@
#include "COctreeTriangleSelector.h"
#include "CTriangleBBSelector.h"
#include "CMetaTriangleSelector.h"
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CTerrainTriangleSelector.h"
#endif // _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CSceneNodeAnimatorRotation.h"
#include "CSceneNodeAnimatorFlyCircle.h"
@ -588,6 +604,7 @@ IMeshSceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent,
s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{
#ifdef _IRR_COMPILE_WITH_CUBE_SCENENODE
if (!parent)
parent = this;
@ -595,6 +612,9 @@ IMeshSceneNode* CSceneManager::addCubeSceneNode(f32 size, ISceneNode* parent,
node->drop();
return node;
#else
return 0;
#endif
}
@ -603,6 +623,7 @@ IMeshSceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount,
ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{
#ifdef _IRR_COMPILE_WITH_SPHERE_SCENENODE_
if (!parent)
parent = this;
@ -610,6 +631,9 @@ IMeshSceneNode* CSceneManager::addSphereSceneNode(f32 radius, s32 polyCount,
node->drop();
return node;
#else
return 0;
#endif // _IRR_COMPILE_WITH_SPHERE_SCENENODE_
}
@ -637,6 +661,7 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
ISceneNode* parent, s32 id, const core::vector3df& position,
const core::vector3df& rotation, const core::vector3df& scale)
{
#ifdef _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
if (!parent)
parent = this;
@ -646,6 +671,9 @@ ISceneNode* CSceneManager::addWaterSurfaceSceneNode(IMesh* mesh, f32 waveHeight,
node->drop();
return node;
#else
return 0;
#endif
}
@ -689,6 +717,7 @@ IOctreeSceneNode* CSceneManager::addOctreeSceneNode(IAnimatedMesh* mesh, ISceneN
IOctreeSceneNode* CSceneManager::addOctreeSceneNode(IMesh* mesh, ISceneNode* parent,
s32 id, s32 minimalPolysPerNode, bool alsoAddIfMeshPointerZero)
{
#ifdef _IRR_COMPILE_WITH_OCTREE_SCENENODE_
if (!alsoAddIfMeshPointerZero && !mesh)
return 0;
@ -704,6 +733,9 @@ IOctreeSceneNode* CSceneManager::addOctreeSceneNode(IMesh* mesh, ISceneNode* par
}
return node;
#else
return 0;
#endif
}
@ -801,6 +833,7 @@ IBillboardSceneNode* CSceneManager::addBillboardSceneNode(ISceneNode* parent,
video::SColor colorTop, video::SColor colorBottom
)
{
#ifdef _IRR_COMPILE_WITH_BILLBOARD_SCENENODE_
if (!parent)
parent = this;
@ -809,6 +842,9 @@ IBillboardSceneNode* CSceneManager::addBillboardSceneNode(ISceneNode* parent,
node->drop();
return node;
#else
return 0;
#endif
}
@ -835,6 +871,7 @@ ISceneNode* CSceneManager::addSkyDomeSceneNode(video::ITexture* texture,
u32 horiRes, u32 vertRes, f32 texturePercentage,f32 spherePercentage, f32 radius,
ISceneNode* parent, s32 id)
{
#ifdef _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
if (!parent)
parent = this;
@ -843,6 +880,9 @@ ISceneNode* CSceneManager::addSkyDomeSceneNode(video::ITexture* texture,
node->drop();
return node;
#else
return 0;
#endif
}
@ -909,6 +949,7 @@ ITerrainSceneNode* CSceneManager::addTerrainSceneNode(
s32 smoothFactor,
bool addAlsoIfHeightmapEmpty)
{
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
if (!parent)
parent = this;
@ -933,6 +974,9 @@ ITerrainSceneNode* CSceneManager::addTerrainSceneNode(
node->drop();
return node;
#else
return 0;
#endif // _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
}
@ -1920,7 +1964,11 @@ IMetaTriangleSelector* CSceneManager::createMetaTriangleSelector()
ITriangleSelector* CSceneManager::createTerrainTriangleSelector(
ITerrainSceneNode* node, s32 LOD)
{
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
return new CTerrainTriangleSelector(node, LOD);
#else
return 0;
#endif
}

View File

@ -2,6 +2,10 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#include "ISceneManager.h"
#include "IMesh.h"
@ -417,3 +421,5 @@ void CShadowVolumeSceneNode::calculateAdjacency()
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_

View File

@ -3,6 +3,8 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h
// Code for this scene node has been contributed by Anders la Cour-Harbo (alc)
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_SKYDOME_SCENENODE_
#include "CSkyDomeSceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
@ -262,3 +264,5 @@ ISceneNode* CSkyDomeSceneNode::clone(ISceneNode* newParent, ISceneManager* newMa
} // namespace scene
} // namespace irr
#endif // _IRR_COMPILE_WITH_SKYDOME_SCENENODE_

View File

@ -2,12 +2,18 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_SPHERE_SCENENODE_
#include "CSphereSceneNode.h"
#include "IVideoDriver.h"
#include "ISceneManager.h"
#include "S3DVertex.h"
#include "os.h"
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
#include "CShadowVolumeSceneNode.h"
#else
#include "IShadowVolumeSceneNode.h"
#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
namespace irr
{
@ -83,6 +89,7 @@ bool CSphereSceneNode::removeChild(ISceneNode* child)
IShadowVolumeSceneNode* CSphereSceneNode::addShadowVolumeSceneNode(
const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)
{
#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_
if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))
return 0;
@ -94,6 +101,9 @@ IShadowVolumeSceneNode* CSphereSceneNode::addShadowVolumeSceneNode(
Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id, zfailmethod, infinity);
return Shadow;
#else
return 0;
#endif
}
@ -197,3 +207,4 @@ ISceneNode* CSphereSceneNode::clone(ISceneNode* newParent, ISceneManager* newMan
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_SPHERE_SCENENODE_

View File

@ -7,6 +7,10 @@
// distributed under this licence. I only modified some parts. A lot of thanks
// go to him.
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CTerrainSceneNode.h"
#include "CTerrainTriangleSelector.h"
#include "IVideoDriver.h"
@ -1511,4 +1515,4 @@ namespace scene
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_TERRAIN_SCENENODE_

View File

@ -2,6 +2,10 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_TERRAIN_SCENENODE_
#include "CTerrainTriangleSelector.h"
#include "CTerrainSceneNode.h"
#include "os.h"
@ -263,3 +267,5 @@ const ITriangleSelector* CTerrainTriangleSelector::getSelector(u32 index) const
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_TERRAIN_SCENENODE_

View File

@ -2,6 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_
#include "CWaterSurfaceSceneNode.h"
#include "ISceneManager.h"
#include "IMeshManipulator.h"
@ -135,3 +137,4 @@ f32 CWaterSurfaceSceneNode::addWave(const core::vector3df &source, f32 time) con
} // end namespace scene
} // end namespace irr
#endif // _IRR_COMPILE_WITH_WATER_SURFACE_SCENENODE_

View File

@ -424,6 +424,7 @@
<Unit filename="../../include/EMeshWriterEnums.h" />
<Unit filename="../../include/EMessageBoxFlags.h" />
<Unit filename="../../include/EPrimitiveTypes.h" />
<Unit filename="../../include/EReadFileType.h" />
<Unit filename="../../include/ESceneNodeAnimatorTypes.h" />
<Unit filename="../../include/ESceneNodeTypes.h" />
<Unit filename="../../include/EShaderTypes.h" />
@ -486,6 +487,7 @@
<Unit filename="../../include/ILogger.h" />
<Unit filename="../../include/IMaterialRenderer.h" />
<Unit filename="../../include/IMaterialRendererServices.h" />
<Unit filename="../../include/IMemoryReadFile.h" />
<Unit filename="../../include/IMesh.h" />
<Unit filename="../../include/IMeshBuffer.h" />
<Unit filename="../../include/IMeshCache.h" />

View File

@ -180,6 +180,29 @@ bool testAppendStringc()
return true;
}
bool testInsert()
{
core::stringc str;
str.insert(0, "something", 4);
if (str != "some")
return false;
str.insert(4, "thing", 5);
if (str != "something")
return false;
str.insert(0, "is ", 3);
if (str != "is something")
return false;
str.insert(3, "there ", 6);
if (str != "is there something")
return false;
return true;
}
bool testLowerUpper()
{
irr::core::array <irr::core::stringc> stringsOrig, targetLower, targetUpper;
@ -356,6 +379,8 @@ bool testIrrString(void)
}
allExpected &= testAppendStringc();
allExpected &= testInsert();
logTestString("Test io::path\n");
{
// Only test that this type exists, it's one from above

View File

@ -1,4 +1,4 @@
Tests finished. 1 test of 1 passed.
Compiled as DEBUG
Test suite pass at GMT Fri Feb 22 17:53:28 2019
Test suite pass at GMT Fri Mar 15 13:00:55 2019