diff --git a/changes.txt b/changes.txt
index 2636eb4d..001e58b9 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,5 +1,11 @@
Changes in 1.6
+ - Added PLY mesh writer
+
+ - Ensure ListBox on combo box doesn't hang off the bottom of the GUI root, by Matthias Specht
+
+ - Made IGUIElements recalculate clipping rectangle after setNotClipped, reported by Aelis440
+
- Bug fix for the combo box where it showed white text instead of skin colour before being focused, fix posted by drewbacca
- EGDS_MESSAGE_BOX_HEIGHT is now honoured, bug reported by Spkka
diff --git a/include/EMeshWriterEnums.h b/include/EMeshWriterEnums.h
index 8acc2853..da9df0eb 100644
--- a/include/EMeshWriterEnums.h
+++ b/include/EMeshWriterEnums.h
@@ -18,7 +18,7 @@ namespace scene
name clashes with external mesh writers.*/
enum EMESH_WRITER_TYPE
{
- //! Irrlicht Native mesh writer, for static .irrmesh files.
+ //! Irrlicht native mesh writer, for static .irrmesh files.
EMWT_IRR_MESH = MAKE_IRR_ID('i','r','r','m'),
//! COLLADA mesh writer for .dae and .xml files
@@ -28,7 +28,10 @@ namespace scene
EMWT_STL = MAKE_IRR_ID('s','t','l',0),
//! OBJ mesh writer for .obj files
- EMWT_OBJ = MAKE_IRR_ID('o','b','j',0)
+ EMWT_OBJ = MAKE_IRR_ID('o','b','j',0),
+
+ //! PLY mesh writer for .ply files
+ EMWT_PLY = MAKE_IRR_ID('p','l','y',0)
};
@@ -41,7 +44,7 @@ namespace scene
//! write lightmap textures out if possible
EMWF_WRITE_LIGHTMAPS = 0x1,
- //! write in a way that does consume less disk space
+ //! write in a way that consumes less disk space
EMWF_WRITE_COMPRESSED = 0x2
};
diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h
index fbd0697e..5c57ced9 100644
--- a/include/IrrCompileConfig.h
+++ b/include/IrrCompileConfig.h
@@ -275,6 +275,8 @@ B3D, MS3D or X meshes */
#define _IRR_COMPILE_WITH_STL_WRITER_
//! Define _IRR_COMPILE_WITH_OBJ_WRITER_ if you want to write .obj files
#define _IRR_COMPILE_WITH_OBJ_WRITER_
+//! Define _IRR_COMPILE_WITH_PLY_WRITER_ if you want to write .ply files
+#define _IRR_COMPILE_WITH_PLY_WRITER_
//! Define _IRR_COMPILE_WITH_BMP_LOADER_ if you want to load .bmp files
//! Disabling this loader will also disable the built-in font
diff --git a/source/Irrlicht/CPLYMeshWriter.cpp b/source/Irrlicht/CPLYMeshWriter.cpp
new file mode 100644
index 00000000..30a5123b
--- /dev/null
+++ b/source/Irrlicht/CPLYMeshWriter.cpp
@@ -0,0 +1,183 @@
+// Copyright (C) 2008-2009 Christian Stehno
+// 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_PLY_WRITER_
+
+#include "CPLYMeshWriter.h"
+#include "os.h"
+#include "IMesh.h"
+#include "IMeshBuffer.h"
+#include "IWriteFile.h"
+
+namespace irr
+{
+namespace scene
+{
+
+CPLYMeshWriter::CPLYMeshWriter()
+{
+ #ifdef _DEBUG
+ setDebugName("CPLYMeshWriter");
+ #endif
+}
+
+
+//! Returns the type of the mesh writer
+EMESH_WRITER_TYPE CPLYMeshWriter::getType() const
+{
+ return EMWT_PLY;
+}
+
+//! writes a mesh
+bool CPLYMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
+{
+ if (!file || !mesh)
+ return false;
+
+ os::Printer::log("Writing mesh", file->getFileName());
+
+ // write PLY header
+ core::stringc header =
+ "ply\n"
+ "format ascii 1.0\n"
+ "comment Irrlicht Engine ";
+ header += IRRLICHT_SDK_VERSION;
+
+ // get vertex and triangle counts
+ u32 VertexCount = 0;
+ u32 TriangleCount = 0;
+
+ for (u32 i=0; i < mesh->getMeshBufferCount(); ++i)
+ {
+ VertexCount += mesh->getMeshBuffer(i)->getVertexCount();
+ TriangleCount += mesh->getMeshBuffer(i)->getIndexCount() / 3;
+ }
+
+ // vertex definition
+ header += "\nelement vertex ";
+ header += VertexCount;
+
+ header += "\n"
+ "property float x\n"
+ "property float y\n"
+ "property float z\n"
+ "property float nx\n"
+ "property float ny\n"
+ "property float nz\n";
+ // todo: writer flags for extended (r,g,b,u,v) and non-standard (alpha,u1,uv,tx,ty,tz) properties
+ // "property uchar red\n"
+ // "property uchar green\n"
+ // "property uchar blue\n"
+ // "property uchar alpha\n"
+ // "property float u\n"
+ // "property float v\n";
+ // "property float u1\n
+ // "property float v1\n"
+ // "property float tx\n"
+ // "property float ty\n"
+ // "property float tz\n"
+
+ // face definition
+
+ header += "element face ";
+ header += TriangleCount;
+ header += "\n"
+ "property list uchar int vertex_indices\n"
+ "end_header\n";
+
+ // write header
+ file->write(header.c_str(), header.size());
+
+ // write vertices
+
+ c8 outLine[1024];
+
+ for (u32 i=0; i < mesh->getMeshBufferCount(); ++i)
+ {
+ scene::IMeshBuffer* mb = mesh->getMeshBuffer(i);
+ for (u32 j=0; j < mb->getVertexCount(); ++j)
+ {
+ const core::vector3df& pos = mb->getPosition(j);
+ const core::vector3df& n = mb->getNormal(j);
+ const core::vector2df& tc = mb->getTCoords(j);
+
+ u8 *buf = (u8*)mb->getVertices();
+ switch(mb->getVertexType())
+ {
+ case video::EVT_STANDARD:
+ buf += sizeof(video::S3DVertex)*j;
+ break;
+ case video::EVT_2TCOORDS:
+ buf += sizeof(video::S3DVertex2TCoords)*j;
+ break;
+ case video::EVT_TANGENTS:
+ buf += sizeof(video::S3DVertexTangents)*j;
+ break;
+ }
+ video::SColor &col = ( (video::S3DVertex*)buf )->Color;
+
+ // x y z nx ny nz red green blue alpha u v [u1 v1 | tx ty tz]\n
+ snprintf(outLine, 1024,
+ "%f %f %f %f %f %f\n",// %u %u %u %u %f %f\n",
+ pos.X, pos.Z, pos.Y, // Y and Z are flipped
+ n.X, n.Z, n.Y,
+ col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha(),
+ tc.X, tc.Y);
+
+ // write the line
+ file->write(outLine, strlen(outLine));
+ }
+ }
+
+ // index of the first vertex in the current mesh buffer
+ u32 StartOffset = 0;
+
+ // write triangles
+ for (u32 i=0; i < mesh->getMeshBufferCount(); ++i)
+ {
+ scene::IMeshBuffer* mb = mesh->getMeshBuffer(i);
+ for (u32 j=0; j < mb->getIndexCount(); j+=3)
+ {
+ // y and z are flipped so triangles are reversed
+ u32 a=StartOffset,
+ b=StartOffset,
+ c=StartOffset;
+
+ switch(mb->getIndexType())
+ {
+ case video::EIT_16BIT:
+ a += mb->getIndices()[j+0];
+ c += mb->getIndices()[j+1];
+ b += mb->getIndices()[j+2];
+ break;
+ case video::EIT_32BIT:
+ a += ((u32*)mb->getIndices()) [j+0];
+ c += ((u32*)mb->getIndices()) [j+0];
+ b += ((u32*)mb->getIndices()) [j+0];
+ break;
+ }
+
+ // count a b c\n
+ snprintf(outLine, 1024, "3 %u %u %u\n", a, b, c);
+ // write the line
+ file->write(outLine, strlen(outLine));
+ }
+
+ // increment offset
+ StartOffset += mb->getVertexCount();
+ }
+
+ // all done!
+
+
+ return true;
+}
+
+} // end namespace
+} // end namespace
+
+#endif
+
diff --git a/source/Irrlicht/CPLYMeshWriter.h b/source/Irrlicht/CPLYMeshWriter.h
new file mode 100644
index 00000000..1e23eed8
--- /dev/null
+++ b/source/Irrlicht/CPLYMeshWriter.h
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 Gaz Davidson
+// This file is part of the "Irrlicht Engine".
+// For conditions of distribution and use, see copyright notice in irrlicht.h
+
+#ifndef __IRR_PLY_MESH_WRITER_H_INCLUDED__
+#define __IRR_PLY_MESH_WRITER_H_INCLUDED__
+
+#include "IMeshWriter.h"
+
+namespace irr
+{
+
+namespace scene
+{
+ class IMeshBuffer;
+
+ //! class to write PLY mesh files
+ class CPLYMeshWriter : public IMeshWriter
+ {
+ public:
+
+ CPLYMeshWriter();
+
+ //! Returns the type of the mesh writer
+ virtual EMESH_WRITER_TYPE getType() const;
+
+ //! writes a mesh
+ virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags=EMWF_NONE);
+
+ };
+
+} // end namespace
+} // end namespace
+
+#endif
diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp
index 1a9688cb..a0986f22 100644
--- a/source/Irrlicht/CSceneManager.cpp
+++ b/source/Irrlicht/CSceneManager.cpp
@@ -105,6 +105,10 @@
#include "COBJMeshWriter.h"
#endif
+#ifdef _IRR_COMPILE_WITH_PLY_WRITER_
+#include "CPLYMeshWriter.h"
+#endif
+
#include "CCubeSceneNode.h"
#include "CSphereSceneNode.h"
#include "CAnimatedMeshSceneNode.h"
@@ -2498,6 +2502,13 @@ IMeshWriter* CSceneManager::createMeshWriter(EMESH_WRITER_TYPE type)
#else
return 0;
#endif
+
+ case EMWT_PLY:
+#ifdef _IRR_COMPILE_WITH_PLY_WRITER_
+ return new CPLYMeshWriter();
+#else
+ return 0;
+#endif
}
return 0;
diff --git a/source/Irrlicht/Irrlicht-gcc.cbp b/source/Irrlicht/Irrlicht-gcc.cbp
index 341d7112..fe2c548e 100644
--- a/source/Irrlicht/Irrlicht-gcc.cbp
+++ b/source/Irrlicht/Irrlicht-gcc.cbp
@@ -584,6 +584,8 @@
+
+
diff --git a/source/Irrlicht/Irrlicht.dev b/source/Irrlicht/Irrlicht.dev
index b871d0b6..42b3310b 100644
--- a/source/Irrlicht/Irrlicht.dev
+++ b/source/Irrlicht/Irrlicht.dev
@@ -9,7 +9,7 @@ CppCompiler=-D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -D_USRDLL -DIR
Includes=..\..\include;zlib
Linker=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lwinmm -lopengl32_@@_
Libs=
-UnitCount=613
+UnitCount=615
Folders=doc,gui_impl,include,include/core,include/gui,include/io,include/scene,include/video,io_impl,other_impl,other_impl/extern,other_impl/extern/jpeglib,other_impl/extern/libpng,other_impl/extern/zlib,scene_impl,scene_impl/animators,scene_impl/collision,scene_impl/mesh,scene_impl/mesh/loaders,scene_impl/mesh/writers,scene_impl/nodes,scene_impl/nodes/particles,video_impl,"video_impl/Burning Video",video_impl/DirectX8,video_impl/DirectX9,video_impl/Null,video_impl/OpenGL,video_impl/Software
ObjFiles=
PrivateResource=
@@ -6177,3 +6177,23 @@ Priority=1000
OverrideBuildCmd=0
BuildCmd=
+[Unit614]
+FileName=CPLYMeshWriter.cpp
+CompileCpp=1
+Folder=scene_impl/mesh/writers
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit615]
+FileName=CPLYMeshWriter.h
+CompileCpp=1
+Folder=scene_impl/mesh/writers
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
diff --git a/source/Irrlicht/Irrlicht7.1.vcproj b/source/Irrlicht/Irrlicht7.1.vcproj
index 3f1c0927..ce5add1f 100644
--- a/source/Irrlicht/Irrlicht7.1.vcproj
+++ b/source/Irrlicht/Irrlicht7.1.vcproj
@@ -1906,16 +1906,22 @@
RelativePath="CIrrMeshWriter.h">
+ RelativePath="COBJMeshWriter.cpp">
+ RelativePath="COBJMeshWriter.h">
+ RelativePath="CPLYMeshWriter.cpp">
+ RelativePath="CPLYMeshWriter.h">
+
+
+
+
@@ -2000,12 +2006,10 @@
+ RelativePath="CIrrDeviceConsole.cpp">
+ RelativePath="CIrrDeviceConsole.h">
diff --git a/source/Irrlicht/Irrlicht8.0.vcproj b/source/Irrlicht/Irrlicht8.0.vcproj
index 4cafef82..8b77d088 100644
--- a/source/Irrlicht/Irrlicht8.0.vcproj
+++ b/source/Irrlicht/Irrlicht8.0.vcproj
@@ -2657,6 +2657,14 @@
RelativePath="COBJMeshWriter.h"
>
+
+
+
+
diff --git a/source/Irrlicht/Irrlicht9.0.vcproj b/source/Irrlicht/Irrlicht9.0.vcproj
index 69a56f28..5fc2f0e7 100644
--- a/source/Irrlicht/Irrlicht9.0.vcproj
+++ b/source/Irrlicht/Irrlicht9.0.vcproj
@@ -2649,6 +2649,14 @@
RelativePath="COBJMeshWriter.h"
>
+
+
+
+
diff --git a/source/Irrlicht/Irrlicht_mobile6.vcproj b/source/Irrlicht/Irrlicht_mobile6.vcproj
index 56890fd8..80f6b94d 100644
--- a/source/Irrlicht/Irrlicht_mobile6.vcproj
+++ b/source/Irrlicht/Irrlicht_mobile6.vcproj
@@ -326,114 +326,114 @@
Name="include"
>
@@ -441,27 +441,27 @@
Name="core"
>
@@ -521,39 +521,39 @@
Name="io"
>
@@ -573,67 +573,67 @@
>
@@ -765,7 +765,7 @@
>
@@ -870,39 +870,39 @@
Name="gui impl"
>
@@ -1113,83 +1113,83 @@
Name="Software"
>
@@ -1197,67 +1197,67 @@
Name="OpenGL"
>
@@ -1265,47 +1265,47 @@
Name="Direct3D8"
>
@@ -1313,19 +1313,19 @@
Name="Null"
>
@@ -1477,55 +1477,55 @@
Name="Direct3D9"
>
@@ -1533,131 +1533,131 @@
Name="Burning Video"
>
@@ -1666,35 +1666,35 @@
Name="scene impl"
>
@@ -1909,43 +1909,43 @@
Name="sceneNodes"
>
@@ -2273,35 +2273,43 @@
Name="writers"
>
+
+
+
+
@@ -2310,63 +2318,63 @@
Name="io impl"
>
@@ -2430,11 +2438,11 @@
>
diff --git a/source/Irrlicht/Irrlicht_xbox.vcproj b/source/Irrlicht/Irrlicht_xbox.vcproj
index 9cb3795e..75f2a692 100644
--- a/source/Irrlicht/Irrlicht_xbox.vcproj
+++ b/source/Irrlicht/Irrlicht_xbox.vcproj
@@ -943,12 +943,10 @@
RelativePath=".\CGeometryCreator.h">
+ RelativePath=".\CIrrDeviceConsole.cpp">
+ RelativePath=".\CIrrDeviceConsole.h">
@@ -1090,6 +1088,13 @@
+
+
+
+
diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile
index b10debd1..32c94bd7 100644
--- a/source/Irrlicht/Makefile
+++ b/source/Irrlicht/Makefile
@@ -20,7 +20,7 @@ VERSION = 1.5
#List of object files, separated based on engine architecture
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o
-IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshWriter.o
+IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshWriter.o CPLYMeshWriter.o
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \
diff --git a/tools/MeshConverter/MeshConverter_v9.vcproj b/tools/MeshConverter/MeshConverter_v9.vcproj
new file mode 100644
index 00000000..888e90a7
--- /dev/null
+++ b/tools/MeshConverter/MeshConverter_v9.vcproj
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tools/MeshConverter/main.cpp b/tools/MeshConverter/main.cpp
index 107cc8ef..d6b878f6 100644
--- a/tools/MeshConverter/main.cpp
+++ b/tools/MeshConverter/main.cpp
@@ -18,7 +18,7 @@ void usage(const char* name)
std::cerr << "Usage: " << name << " [options] " << std::endl;
std::cerr << " where options are" << std::endl;
std::cerr << " --createTangents: convert to tangents mesh is possible." << std::endl;
- std::cerr << " --format=[irrmesh|collada|stl|obj]: Choose target format" << std::endl;
+ std::cerr << " --format=[irrmesh|collada|stl|obj|ply]: Choose target format" << std::endl;
}
int main(int argc, char* argv[])
@@ -31,9 +31,9 @@ int main(int argc, char* argv[])
}
IrrlichtDevice *device = createDevice( video::EDT_NULL,
- dimension2d(800, 600), 32, false, false, false, 0);
+ dimension2d(800, 600), 32, false, false, false, 0);
- device->setWindowCaption(L"Image Converter");
+ device->setWindowCaption(L"Mesh Converter");
scene::EMESH_WRITER_TYPE type = EMWT_IRR_MESH;
u32 i=1;
@@ -52,6 +52,8 @@ int main(int argc, char* argv[])
type = EMWT_STL;
else if (format=="obj")
type = EMWT_OBJ;
+ else if (format=="ply")
+ type = EMWT_PLY;
else
type = EMWT_IRR_MESH;
}
@@ -96,9 +98,10 @@ int main(int argc, char* argv[])
IMeshWriter* mw = device->getSceneManager()->createMeshWriter(type);
IWriteFile* file = device->getFileSystem()->createAndWriteFile(argv[destmesh]);
mw->writeMesh(file, mesh);
- mesh->drop();
+
file->drop();
mw->drop();
+ device->drop();
return 0;
}