Commit ed5710bf authored by hybrid's avatar hybrid

Made some string constructors explicit to avoid nasty misinterpretations. Just...

Made some string constructors explicit to avoid nasty misinterpretations. Just add core::stringc or core::stringw around the numbers the compiler doesn't want to convert automatically anymore.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1534 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 4750bbc3
...@@ -41,7 +41,6 @@ public: ...@@ -41,7 +41,6 @@ public:
} }
//! Constructor //! Constructor
string(const string<T>& other) string(const string<T>& other)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
...@@ -50,9 +49,8 @@ public: ...@@ -50,9 +49,8 @@ public:
} }
//! Constructs a string from a float //! Constructs a string from a float
string(const double number) explicit string(const double number)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
{ {
c8 tmpbuf[255]; c8 tmpbuf[255];
...@@ -61,9 +59,8 @@ public: ...@@ -61,9 +59,8 @@ public:
} }
//! Constructs a string from an int //! Constructs a string from an int
string(int number) explicit string(int number)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
{ {
// store if negative and make positive // store if negative and make positive
...@@ -111,9 +108,8 @@ public: ...@@ -111,9 +108,8 @@ public:
} }
//! Constructs a string from an unsigned int //! Constructs a string from an unsigned int
string(unsigned int number) explicit string(unsigned int number)
: array(0), allocated(0), used(0) : array(0), allocated(0), used(0)
{ {
// temporary buffer for 16 numbers // temporary buffer for 16 numbers
...@@ -144,7 +140,6 @@ public: ...@@ -144,7 +140,6 @@ public:
} }
//! Constructor for copying a string from a pointer with a given length //! Constructor for copying a string from a pointer with a given length
template <class B> template <class B>
string(const B* const c, u32 length) string(const B* const c, u32 length)
...@@ -167,7 +162,6 @@ public: ...@@ -167,7 +162,6 @@ public:
} }
//! Constructor for unicode and ascii strings //! Constructor for unicode and ascii strings
template <class B> template <class B>
string(const B* const c) string(const B* const c)
...@@ -177,7 +171,6 @@ public: ...@@ -177,7 +171,6 @@ public:
} }
//! destructor //! destructor
~string() ~string()
{ {
...@@ -185,7 +178,6 @@ public: ...@@ -185,7 +178,6 @@ public:
} }
//! Assignment operator //! Assignment operator
string<T>& operator=(const string<T>& other) string<T>& operator=(const string<T>& other)
{ {
...@@ -204,7 +196,6 @@ public: ...@@ -204,7 +196,6 @@ public:
} }
//! Assignment operator for strings, ascii and unicode //! Assignment operator for strings, ascii and unicode
template <class B> template <class B>
string<T>& operator=(const B* const c) string<T>& operator=(const B* const c)
...@@ -247,7 +238,8 @@ public: ...@@ -247,7 +238,8 @@ public:
return *this; return *this;
} }
//! Add operator for other strings
//! Append operator for other strings
string<T> operator+(const string<T>& other) const string<T> operator+(const string<T>& other) const
{ {
string<T> str(*this); string<T> str(*this);
...@@ -256,7 +248,8 @@ public: ...@@ -256,7 +248,8 @@ public:
return str; return str;
} }
//! Add operator for strings, ascii and unicode
//! Append operator for strings, ascii and unicode
template <class B> template <class B>
string<T> operator+(const B* const c) const string<T> operator+(const B* const c) const
{ {
...@@ -283,7 +276,7 @@ public: ...@@ -283,7 +276,7 @@ public:
} }
//! Comparison operator //! Equality operator
bool operator ==(const T* const str) const bool operator ==(const T* const str) const
{ {
if (!str) if (!str)
...@@ -298,8 +291,7 @@ public: ...@@ -298,8 +291,7 @@ public:
} }
//! Equality operator
//! Comparison operator
bool operator ==(const string<T>& other) const bool operator ==(const string<T>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
...@@ -310,7 +302,7 @@ public: ...@@ -310,7 +302,7 @@ public:
} }
//! Is smaller operator //! Is smaller comparator
bool operator <(const string<T>& other) const bool operator <(const string<T>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
...@@ -328,41 +320,36 @@ public: ...@@ -328,41 +320,36 @@ public:
} }
//! Inequality operator
//! Equals not operator
bool operator !=(const T* const str) const bool operator !=(const T* const str) const
{ {
return !(*this == str); return !(*this == str);
} }
//! Inequality operator
//! Equals not operator
bool operator !=(const string<T>& other) const bool operator !=(const string<T>& other) const
{ {
return !(*this == other); return !(*this == other);
} }
//! Returns length of string //! Returns length of string
/** \return Returns length of the string in characters. */ /** \return Length of the string in characters. */
u32 size() const u32 size() const
{ {
return used-1; return used-1;
} }
//! Returns character string //! Returns character string
/** \return Returns pointer to C-style zero terminated string. */ /** \return pointer to C-style zero terminated string. */
const T* c_str() const const T* c_str() const
{ {
return array; return array;
} }
//! Makes the string lower case. //! Makes the string lower case.
void make_lower() void make_lower()
{ {
...@@ -371,7 +358,6 @@ public: ...@@ -371,7 +358,6 @@ public:
} }
//! Makes the string upper case. //! Makes the string upper case.
void make_upper() void make_upper()
{ {
...@@ -387,10 +373,9 @@ public: ...@@ -387,10 +373,9 @@ public:
} }
//! Compares the strings ignoring case.
//! Compares the string ignoring case.
/** \param other: Other string to compare. /** \param other: Other string to compare.
\return Returns true if the string are equal ignoring case. */ \return True if the strings are equal ignoring case. */
bool equals_ignore_case(const string<T>& other) const bool equals_ignore_case(const string<T>& other) const
{ {
for(u32 i=0; array[i] && other[i]; ++i) for(u32 i=0; array[i] && other[i]; ++i)
...@@ -400,9 +385,10 @@ public: ...@@ -400,9 +385,10 @@ public:
return used == other.used; return used == other.used;
} }
//! Compares the string ignoring case.
//! Compares the strings ignoring case.
/** \param other: Other string to compare. /** \param other: Other string to compare.
\return Returns true if the string is smaller ignoring case. */ \return True if this string is smaller ignoring case. */
bool lower_ignore_case(const string<T>& other) const bool lower_ignore_case(const string<T>& other) const
{ {
for(u32 i=0; array[i] && other.array[i]; ++i) for(u32 i=0; array[i] && other.array[i]; ++i)
...@@ -416,8 +402,10 @@ public: ...@@ -416,8 +402,10 @@ public:
} }
//! compares the first n characters of the strings //! compares the first n characters of the strings
/** \param other Other string to compare.
\param n Number of characters to compare
\return True if the n first characters of this string are smaller. */
bool equalsn(const string<T>& other, u32 n) const bool equalsn(const string<T>& other, u32 n) const
{ {
u32 i; u32 i;
...@@ -432,6 +420,9 @@ public: ...@@ -432,6 +420,9 @@ public:
//! compares the first n characters of the strings //! compares the first n characters of the strings
/** \param str Other string to compare.
\param n Number of characters to compare
\return True if the n first characters of this string are smaller. */
bool equalsn(const T* const str, u32 n) const bool equalsn(const T* const str, u32 n) const
{ {
if (!str) if (!str)
...@@ -460,6 +451,7 @@ public: ...@@ -460,6 +451,7 @@ public:
array[used-1] = 0; array[used-1] = 0;
} }
//! Appends a char string to this string //! Appends a char string to this string
/** \param other: Char string to append. */ /** \param other: Char string to append. */
void append(const T* const other) void append(const T* const other)
...@@ -734,6 +726,8 @@ public: ...@@ -734,6 +726,8 @@ public:
} }
//! Appends a character to this string
/** \param character: Character to append. */
string<T>& operator += (T c) string<T>& operator += (T c)
{ {
append(c); append(c);
...@@ -741,6 +735,8 @@ public: ...@@ -741,6 +735,8 @@ public:
} }
//! Appends a char string to this string
/** \param other: Char string to append. */
string<T>& operator += (const T* const c) string<T>& operator += (const T* const c)
{ {
append(c); append(c);
...@@ -748,6 +744,8 @@ public: ...@@ -748,6 +744,8 @@ public:
} }
//! Appends a string to this string
/** \param other: String to append. */
string<T>& operator += (const string<T>& other) string<T>& operator += (const string<T>& other)
{ {
append(other); append(other);
...@@ -805,6 +803,7 @@ public: ...@@ -805,6 +803,7 @@ public:
array[i] = replaceWith; array[i] = replaceWith;
} }
//! trims the string. //! trims the string.
/** Removes whitespace from begin and end of the string. */ /** Removes whitespace from begin and end of the string. */
string<T>& trim() string<T>& trim()
...@@ -823,9 +822,10 @@ public: ...@@ -823,9 +822,10 @@ public:
} }
//! Erases a character from the string. May be slow, because all elements //! Erases a character from the string.
//! following after the erased element have to be copied. /** May be slow, because all elements
//! \param index: Index of element to be erased. following after the erased element have to be copied.
\param index: Index of element to be erased. */
void erase(u32 index) void erase(u32 index)
{ {
_IRR_DEBUG_BREAK_IF(index>=used) // access violation _IRR_DEBUG_BREAK_IF(index>=used) // access violation
......
...@@ -1477,7 +1477,7 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader) ...@@ -1477,7 +1477,7 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader)
const core::stringw tmpName(L"value"); const core::stringw tmpName(L"value");
for (; n<count; ++n) for (; n<count; ++n)
{ {
tmpArray.push_back(reader->getAttributeValue((tmpName+n).c_str())); tmpArray.push_back(reader->getAttributeValue((tmpName+core::stringw(n)).c_str()));
} }
addArray(name.c_str(),tmpArray); addArray(name.c_str(),tmpArray);
} }
...@@ -1523,7 +1523,7 @@ bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader, ...@@ -1523,7 +1523,7 @@ bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader,
const core::stringw tmpName(L"value"); const core::stringw tmpName(L"value");
for (; n < arrayinput.size(); ++n) for (; n < arrayinput.size(); ++n)
{ {
arraynames.push_back((tmpName+n).c_str()); arraynames.push_back((tmpName+core::stringw(n)).c_str());
arrayvalues.push_back(arrayinput[n]); arrayvalues.push_back(arrayinput[n]);
} }
......
...@@ -307,7 +307,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -307,7 +307,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"source", false, L"id", L"mesh-Pos"); Writer->writeElement(L"source", false, L"id", L"mesh-Pos");
Writer->writeLineBreak(); Writer->writeLineBreak();
core::stringw vertexCountStr = (totalVertexCount*3); core::stringw vertexCountStr(totalVertexCount*3);
Writer->writeElement(L"float_array", false, L"id", L"mesh-Pos-array", Writer->writeElement(L"float_array", false, L"id", L"mesh-Pos-array",
L"count", vertexCountStr.c_str()); L"count", vertexCountStr.c_str());
Writer->writeLineBreak(); Writer->writeLineBreak();
...@@ -387,7 +387,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -387,7 +387,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"technique_common", false); Writer->writeElement(L"technique_common", false);
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = totalVertexCount; vertexCountStr = core::stringw(totalVertexCount);
Writer->writeElement(L"accessor", false, L"source", L"#mesh-Pos-array", Writer->writeElement(L"accessor", false, L"source", L"#mesh-Pos-array",
L"count", vertexCountStr.c_str(), L"stride", L"3"); L"count", vertexCountStr.c_str(), L"stride", L"3");
...@@ -414,7 +414,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -414,7 +414,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord0"); Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord0");
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = (totalVertexCount*2); vertexCountStr = core::stringw(totalVertexCount*2);
Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord0-array", Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord0-array",
L"count", vertexCountStr.c_str()); L"count", vertexCountStr.c_str());
Writer->writeLineBreak(); Writer->writeLineBreak();
...@@ -488,7 +488,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -488,7 +488,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"technique_common", false); Writer->writeElement(L"technique_common", false);
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = totalVertexCount; vertexCountStr = core::stringw(totalVertexCount);
Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord0-array", Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord0-array",
L"count", vertexCountStr.c_str(), L"stride", L"2"); L"count", vertexCountStr.c_str(), L"stride", L"2");
...@@ -513,7 +513,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -513,7 +513,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"source", false, L"id", L"mesh-Normal"); Writer->writeElement(L"source", false, L"id", L"mesh-Normal");
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = (totalVertexCount*3); vertexCountStr = core::stringw(totalVertexCount*3);
Writer->writeElement(L"float_array", false, L"id", L"mesh-Normal-array", Writer->writeElement(L"float_array", false, L"id", L"mesh-Normal-array",
L"count", vertexCountStr.c_str()); L"count", vertexCountStr.c_str());
Writer->writeLineBreak(); Writer->writeLineBreak();
...@@ -593,7 +593,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -593,7 +593,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"technique_common", false); Writer->writeElement(L"technique_common", false);
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = totalVertexCount; vertexCountStr = core::stringw(totalVertexCount);
Writer->writeElement(L"accessor", false, L"source", L"#mesh-Normal-array", Writer->writeElement(L"accessor", false, L"source", L"#mesh-Normal-array",
L"count", vertexCountStr.c_str(), L"stride", L"3"); L"count", vertexCountStr.c_str(), L"stride", L"3");
...@@ -622,7 +622,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -622,7 +622,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord1"); Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord1");
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = (totalTCoords2Count*2); vertexCountStr = core::stringw(totalTCoords2Count*2);
Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord1-array", Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord1-array",
L"count", vertexCountStr.c_str()); L"count", vertexCountStr.c_str());
Writer->writeLineBreak(); Writer->writeLineBreak();
...@@ -671,7 +671,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -671,7 +671,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
Writer->writeElement(L"technique_common", false); Writer->writeElement(L"technique_common", false);
Writer->writeLineBreak(); Writer->writeLineBreak();
vertexCountStr = totalTCoords2Count; vertexCountStr = core::stringw(totalTCoords2Count);
Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord1-array", Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord1-array",
L"count", vertexCountStr.c_str(), L"stride", L"2"); L"count", vertexCountStr.c_str(), L"stride", L"2");
...@@ -714,7 +714,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 ...@@ -714,7 +714,7 @@ bool CColladaMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i); scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
const u32 polyCount = buffer->getIndexCount() / 3; const u32 polyCount = buffer->getIndexCount() / 3;
core::stringw strPolyCount = polyCount; core::stringw strPolyCount(polyCount);
core::stringw strMat = "#mat"; core::stringw strMat = "#mat";
strMat += i; strMat += i;
......
...@@ -1423,7 +1423,7 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria ...@@ -1423,7 +1423,7 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
core::stringc prefix="Texture"; core::stringc prefix="Texture";
u32 i; u32 i;
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addTexture((prefix+(i+1)).c_str(), material.getTexture(i)); attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i));
attr->addBool("Wireframe", material.Wireframe); attr->addBool("Wireframe", material.Wireframe);
attr->addBool("GouraudShading", material.GouraudShading); attr->addBool("GouraudShading", material.GouraudShading);
...@@ -1437,16 +1437,16 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria ...@@ -1437,16 +1437,16 @@ io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMateria
prefix = "BilinearFilter"; prefix = "BilinearFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].BilinearFilter); attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);
prefix = "TrilinearFilter"; prefix = "TrilinearFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter); attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);
prefix = "AnisotropicFilter"; prefix = "AnisotropicFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addBool((prefix+(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter); attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
prefix="TextureWrap"; prefix="TextureWrap";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addEnum((prefix+(i+1)).c_str(), material.TextureLayer[i].TextureWrap, aTextureClampNames); attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrap, aTextureClampNames);
return attr; return attr;
} }
...@@ -1479,7 +1479,7 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater ...@@ -1479,7 +1479,7 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
core::stringc prefix="Texture"; core::stringc prefix="Texture";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+(i+1)).c_str())); outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+core::stringc(i+1)).c_str()));
outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe"); outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe");
outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading"); outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading");
...@@ -1495,25 +1495,25 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater ...@@ -1495,25 +1495,25 @@ void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMater
outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str())); outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str()); outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
prefix = "TrilinearFilter"; prefix = "TrilinearFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy if (attr->existsAttribute(prefix.c_str())) // legacy
outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str())); outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str()); outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
prefix = "AnisotropicFilter"; prefix = "AnisotropicFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy if (attr->existsAttribute(prefix.c_str())) // legacy
outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str())); outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsBool((prefix+(i+1)).c_str()); outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str());
prefix = "TextureWrap"; prefix = "TextureWrap";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i) for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].TextureWrap = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+(i+1)).c_str(), aTextureClampNames); outMaterial.TextureLayer[i].TextureWrap = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames);
} }
......
...@@ -149,11 +149,11 @@ bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s3 ...@@ -149,11 +149,11 @@ bool CSTLMeshWriter::writeMeshASCII(io::IWriteFile* file, scene::IMesh* mesh, s3
void CSTLMeshWriter::getVectorAsStringLine(const core::vector3df& v, core::stringc& s) const void CSTLMeshWriter::getVectorAsStringLine(const core::vector3df& v, core::stringc& s) const
{ {
s = v.X; s = core::stringc(v.X);
s += " "; s += " ";
s += v.Y; s += core::stringc(v.Y);
s += " "; s += " ";
s += v.Z; s += core::stringc(v.Z);
s += "\n"; s += "\n";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment