From 990d475fbbb2653c95b992937906eb49960d02fb Mon Sep 17 00:00:00 2001 From: cutealien Date: Wed, 27 Feb 2019 20:30:26 +0000 Subject: [PATCH] Merging r5686 through r5778 from trunk to ogl-es branch (part 2) (was in wrong folder in last commit, so only source folder got checked in). Also adapt ES1 and ES2 driver to remove texture from OGL texture cache (that was fixed in GL driver in the parts that got merged). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5780 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 13 +++ include/IAttributes.h | 2 +- include/IColladaMeshWriter.h | 56 +++++++++++-- include/IFileSystem.h | 16 +++- include/IGUIEnvironment.h | 2 +- include/ISceneManager.h | 1 + include/IXMLWriter.h | 65 ++------------- include/SViewFrustum.h | 39 ++++++--- include/coreutil.h | 7 +- include/irrString.h | 44 ++++++++++- include/irrXML.h | 61 +++++++++++++++ include/matrix4.h | 126 +++++++++++++++++++++++------- include/vector2d.h | 2 +- lib/Linux/readme.txt | 2 + lib/OSX/readme.txt | 2 + lib/Win32-gcc/readme.txt | 2 + lib/Win32-visualstudio/readme.txt | 2 + lib/Win64-visualStudio/readme.txt | 2 + source/Irrlicht/COGLES2Driver.cpp | 4 +- source/Irrlicht/COGLESDriver.cpp | 4 +- tests/irrString.cpp | 34 ++++++++ tests/media/OpenGL-orthoCam.png | Bin 4381 -> 4623 bytes tests/orthoCam.cpp | 6 +- tests/planeMatrix.cpp | 93 ++++++++++++---------- tests/tests-last-passed-at.txt | 2 +- 25 files changed, 415 insertions(+), 172 deletions(-) create mode 100644 lib/Linux/readme.txt create mode 100644 lib/OSX/readme.txt create mode 100644 lib/Win32-gcc/readme.txt create mode 100644 lib/Win32-visualstudio/readme.txt create mode 100644 lib/Win64-visualStudio/readme.txt diff --git a/changes.txt b/changes.txt index 1ea822aa..0fb39a19 100644 --- a/changes.txt +++ b/changes.txt @@ -9,6 +9,19 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point) -------------------------- Changes in 1.9 (not yet released) +- 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. +- Camera uses now OGL projection matrices with OpenGL driver. Fixes wrong near-plane values with OpenGL (showed too much before). +- Add a flag to most CMatrix4::buildProjectionMatrix functions to allow creating OpenGL projection matrices (target range of -w to w instead of 0 to w). +- 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) +- 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. +- Add IXMLWriterUTF8 +- IColladaMeshWriter::writeScene got an additional flag to decide if root should be written. - _IRR_MATERIAL_MAX_TEXTURES_ now set to 8 by default. So we can use now 8 textures per material without recompiling the engine. Additionally there's a new global variable irr::video::MATERIAL_MAX_TEXTURES_USED which can be set to lower numbers to avoid most of the costs coming with this for people not needing more textures. But using more textures via _IRR_MATERIAL_MAX_TEXTURES_ also has become less calculation intensive than it was in the past, so in release builds the difference is hardly noticeable. diff --git a/include/IAttributes.h b/include/IAttributes.h index 90dce63a..507561d8 100644 --- a/include/IAttributes.h +++ b/include/IAttributes.h @@ -24,6 +24,7 @@ #include "irrString.h" #include "irrArray.h" #include "IXMLReader.h" +#include "IXMLWriter.h" #include "EAttributes.h" #include "path.h" @@ -35,7 +36,6 @@ namespace video } // end namespace video namespace io { - class IXMLWriter; //! Provides a generic interface for attributes and their values and the possibility to serialize them class IAttributes : public virtual IReferenceCounted diff --git a/include/IColladaMeshWriter.h b/include/IColladaMeshWriter.h index 8a9f779c..cbd4030e 100644 --- a/include/IColladaMeshWriter.h +++ b/include/IColladaMeshWriter.h @@ -171,7 +171,7 @@ namespace scene \param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then several instances of the same mesh can be written and this counts them. */ - virtual irr::core::stringw nameForMesh(const scene::IMesh* mesh, int instance) = 0; + virtual irr::core::stringc nameForMesh(const scene::IMesh* mesh, int instance) = 0; //! Return a unique name for the given node /** Note that names really must be unique here per node-pointer, so @@ -180,7 +180,7 @@ namespace scene the xs::NCName standard to be valid, you can run them through IColladaMeshWriter::toNCName to ensure that. */ - virtual irr::core::stringw nameForNode(const scene::ISceneNode* node) = 0; + virtual irr::core::stringc nameForNode(const scene::ISceneNode* node) = 0; //! Return a name for the material /** There is one material created in the writer for each unique name. @@ -193,7 +193,7 @@ namespace scene Names must follow the xs::NCName standard to be valid, you can run them through IColladaMeshWriter::toNCName to ensure that. */ - virtual irr::core::stringw nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0; + virtual irr::core::stringc nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0; }; @@ -206,8 +206,11 @@ namespace scene : Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0) , WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true) , AmbientLight(0.f, 0.f, 0.f, 1.f) + , UnitMeter(1.f), UnitName("meter") , GeometryWriting(ECGI_PER_MESH) { + ParamNamesUV[0] = "U"; + ParamNamesUV[1] = "V"; } //! Destructor @@ -224,7 +227,8 @@ namespace scene } //! writes a scene starting with the given node - virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root) = 0; + //\param writeRoot: 0 = no, 1=yes unless root is scenemanager, 2=yes + virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root, int writeRoot=1) = 0; //! Set if texture information should be written @@ -267,6 +271,28 @@ namespace scene return AmbientLight; } + //! Set the unit distances for all elements and objects + /** + \param meter: Real-world meters to use per unit. Default 1 unit = 1 meter. For 1 unit = 1cm you would set to 0.01 + \param name: Name to use for distance unit. Default is "meter". */ + virtual void setUnit(irr::f32 meter, const irr::core::stringc& name) + { + UnitMeter = meter; + UnitName = name; + } + + //! Return real world meters to use per unit for all elements and objects + virtual irr::f32 getUnitMeter() const + { + return UnitMeter; + } + + //! Return name to use for distance units. Like p.E. "meter". + virtual irr::core::stringc getUnitName() const + { + return UnitName; + } + //! Control when and how often a mesh is written /** Optimally ECGI_PER_MESH would be always sufficient - writing geometry once per mesh. Unfortunately many tools (at the time of writing this nearly all of them) have trouble @@ -358,13 +384,26 @@ namespace scene //! 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::stringw toNCName(const irr::core::stringw& oldString, const irr::core::stringw& prefix=irr::core::stringw(L"_NC_")) const = 0; + virtual irr::core::stringc toNCName(const irr::core::stringc& oldString, const irr::core::stringc& prefix=irr::core::stringc("_NC_")) const = 0; //! After export you can find out which name had been used for writing the geometry for this node. /** The name comes from IColladaMeshWriterNames::nameForMesh, but you can't access the node there. \return Either a pointer to the name or NULL */ // TODO: Function is not const because there is no const getMesh() function for several Irrlicht nodes. - virtual const irr::core::stringw* findGeometryNameForNode(ISceneNode* node) = 0; + virtual const irr::core::stringc* findGeometryNameForNode(ISceneNode* node) = 0; + + //! Change param name used for UV's. + /** Param names for UV's have a name. By default it's "U" and "V". + Usually it doesn't matter as names are optional in Collada anyway. + But unfortunately some tools insist on specific names. + So if "U", "V" does not work then try to export by setting this to "S", "T". + One tool which insists on "S", "T" is for example SketchUp. + */ + void SetParamNamesUV(const core::stringc& u, const core::stringc& v) + { + ParamNamesUV[0] = u; + ParamNamesUV[1] = v; + } protected: @@ -392,6 +431,9 @@ namespace scene DefaultNameGenerator = p; } + protected: + irr::core::stringc ParamNamesUV[2]; + private: IColladaMeshWriterProperties * Properties; IColladaMeshWriterProperties * DefaultProperties; @@ -401,6 +443,8 @@ namespace scene bool WriteDefaultScene; bool ExportSMaterialOnce; video::SColorf AmbientLight; + irr::f32 UnitMeter; + irr::core::stringc UnitName; E_COLLADA_GEOMETRY_WRITING GeometryWriting; }; diff --git a/include/IFileSystem.h b/include/IFileSystem.h index 48e217ef..f9a6ee61 100644 --- a/include/IFileSystem.h +++ b/include/IFileSystem.h @@ -7,6 +7,7 @@ #include "IReferenceCounted.h" #include "IXMLReader.h" +#include "IXMLWriter.h" #include "IFileArchive.h" namespace irr @@ -21,7 +22,6 @@ namespace io class IReadFile; class IWriteFile; class IFileList; -class IXMLWriter; class IAttributes; @@ -354,6 +354,20 @@ public: See IReferenceCounted::drop() for more information. */ virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0; + //! Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*). + /** \return 0, if file could not be opened, otherwise a pointer to the created + IXMLWriter is returned. After use, the reader + has to be deleted using its IXMLWriter::drop() method. + See IReferenceCounted::drop() for more information. */ + virtual IXMLWriterUTF8* createXMLWriterUTF8(const path& filename) =0; + + //! Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*). + /** \return 0, if file could not be opened, otherwise a pointer to the created + IXMLWriter is returned. After use, the reader + has to be deleted using its IXMLWriter::drop() method. + See IReferenceCounted::drop() for more information. */ + virtual IXMLWriterUTF8* createXMLWriterUTF8(IWriteFile* file) =0; + //! Creates a XML Writer from a file. /** \return 0, if file could not be opened, otherwise a pointer to the created IXMLWriter is returned. After use, the reader diff --git a/include/IGUIEnvironment.h b/include/IGUIEnvironment.h index 0fc2a8ec..f58b80a3 100644 --- a/include/IGUIEnvironment.h +++ b/include/IGUIEnvironment.h @@ -12,6 +12,7 @@ #include "EFocusFlags.h" #include "IEventReceiver.h" #include "IXMLReader.h" +#include "IXMLWriter.h" #include "path.h" namespace irr @@ -21,7 +22,6 @@ namespace irr namespace io { - class IXMLWriter; class IReadFile; class IWriteFile; class IFileSystem; diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 81c5d98c..e9db1ef6 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -19,6 +19,7 @@ #include "SceneParameters.h" #include "IGeometryCreator.h" #include "ISkinnedMesh.h" +#include "IXMLWriter.h" namespace irr { diff --git a/include/IXMLWriter.h b/include/IXMLWriter.h index a68cac9c..18c40e28 100644 --- a/include/IXMLWriter.h +++ b/include/IXMLWriter.h @@ -6,72 +6,21 @@ #define __I_XML_WRITER_H_INCLUDED__ #include "IReferenceCounted.h" -#include "irrArray.h" -#include "irrString.h" +#include "irrXML.h" namespace irr { namespace io { + //! An xml writer for wide characters, derived from IReferenceCounted. + /** Call IFileSystem::createXMLReader(). to create an IXMLWriter */ + typedef IIrrXMLWriter IXMLWriter; - //! Interface providing methods for making it easier to write XML files. - /** This XML Writer writes xml files using in the platform dependent - wchar_t format and sets the xml-encoding correspondingly. */ - class IXMLWriter : public virtual IReferenceCounted - { - public: - //! Writes an xml 1.0 header. - /** Looks like <?xml version="1.0"?>. This should always - be called before writing anything other, because also the text - file header for Unicode texts is written out with this method. */ - virtual void writeXMLHeader() = 0; - - //! Writes an xml element with maximal 5 attributes like "" or - //! <foo optAttr="value" />. - /** The element can be empty or not. - \param name: Name of the element - \param empty: Specifies if the element should be empty. Like - "". If You set this to false, something like this is - written instead: "". - \param attr1Name: 1st attributes name - \param attr1Value: 1st attributes value - \param attr2Name: 2nd attributes name - \param attr2Value: 2nd attributes value - \param attr3Name: 3rd attributes name - \param attr3Value: 3rd attributes value - \param attr4Name: 4th attributes name - \param attr4Value: 4th attributes value - \param attr5Name: 5th attributes name - \param attr5Value: 5th attributes value */ - virtual void writeElement(const wchar_t* name, bool empty=false, - const wchar_t* attr1Name = 0, const wchar_t* attr1Value = 0, - const wchar_t* attr2Name = 0, const wchar_t* attr2Value = 0, - const wchar_t* attr3Name = 0, const wchar_t* attr3Value = 0, - const wchar_t* attr4Name = 0, const wchar_t* attr4Value = 0, - const wchar_t* attr5Name = 0, const wchar_t* attr5Value = 0) = 0; - - //! Writes an xml element with any number of attributes - virtual void writeElement(const wchar_t* name, bool empty, - core::array &names, core::array &values) = 0; - - //! Writes a comment into the xml file - virtual void writeComment(const wchar_t* comment) = 0; - - //! Writes the closing tag for an element. Like "" - virtual void writeClosingTag(const wchar_t* name) = 0; - - //! Writes a text into the file. - /** All occurrences of special characters such as - & (&), < (<), > (>), and " (") are automatically - replaced. */ - virtual void writeText(const wchar_t* text) = 0; - - //! Writes a line break - virtual void writeLineBreak() = 0; - }; + //! An xml writer for ASCII or UTF-8 characters, derived from IReferenceCounted. + /** Call IFileSystem::createXMLReaderUtf8(). to create an IXMLWriter */ + typedef IIrrXMLWriter IXMLWriterUTF8; } // end namespace io } // end namespace irr #endif - diff --git a/include/SViewFrustum.h b/include/SViewFrustum.h index ee7db2b3..b1d53e39 100644 --- a/include/SViewFrustum.h +++ b/include/SViewFrustum.h @@ -51,10 +51,12 @@ namespace scene SViewFrustum(const SViewFrustum& other); //! This constructor creates a view frustum based on a projection and/or view matrix. - SViewFrustum(const core::matrix4& mat); + //\param zClipFromZero: Clipping of z can be projected from 0 to w when true (D3D style) and from -w to w when false (OGL style). + SViewFrustum(const core::matrix4& mat, bool zClipFromZero); //! This constructor creates a view frustum based on a projection and/or view matrix. - inline void setFrom(const core::matrix4& mat); + //\param zClipFromZero: Clipping of z can be projected from 0 to w when true (D3D style) and from -w to w when false (OGL style). + inline void setFrom(const core::matrix4& mat, bool zClipFromZero); //! transforms the frustum by the matrix /** \param mat: Matrix by which the view frustum is transformed.*/ @@ -159,9 +161,9 @@ namespace scene BoundingCenter = other.BoundingCenter; } - inline SViewFrustum::SViewFrustum(const core::matrix4& mat) + inline SViewFrustum::SViewFrustum(const core::matrix4& mat, bool zClipFromZero) { - setFrom(mat); + setFrom(mat, zClipFromZero); } @@ -262,12 +264,14 @@ namespace scene inline void SViewFrustum::recalculateBoundingBox() { - boundingBox.reset ( cameraPosition ); - - boundingBox.addInternalPoint(getFarLeftUp()); + boundingBox.reset(getNearLeftUp()); + boundingBox.addInternalPoint(getNearRightUp()); + boundingBox.addInternalPoint(getNearLeftDown()); + boundingBox.addInternalPoint(getNearRightDown()); boundingBox.addInternalPoint(getFarRightUp()); boundingBox.addInternalPoint(getFarLeftDown()); boundingBox.addInternalPoint(getFarRightDown()); + boundingBox.addInternalPoint(getFarLeftUp()); // Also recalculate the bounding sphere when the bbox changes recalculateBoundingSphere(); @@ -290,7 +294,7 @@ namespace scene //! This constructor creates a view frustum based on a projection //! and/or view matrix. - inline void SViewFrustum::setFrom(const core::matrix4& mat) + inline void SViewFrustum::setFrom(const core::matrix4& mat, bool zClipFromZero) { // left clipping plane planes[VF_LEFT_PLANE].Normal.X = mat[3 ] + mat[0]; @@ -323,10 +327,21 @@ namespace scene planes[VF_FAR_PLANE].D = mat[15] - mat[14]; // near clipping plane - planes[VF_NEAR_PLANE].Normal.X = mat[2]; - planes[VF_NEAR_PLANE].Normal.Y = mat[6]; - planes[VF_NEAR_PLANE].Normal.Z = mat[10]; - planes[VF_NEAR_PLANE].D = mat[14]; + if ( zClipFromZero ) + { + planes[VF_NEAR_PLANE].Normal.X = mat[2]; + planes[VF_NEAR_PLANE].Normal.Y = mat[6]; + planes[VF_NEAR_PLANE].Normal.Z = mat[10]; + planes[VF_NEAR_PLANE].D = mat[14]; + } + else + { + // near clipping plane + planes[VF_NEAR_PLANE].Normal.X = mat[3 ] + mat[2]; + planes[VF_NEAR_PLANE].Normal.Y = mat[7 ] + mat[6]; + planes[VF_NEAR_PLANE].Normal.Z = mat[11] + mat[10]; + planes[VF_NEAR_PLANE].D = mat[15] + mat[14]; + } // normalize normals u32 i; diff --git a/include/coreutil.h b/include/coreutil.h index 072a6b3a..b042a5b4 100644 --- a/include/coreutil.h +++ b/include/coreutil.h @@ -175,7 +175,7 @@ static inline void splitFilename(const io::path &name, io::path* path=0, static inline io::path mergeFilename(const io::path& path, const io::path& filename, const io::path& extension = "") { io::path result(path); - + if ( !result.empty() ) { fschar_t last = result.lastChar(); @@ -190,15 +190,12 @@ static inline io::path mergeFilename(const io::path& path, const io::path& filen result += _IRR_TEXT('.'); result += extension; } - + return result; } //! some standard function ( to remove dependencies ) -#undef isdigit -#undef isspace -#undef isupper inline s32 isdigit(s32 c) { return c >= '0' && c <= '9'; } inline s32 isspace(s32 c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; } inline s32 isupper(s32 c) { return c >= 'A' && c <= 'Z'; } diff --git a/include/irrString.h b/include/irrString.h index abf92370..2643c975 100644 --- a/include/irrString.h +++ b/include/irrString.h @@ -36,6 +36,7 @@ outside the string class for explicit use. template > class string; static size_t multibyteToWString(string& destination, const char* source, u32 sourceSize); +inline s32 isdigit(s32 c); enum eLocaleID { @@ -1244,7 +1245,7 @@ public: //! Trims the string. /** Removes the specified characters (by default, Latin-1 whitespace) - from the begining and the end of the string. */ + from the beginning and the end of the string. */ string& trim(const string & whitespace = " \t\n\r") { // find start and end of the substring without the specified characters @@ -1257,6 +1258,41 @@ public: return (*this = subString(begin, (end +1) - begin)); } + //! Erase 0's at the end when a string ends with a floating point number + /** After generating strings from floats we often end up with strings + ending up with lots of zeros which don't add any value. Erase 'em all. + Examples: "0.100000" becomes "0.1" + "10.000000" becomes "10" + "foo 3.140000" becomes "foo 3.14" + "no_num.000" stays "no_num.000" + "1." stays "1." + */ + string& eraseTrailingFloatZeros(char decimalPoint='.') + { + s32 i=findLastCharNotInList("0", 1); + if ( i > 0 && (u32)i < used-2 ) // non 0 must be found and not last char (also used is at least 2 when i > 0) + { + u32 eraseStart=i+1; + u32 dot=0; + if( core::isdigit(array[i]) ) + { + while( --i>0 && core::isdigit(array[i]) ); + if ( array[i] == decimalPoint ) + dot = i; + } + else if ( array[i] == decimalPoint ) + { + dot = i; + eraseStart = i; + } + if ( dot > 0 && core::isdigit(array[dot-1]) ) + { + array[eraseStart] = 0; + used = eraseStart+1; + } + } + return *this; + } //! Erases a character from the string. /** May be slow, because all elements @@ -1331,7 +1367,7 @@ public: return 0; const u32 oldSize=ret.size(); - + u32 tokenStartIdx = 0; for (u32 i=0; i()); } - tokenStartIdx = i+1; + tokenStartIdx = i+1; break; } } } if ((used - 1) > tokenStartIdx) ret.push_back(string(&array[tokenStartIdx], (used - 1) - tokenStartIdx)); - + return ret.size()-oldSize; } diff --git a/include/irrXML.h b/include/irrXML.h index 5957e086..57c3b549 100644 --- a/include/irrXML.h +++ b/include/irrXML.h @@ -7,6 +7,8 @@ #include #include "IrrCompileConfig.h" +#include "irrArray.h" +#include "irrString.h" /** \mainpage irrXML 1.2 API documentation
@@ -370,6 +372,65 @@ namespace io virtual ETEXT_FORMAT getParserFormat() const = 0; }; + //! Interface providing methods for making it easier to write XML files. + template + class IIrrXMLWriter : public super_class + { + public: + + //! Destructor + virtual ~IIrrXMLWriter() {} + + //! Writes an xml 1.0 header. + /** Looks like <?xml version="1.0"?>. This should always + be called before writing anything other, because also the text + file header for Unicode texts is written out with this method. */ + virtual void writeXMLHeader() = 0; + + //! Writes an xml element with maximal 5 attributes like "" or + //! <foo optAttr="value" />. + /** The element can be empty or not. + \param name: Name of the element + \param empty: Specifies if the element should be empty. Like + "". If You set this to false, something like this is + written instead: "". + \param attr1Name: 1st attributes name + \param attr1Value: 1st attributes value + \param attr2Name: 2nd attributes name + \param attr2Value: 2nd attributes value + \param attr3Name: 3rd attributes name + \param attr3Value: 3rd attributes value + \param attr4Name: 4th attributes name + \param attr4Value: 4th attributes value + \param attr5Name: 5th attributes name + \param attr5Value: 5th attributes value */ + virtual void writeElement(const char_type* name, bool empty=false, + const char_type* attr1Name = 0, const char_type* attr1Value = 0, + const char_type* attr2Name = 0, const char_type* attr2Value = 0, + const char_type* attr3Name = 0, const char_type* attr3Value = 0, + const char_type* attr4Name = 0, const char_type* attr4Value = 0, + const char_type* attr5Name = 0, const char_type* attr5Value = 0) = 0; + + //! Writes an xml element with any number of attributes + virtual void writeElement(const char_type* name, bool empty, + core::array > &names, core::array > &values) = 0; + + //! Writes a comment into the xml file + virtual void writeComment(const char_type* comment) = 0; + + //! Writes the closing tag for an element. Like "" + virtual void writeClosingTag(const char_type* name) = 0; + + //! Writes a text into the file. + /** All occurrences of special characters such as + & (&), < (<), > (>), and " (") are automatically + replaced. */ + virtual void writeText(const char_type* text) = 0; + + //! Writes a line break + virtual void writeLineBreak() = 0; + }; + template struct xmlChar diff --git a/include/matrix4.h b/include/matrix4.h index e41f7858..615e77ad 100644 --- a/include/matrix4.h +++ b/include/matrix4.h @@ -289,25 +289,27 @@ namespace core bool getInverse(CMatrix4& out) const; //! Builds a right-handed perspective projection matrix based on a field of view - CMatrix4& buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar); + //\param zClipFromZero: Clipping of z can be projected from 0 to w when true (D3D style) and from -w to w when false (OGL style). + CMatrix4& buildProjectionMatrixPerspectiveFovRH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix based on a field of view - CMatrix4& buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar); + CMatrix4& buildProjectionMatrixPerspectiveFovLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix based on a field of view, with far plane at infinity CMatrix4& buildProjectionMatrixPerspectiveFovInfinityLH(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 epsilon=0); //! Builds a right-handed perspective projection matrix. - CMatrix4& buildProjectionMatrixPerspectiveRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar); + CMatrix4& buildProjectionMatrixPerspectiveRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed perspective projection matrix. - CMatrix4& buildProjectionMatrixPerspectiveLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar); + CMatrix4& buildProjectionMatrixPerspectiveLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed orthogonal projection matrix. - CMatrix4& buildProjectionMatrixOrthoLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar); + //\param zClipFromZero: Clipping of z can be projected from 0 to 1 when true (D3D style) and from -1 to 1 when false (OGL style). + CMatrix4& buildProjectionMatrixOrthoLH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a right-handed orthogonal projection matrix. - CMatrix4& buildProjectionMatrixOrthoRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar); + CMatrix4& buildProjectionMatrixOrthoRH(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero=true); //! Builds a left-handed look-at matrix. CMatrix4& buildCameraLookAtMatrixLH( @@ -1235,9 +1237,8 @@ namespace core // Transform the normal by the transposed inverse of the matrix CMatrix4 transposedInverse(*this, EM4CONST_INVERSE_TRANSPOSED); vector3df normal = plane.Normal; - transposedInverse.transformVect(normal); - - plane.setPlane(member, normal); + transposedInverse.rotateVect(normal); + plane.setPlane(member, normal.normalize()); } //! Transforms a plane by this matrix @@ -1542,7 +1543,7 @@ namespace core // Builds a right-handed perspective projection matrix based on a field of view template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovRH( - f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar) + f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero) { const f64 h = reciprocal(tan(fieldOfViewRadians*0.5)); _IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero @@ -1561,16 +1562,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(zFar/(zNear-zFar)); // DirectX version -// M[10] = (T)(zFar+zNear/(zNear-zFar)); // OpenGL version + //M[10] M[11] = -1; M[12] = 0; M[13] = 0; - M[14] = (T)(zNear*zFar/(zNear-zFar)); // DirectX version -// M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); // OpenGL version + //M[14] M[15] = 0; + if ( zClipFromZero ) // DirectX version + { + M[10] = (T)(zFar/(zNear-zFar)); + M[14] = (T)(zNear*zFar/(zNear-zFar)); + } + else // OpenGL version + { + M[10] = (T)((zFar+zNear)/(zNear-zFar)); + M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif @@ -1581,7 +1591,7 @@ namespace core // Builds a left-handed perspective projection matrix based on a field of view template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveFovLH( - f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar) + f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar, bool zClipFromZero) { const f64 h = reciprocal(tan(fieldOfViewRadians*0.5)); _IRR_DEBUG_BREAK_IF(aspectRatio==0.f); //divide by zero @@ -1600,14 +1610,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(zFar/(zFar-zNear)); + //M[10] M[11] = 1; M[12] = 0; M[13] = 0; - M[14] = (T)(-zNear*zFar/(zFar-zNear)); + //M[14] M[15] = 0; + if ( zClipFromZero ) // DirectX version + { + M[10] = (T)(zFar/(zFar-zNear)); + M[14] = (T)(-zNear*zFar/(zFar-zNear)); + } + else // OpenGL version + { + M[10] = (T)((zFar+zNear)/(zFar-zNear)); + M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif @@ -1654,7 +1675,7 @@ namespace core // Builds a left-handed orthogonal projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixOrthoLH( - f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) + f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero) { _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero @@ -1671,14 +1692,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(1/(zFar-zNear)); + // M[10] M[11] = 0; - + M[12] = 0; M[13] = 0; - M[14] = (T)(zNear/(zNear-zFar)); + // M[14] M[15] = 1; + if ( zClipFromZero ) + { + M[10] = (T)(1/(zFar-zNear)); + M[14] = (T)(zNear/(zNear-zFar)); + } + else + { + M[10] = (T)(2/(zFar-zNear)); + M[14] = (T)-(zFar+zNear)/(zFar-zNear); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif @@ -1689,7 +1721,7 @@ namespace core // Builds a right-handed orthogonal projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixOrthoRH( - f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) + f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero) { _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero @@ -1706,14 +1738,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(1/(zNear-zFar)); + // M[10] M[11] = 0; M[12] = 0; M[13] = 0; - M[14] = (T)(zNear/(zNear-zFar)); + // M[14] M[15] = 1; + if ( zClipFromZero ) + { + M[10] = (T)(1/(zNear-zFar)); + M[14] = (T)(zNear/(zNear-zFar)); + } + else + { + M[10] = (T)(2/(zNear-zFar)); + M[14] = (T)-(zFar+zNear)/(zFar-zNear); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif @@ -1724,7 +1767,7 @@ namespace core // Builds a right-handed perspective projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveRH( - f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) + f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero) { _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero @@ -1741,14 +1784,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(zFar/(zNear-zFar)); + //M[10] M[11] = -1; M[12] = 0; M[13] = 0; - M[14] = (T)(zNear*zFar/(zNear-zFar)); + //M[14] M[15] = 0; + if ( zClipFromZero ) // DirectX version + { + M[10] = (T)(zFar/(zNear-zFar)); + M[14] = (T)(zNear*zFar/(zNear-zFar)); + } + else // OpenGL version + { + M[10] = (T)((zFar+zNear)/(zNear-zFar)); + M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif @@ -1759,7 +1813,7 @@ namespace core // Builds a left-handed perspective projection matrix. template inline CMatrix4& CMatrix4::buildProjectionMatrixPerspectiveLH( - f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) + f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar, bool zClipFromZero) { _IRR_DEBUG_BREAK_IF(widthOfViewVolume==0.f); //divide by zero _IRR_DEBUG_BREAK_IF(heightOfViewVolume==0.f); //divide by zero @@ -1776,13 +1830,25 @@ namespace core M[8] = 0; M[9] = 0; - M[10] = (T)(zFar/(zFar-zNear)); + //M[10] M[11] = 1; M[12] = 0; M[13] = 0; - M[14] = (T)(zNear*zFar/(zNear-zFar)); + //M[14] = (T)(zNear*zFar/(zNear-zFar)); M[15] = 0; + + if ( zClipFromZero ) // DirectX version + { + M[10] = (T)(zFar/(zFar-zNear)); + M[14] = (T)(zNear*zFar/(zNear-zFar)); + } + else // OpenGL version + { + M[10] = (T)((zFar+zNear)/(zFar-zNear)); + M[14] = (T)(2.0f*zNear*zFar/(zNear-zFar)); + } + #if defined ( USE_MATRIX_TEST ) definitelyIdentityMatrix=false; #endif diff --git a/include/vector2d.h b/include/vector2d.h index b8eaf70b..b158a033 100644 --- a/include/vector2d.h +++ b/include/vector2d.h @@ -323,7 +323,7 @@ public: (T)(Y * mul0 + v2.Y * mul1 + v3.Y * mul2)); } - /*! Test if this point and another 2 poitns taken as triplet + /*! Test if this point and another 2 points taken as triplet are colinear, clockwise, anticlockwise. This can be used also to check winding order in triangles for 2D meshes. \return 0 if points are colinear, 1 if clockwise, 2 if anticlockwise diff --git a/lib/Linux/readme.txt b/lib/Linux/readme.txt new file mode 100644 index 00000000..40bad90a --- /dev/null +++ b/lib/Linux/readme.txt @@ -0,0 +1,2 @@ +You might have to recompile the engine to get library files in here. +Check the readme.txt in the corresponding bin folders for more information. diff --git a/lib/OSX/readme.txt b/lib/OSX/readme.txt new file mode 100644 index 00000000..40bad90a --- /dev/null +++ b/lib/OSX/readme.txt @@ -0,0 +1,2 @@ +You might have to recompile the engine to get library files in here. +Check the readme.txt in the corresponding bin folders for more information. diff --git a/lib/Win32-gcc/readme.txt b/lib/Win32-gcc/readme.txt new file mode 100644 index 00000000..40bad90a --- /dev/null +++ b/lib/Win32-gcc/readme.txt @@ -0,0 +1,2 @@ +You might have to recompile the engine to get library files in here. +Check the readme.txt in the corresponding bin folders for more information. diff --git a/lib/Win32-visualstudio/readme.txt b/lib/Win32-visualstudio/readme.txt new file mode 100644 index 00000000..40bad90a --- /dev/null +++ b/lib/Win32-visualstudio/readme.txt @@ -0,0 +1,2 @@ +You might have to recompile the engine to get library files in here. +Check the readme.txt in the corresponding bin folders for more information. diff --git a/lib/Win64-visualStudio/readme.txt b/lib/Win64-visualStudio/readme.txt new file mode 100644 index 00000000..40bad90a --- /dev/null +++ b/lib/Win64-visualStudio/readme.txt @@ -0,0 +1,2 @@ +You might have to recompile the engine to get library files in here. +Check the readme.txt in the corresponding bin folders for more information. diff --git a/source/Irrlicht/COGLES2Driver.cpp b/source/Irrlicht/COGLES2Driver.cpp index 9c8008a7..f40eaa93 100644 --- a/source/Irrlicht/COGLES2Driver.cpp +++ b/source/Irrlicht/COGLES2Driver.cpp @@ -2586,9 +2586,7 @@ COGLES2Driver::~COGLES2Driver() void COGLES2Driver::removeTexture(ITexture* texture) { - if (!texture) - return; - + CacheHandler->getTextureCache().remove(texture); CNullDriver::removeTexture(texture); } diff --git a/source/Irrlicht/COGLESDriver.cpp b/source/Irrlicht/COGLESDriver.cpp index 9c2ce704..ed151f7c 100644 --- a/source/Irrlicht/COGLESDriver.cpp +++ b/source/Irrlicht/COGLESDriver.cpp @@ -2929,9 +2929,7 @@ IImage* COGLES1Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE void COGLES1Driver::removeTexture(ITexture* texture) { - if (!texture) - return; - + CacheHandler->getTextureCache().remove(texture); CNullDriver::removeTexture(texture); } diff --git a/tests/irrString.cpp b/tests/irrString.cpp index 08ff6728..f2ce776c 100644 --- a/tests/irrString.cpp +++ b/tests/irrString.cpp @@ -260,6 +260,14 @@ bool testFindFunctions() if ( p >= 0 ) return false; + irr::core::stringc lastX("max"); + p = lastX.findLastCharNotInList("x",1); + if ( p != 1 ) + return false; + p = lastX.findLastCharNotInList("y",1); + if ( p != 2 ) + return false; + p = empty.findLast('x'); if ( p >= 0 ) return false; @@ -279,6 +287,29 @@ bool testFindFunctions() return true; } +bool testErase() +{ + if ( stringc(1.f).eraseTrailingFloatZeros() != stringc("1") ) + return false; + + if ( stringc("0.100000").eraseTrailingFloatZeros() != stringc("0.1") ) + return false; + + if ( stringc("10.000000").eraseTrailingFloatZeros() != stringc("10") ) + return false; + + if ( stringc("foo 3.140000").eraseTrailingFloatZeros() != stringc("foo 3.14") ) + return false; + + if ( stringc("no_num.000").eraseTrailingFloatZeros() != stringc("no_num.000") ) + return false; + + if ( stringc("1.").eraseTrailingFloatZeros() != stringc("1.") ) + return false; + + return true; +} + // Test the functionality of irrString /** Validation is done with assert_log() against expected results. */ bool testIrrString(void) @@ -347,6 +378,9 @@ bool testIrrString(void) logTestString("test find functions\n"); allExpected &= testFindFunctions(); + logTestString("test erase functions\n"); + allExpected &= testErase(); + if(allExpected) logTestString("\nAll tests passed\n"); else diff --git a/tests/media/OpenGL-orthoCam.png b/tests/media/OpenGL-orthoCam.png index e0a32eca51591b85aebbfce06bbabcdfde1bfa42..d1fa7f3add101e4c68a80d463a80d21929255ac4 100644 GIT binary patch literal 4623 zcmV+q67cPbP)004Lh0ssI2`oL~D000rzNkl z--{eo7RSFm{bTZDCdnibjEQU%4ZFhbvM2=iNsKIusQBogAQDMpLWmfQi3t&jn4pLc zKKKvp;?Kp01eDzcQQ2ixc9+E6#EqEAOm~vW%=G-|nXY}f-M4Sud(OGHYN}?s+k9z? zTUEEty>&iyPTj7m?kb>%w0n1Kwoq8UrlTk}`{tX=*Ywh~j6O=OJ$qua7FRuMF<7EF zv)1gHGg&s8gSr*)zI`l6ayCRJnM5a1VHXt(b`4NRWi zYHkG~g2^RGD_GUs!if_>7BbZ`0)FwucAGp@nM#O~T1Y`U+=5Uzb}U&dX_Y_Vqep3e zi7;~#YGxS0;mAYKS__XH2{oQd`2aqCyyZ=E3eoA|bhAz7sS|H_O>cEXjcok^nX z0G~WbK(zqF7g*lGv-g0I0jSC$bzFlX>=u+kUEaG_>T_G- zj=k{)5cj@SMnG%{5lLqCq?bF$D-!a!9ZZ~&76OM?Bn&X*teRvifn#t_aJp~+lQ=oXY_EMGPWD8Xy>vrHPeKKbF3B?d>`tP!7C!Tg)uZ;#zx_6WQ%36@ zMwtb&zQDNC!LT@Xmk6+BsDWc8Zf!VSGlvUMU9(=y>htu|019~Loelsl0}H&B1gIok zI9$Oqwj_kRh@uiI6&f(YFoTC`Edg^Jm<29H z3;p37OtQ5zN6ho#;(*0NeQxvo2I`1iO-1LX2;-18&)=?*LZr6GE2syO(PezZ@7s zT7XKD5Te#P%muFGvB()r6v2ptR}Kj$?FFo7;|oiuR0w|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_Jlc>FlyqpD`D2PG95MbNxBUiVp!QyIHHl%aqs`=Cb&zQ7h_!<;l zfIvt>wGAc-UlFh~KZC+!%-VGQqmvW2hk*xXG|G9LT$gkrC;upiA5^;!p1g;j;g&pq z?#oz?V7ox3XdxVZ7%QpDp?35Hk*@ACFpQNoAE?Ia0$n4lo%jv2{+OfBi4y=QKR$cr zAnK$mQy-JA@NKq$NsSr7a_W|03usmOBxy6Yw4>JtagihuMZoc8R3u13L_H{(R!? zNVDsknn^`k9ByhFmPui(ObZ_2F z-%t`w5U{Q*SBCA6fmW``os312Phf0~lgw4&_HADy*=dge>$-FaNHqoa<_1yBgIbOJbu1^-)(aunkK-y&Yg?R%K3IO za%T014=2_ae@!c3U1!e3X8n(iQ_KH&`|;y!TFgze09fhNso3l!gV^Bu^y%c99#8)V XWC*?>G%MOe00000NkvXXu0mjfBYJg# diff --git a/tests/orthoCam.cpp b/tests/orthoCam.cpp index e7feee4b..1e499325 100644 --- a/tests/orthoCam.cpp +++ b/tests/orthoCam.cpp @@ -16,7 +16,7 @@ static bool testOrthoCam(video::E_DRIVER_TYPE driverType) scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNode(); cam->setPosition(core::vector3df(500,200,-500)); cam->setTarget(core::vector3df()); - cam->setProjectionMatrix(core::matrix4().buildProjectionMatrixOrthoLH(240,180,0.9f,2000.f), true); + cam->setProjectionMatrix(core::matrix4().buildProjectionMatrixOrthoLH(240,180,0.9f,2000.f,driverType != video::EDT_OPENGL), true); device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->addHillPlaneMesh("plane", core::dimension2df(32,32), core::dimension2du(16,16)));//->setMaterialFlag(video::EMF_WIREFRAME, true); device->getSceneManager()->addCubeSceneNode(20.f)->setPosition(core::vector3df(50,20,50)); @@ -60,7 +60,7 @@ static bool testOrthoStencil(video::E_DRIVER_TYPE driverType) scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNode(); cam->setPosition(core::vector3df(300,250,-300)); cam->setTarget(core::vector3df(0,20,0)); - cam->setProjectionMatrix(core::matrix4().buildProjectionMatrixOrthoLH(120,90,0.9f,2000.f), true); + cam->setProjectionMatrix(core::matrix4().buildProjectionMatrixOrthoLH(120,90,0.9f,2000.f,driverType != video::EDT_OPENGL), true); device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->addHillPlaneMesh("plane", core::dimension2df(32,32), core::dimension2du(16,16)));//->setMaterialFlag(video::EMF_WIREFRAME, true); @@ -74,7 +74,7 @@ static bool testOrthoStencil(video::E_DRIVER_TYPE driverType) light->setRadius(500.f); light->getLightData().DiffuseColor.set(0,1,1); - device->getVideoDriver()->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(0,0,0,0)); + device->getVideoDriver()->beginScene(video::ECBF_ALL, video::SColor(0,0,0,0)); device->getSceneManager()->drawAll(); device->getVideoDriver()->endScene(); diff --git a/tests/planeMatrix.cpp b/tests/planeMatrix.cpp index 1132a15b..30d46264 100644 --- a/tests/planeMatrix.cpp +++ b/tests/planeMatrix.cpp @@ -24,17 +24,24 @@ static bool transformPlane(const vector3df & point, const vector3df & normal, { plane3df plane(point, vector3df(normal).normalize()); - logTestString("\n Pre: (%.3ff,%.3ff,%.3ff), %.3ff\n", + logTestString("\n Pre N:(%.3ff,%.3ff,%.3ff), D:%.3ff\n", plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D); matrix.transformPlane(plane); - logTestString(" Post: (%.3ff,%.3ff,%.3ff), %.3ff\n", + logTestString(" Post N:(%.3ff,%.3ff,%.3ff), D:%.3ff\n", plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D); - logTestString("Expected: (%.3ff,%.3ff,%.3ff), %.3ff\n", + logTestString("Expected N:(%.3ff,%.3ff,%.3ff), D:%.3ff\n", expected.Normal.X, expected.Normal.Y, expected.Normal.Z, expected.D); + if(!plane.Normal.equals(vector3df(plane.Normal).normalize())) + { + logTestString("Plane normal no longer normalized after transformation\n"); + assert_log(false); + return false; + } + if(!sloppyComparePlanes(plane, expected)) { logTestString("Unexpected result\n"); @@ -149,14 +156,14 @@ bool planeMatrix(void) matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], matrix[12], matrix[13], matrix[14], matrix[15]); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f), -0.000f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f), 0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f), -0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f), -0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f), 0.707f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f).normalize(), 0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f).normalize(), -0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f).normalize(), -0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f).normalize(), 0.894f)); matrix = rotationMatrix * translationMatrix; logTestString("\nRotation * translation matrix\n%02.02f %02.02f %02.02f %02.02f" @@ -167,14 +174,14 @@ bool planeMatrix(void) matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], matrix[12], matrix[13], matrix[14], matrix[15]); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f), 2.121f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f), -2.121f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f), -2.121f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f), 2.121f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f), 2.828f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f), -2.828f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f), -2.828f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f), 2.828f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f).normalize(), 2.121f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f).normalize(), -2.121f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f).normalize(), -2.121f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f).normalize(), 2.121f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.707f).normalize(), 2.828f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.707f).normalize(), -2.828f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.707f).normalize(), -2.828f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.707f).normalize(), 2.828f)); matrix = rotationMatrix * scaleMatrix; logTestString("\nRotation * scale matrix\n%02.02f %02.02f %02.02f %02.02f" @@ -185,14 +192,14 @@ bool planeMatrix(void) matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], matrix[12], matrix[13], matrix[14], matrix[15]); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f), -0.000f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f), -0.000f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f), 0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f), -0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f), -0.707f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f), 0.707f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f).normalize(), -0.000f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f).normalize(), 0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f).normalize(), -0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f).normalize(), -0.894f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f).normalize(), 0.894f)); matrix = translationMatrix * scaleMatrix; logTestString("\nTranslation * scale matrix\n%02.02f %02.02f %02.02f %02.02f" @@ -203,14 +210,14 @@ bool planeMatrix(void) matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], matrix[12], matrix[13], matrix[14], matrix[15]); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f), 1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f), -1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f), -1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f), 1.061f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f), 1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f), -1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f), -1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f), 1.768f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f).normalize(), 1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f).normalize(), -1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f).normalize(), -1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f).normalize(), 1.3416f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,-0.354f,0.000f).normalize(), 2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,0.354f,0.000f).normalize(), -2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,0.354f,0.000f).normalize(), -2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,-0.354f,0.000f).normalize(), 2.236f)); matrix = rotationMatrix * translationMatrix * scaleMatrix; logTestString("\nRotation * translation * scale matrix\n%02.02f %02.02f %02.02f %02.02f" @@ -221,14 +228,14 @@ bool planeMatrix(void) matrix[4], matrix[5], matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], matrix[12], matrix[13], matrix[14], matrix[15]); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f), 1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f), -1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f), -1.061f)); - success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f), 1.061f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f), 1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f), -1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f), -1.768f)); - success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f), 1.768f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f).normalize(), 1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f).normalize(), -1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f).normalize(), -1.3416f)); + success &= transformPlane(vector3df(0, 0, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f).normalize(), 1.3416f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, -1, 0), matrix, plane3df(vector3df(-0.707f,0.000f,-0.354f).normalize(), 2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, 1, 0), matrix, plane3df(vector3df(0.707f,-0.000f,0.354f).normalize(), -2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(-1, 1, 0), matrix, plane3df(vector3df(-0.707f,-0.000f,0.354f).normalize(), -2.236f)); + success &= transformPlane(vector3df(0, 1, 0), vector3df(1, -1, 0), matrix, plane3df(vector3df(0.707f,0.000f,-0.354f).normalize(), 2.236f)); success &= drawScaledOctree(); diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 19710940..6f354ef6 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 1 test of 1 passed. Compiled as DEBUG -Test suite pass at GMT Thu Jan 17 14:29:44 2019 +Test suite pass at GMT Fri Feb 22 17:53:28 2019