|
@@ -48,10 +48,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include <assimp/scene.h>
|
|
#include <assimp/scene.h>
|
|
|
|
|
|
#include "TextureTransform.h"
|
|
#include "TextureTransform.h"
|
|
|
|
+#include "StringUtils.h"
|
|
|
|
|
|
using namespace Assimp;
|
|
using namespace Assimp;
|
|
|
|
|
|
-
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Constructor to be privately used by Importer
|
|
// Constructor to be privately used by Importer
|
|
TextureTransformStep::TextureTransformStep() :
|
|
TextureTransformStep::TextureTransformStep() :
|
|
@@ -107,7 +107,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
|
{
|
|
{
|
|
out -= rounded*(float)AI_MATH_PI;
|
|
out -= rounded*(float)AI_MATH_PI;
|
|
|
|
|
|
- sprintf(szTemp,"Texture coordinate rotation %f can be simplified to %f",info.mRotation,out);
|
|
|
|
|
|
+ ai_snprintf(szTemp, 512, "Texture coordinate rotation %f can be simplified to %f",info.mRotation,out);
|
|
DefaultLogger::get()->info(szTemp);
|
|
DefaultLogger::get()->info(szTemp);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -131,7 +131,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
|
if (aiTextureMapMode_Wrap == info.mapU) {
|
|
if (aiTextureMapMode_Wrap == info.mapU) {
|
|
// Wrap - simple take the fraction of the field
|
|
// Wrap - simple take the fraction of the field
|
|
out = info.mTranslation.x-(float)rounded;
|
|
out = info.mTranslation.x-(float)rounded;
|
|
- sprintf(szTemp,"[w] UV U offset %f can be simplified to %f",info.mTranslation.x,out);
|
|
|
|
|
|
+ ai_snprintf(szTemp, 512, "[w] UV U offset %f can be simplified to %f", info.mTranslation.x, out);
|
|
}
|
|
}
|
|
else if (aiTextureMapMode_Mirror == info.mapU && 1 != rounded) {
|
|
else if (aiTextureMapMode_Mirror == info.mapU && 1 != rounded) {
|
|
// Mirror
|
|
// Mirror
|
|
@@ -139,11 +139,11 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
|
rounded--;
|
|
rounded--;
|
|
out = info.mTranslation.x-(float)rounded;
|
|
out = info.mTranslation.x-(float)rounded;
|
|
|
|
|
|
- sprintf(szTemp,"[m/d] UV U offset %f can be simplified to %f",info.mTranslation.x,out);
|
|
|
|
|
|
+ ai_snprintf(szTemp,512,"[m/d] UV U offset %f can be simplified to %f",info.mTranslation.x,out);
|
|
}
|
|
}
|
|
else if (aiTextureMapMode_Clamp == info.mapU || aiTextureMapMode_Decal == info.mapU) {
|
|
else if (aiTextureMapMode_Clamp == info.mapU || aiTextureMapMode_Decal == info.mapU) {
|
|
// Clamp - translations beyond 1,1 are senseless
|
|
// Clamp - translations beyond 1,1 are senseless
|
|
- sprintf(szTemp,"[c] UV U offset %f can be clamped to 1.0f",info.mTranslation.x);
|
|
|
|
|
|
+ ai_snprintf(szTemp,512,"[c] UV U offset %f can be clamped to 1.0f",info.mTranslation.x);
|
|
|
|
|
|
out = 1.f;
|
|
out = 1.f;
|
|
}
|
|
}
|
|
@@ -164,7 +164,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
|
if (aiTextureMapMode_Wrap == info.mapV) {
|
|
if (aiTextureMapMode_Wrap == info.mapV) {
|
|
// Wrap - simple take the fraction of the field
|
|
// Wrap - simple take the fraction of the field
|
|
out = info.mTranslation.y-(float)rounded;
|
|
out = info.mTranslation.y-(float)rounded;
|
|
- sprintf(szTemp,"[w] UV V offset %f can be simplified to %f",info.mTranslation.y,out);
|
|
|
|
|
|
+ ::ai_snprintf(szTemp,512,"[w] UV V offset %f can be simplified to %f",info.mTranslation.y,out);
|
|
}
|
|
}
|
|
else if (aiTextureMapMode_Mirror == info.mapV && 1 != rounded) {
|
|
else if (aiTextureMapMode_Mirror == info.mapV && 1 != rounded) {
|
|
// Mirror
|
|
// Mirror
|
|
@@ -172,11 +172,11 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info)
|
|
rounded--;
|
|
rounded--;
|
|
out = info.mTranslation.x-(float)rounded;
|
|
out = info.mTranslation.x-(float)rounded;
|
|
|
|
|
|
- sprintf(szTemp,"[m/d] UV V offset %f can be simplified to %f",info.mTranslation.y,out);
|
|
|
|
|
|
+ ::ai_snprintf(szTemp,512,"[m/d] UV V offset %f can be simplified to %f",info.mTranslation.y,out);
|
|
}
|
|
}
|
|
else if (aiTextureMapMode_Clamp == info.mapV || aiTextureMapMode_Decal == info.mapV) {
|
|
else if (aiTextureMapMode_Clamp == info.mapV || aiTextureMapMode_Decal == info.mapV) {
|
|
// Clamp - translations beyond 1,1 are senseless
|
|
// Clamp - translations beyond 1,1 are senseless
|
|
- sprintf(szTemp,"[c] UV V offset %f canbe clamped to 1.0f",info.mTranslation.y);
|
|
|
|
|
|
+ ::ai_snprintf(szTemp,512,"[c] UV V offset %f canbe clamped to 1.0f",info.mTranslation.y);
|
|
|
|
|
|
out = 1.f;
|
|
out = 1.f;
|
|
}
|
|
}
|
|
@@ -447,7 +447,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|
if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
|
if (size > AI_MAX_NUMBER_OF_TEXTURECOORDS) {
|
|
|
|
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
- ::sprintf(buffer,"%u UV channels required but just %u available",
|
|
|
|
|
|
+ ::ai_snprintf(buffer,1024,"%u UV channels required but just %u available",
|
|
static_cast<unsigned int>(trafo.size()),AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
|
static_cast<unsigned int>(trafo.size()),AI_MAX_NUMBER_OF_TEXTURECOORDS);
|
|
|
|
|
|
DefaultLogger::get()->error(buffer);
|
|
DefaultLogger::get()->error(buffer);
|
|
@@ -475,7 +475,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|
|
|
|
|
// Write to the log
|
|
// Write to the log
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
- sprintf(buffer,"Mesh %u, channel %u: t(%.3f,%.3f), s(%.3f,%.3f), r(%.3f), %s%s",
|
|
|
|
|
|
+ ::ai_snprintf(buffer,1024,"Mesh %u, channel %u: t(%.3f,%.3f), s(%.3f,%.3f), r(%.3f), %s%s",
|
|
q,n,
|
|
q,n,
|
|
(*it).mTranslation.x,
|
|
(*it).mTranslation.x,
|
|
(*it).mTranslation.y,
|
|
(*it).mTranslation.y,
|
|
@@ -558,7 +558,7 @@ void TextureTransformStep::Execute( aiScene* pScene)
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
if (!DefaultLogger::isNullLogger()) {
|
|
|
|
|
|
if (transformedChannels) {
|
|
if (transformedChannels) {
|
|
- ::sprintf(buffer,"TransformUVCoordsProcess end: %u output channels (in: %u, modified: %u)",
|
|
|
|
|
|
+ ::ai_snprintf(buffer,1024,"TransformUVCoordsProcess end: %u output channels (in: %u, modified: %u)",
|
|
outChannels,inChannels,transformedChannels);
|
|
outChannels,inChannels,transformedChannels);
|
|
|
|
|
|
DefaultLogger::get()->info(buffer);
|
|
DefaultLogger::get()->info(buffer);
|