Fix:Use correct encoding
parent
a1aace74e5
commit
1092f0d94e
|
@ -43,6 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef AI_BASE64_HPP_INC
|
#ifndef AI_BASE64_HPP_INC
|
||||||
#define AI_BASE64_HPP_INC
|
#define AI_BASE64_HPP_INC
|
||||||
|
|
||||||
|
#include <assimp/defs.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -54,35 +56,35 @@ namespace Base64 {
|
||||||
/// @param in The UTF-64 buffer.
|
/// @param in The UTF-64 buffer.
|
||||||
/// @param inLength The size of the buffer
|
/// @param inLength The size of the buffer
|
||||||
/// @param out The encoded ASCII string.
|
/// @param out The encoded ASCII string.
|
||||||
void Encode(const uint8_t *in, size_t inLength, std::string &out);
|
ASSIMP_API void Encode(const uint8_t *in, size_t inLength, std::string &out);
|
||||||
|
|
||||||
/// @brief Will encode the given character buffer from UTF64 to ASCII.
|
/// @brief Will encode the given character buffer from UTF64 to ASCII.
|
||||||
/// @param in A vector, which contains the buffer for encoding.
|
/// @param in A vector, which contains the buffer for encoding.
|
||||||
/// @param out The encoded ASCII string.
|
/// @param out The encoded ASCII string.
|
||||||
void Encode(const std::vector<uint8_t>& in, std::string &out);
|
ASSIMP_API void Encode(const std::vector<uint8_t> &in, std::string &out);
|
||||||
|
|
||||||
/// @brief Will encode the given character buffer from UTF64 to ASCII.
|
/// @brief Will encode the given character buffer from UTF64 to ASCII.
|
||||||
/// @param in A vector, which contains the buffer for encoding.
|
/// @param in A vector, which contains the buffer for encoding.
|
||||||
/// @return The encoded ASCII string.
|
/// @return The encoded ASCII string.
|
||||||
std::string Encode(const std::vector<uint8_t>& in);
|
ASSIMP_API std::string Encode(const std::vector<uint8_t> &in);
|
||||||
|
|
||||||
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
||||||
/// @param in The ASCII buffer to decode.
|
/// @param in The ASCII buffer to decode.
|
||||||
/// @param inLength The size of the buffer.
|
/// @param inLength The size of the buffer.
|
||||||
/// @param out The decoded buffer.
|
/// @param out The decoded buffer.
|
||||||
/// @return The new buffer size.
|
/// @return The new buffer size.
|
||||||
size_t Decode(const char *in, size_t inLength, uint8_t *&out);
|
ASSIMP_API size_t Decode(const char *in, size_t inLength, uint8_t *&out);
|
||||||
|
|
||||||
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
||||||
/// @param in The ASCII buffer to decode as a std::string.
|
/// @param in The ASCII buffer to decode as a std::string.
|
||||||
/// @param out The decoded buffer.
|
/// @param out The decoded buffer.
|
||||||
/// @return The new buffer size.
|
/// @return The new buffer size.
|
||||||
size_t Decode(const std::string& in, std::vector<uint8_t>& out);
|
ASSIMP_API size_t Decode(const std::string &in, std::vector<uint8_t> &out);
|
||||||
|
|
||||||
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
/// @brief Will decode the given character buffer from ASCII to UTF64.
|
||||||
/// @param in The ASCII string.
|
/// @param in The ASCII string.
|
||||||
/// @return The decoded buffer in a vector.
|
/// @return The decoded buffer in a vector.
|
||||||
std::vector<uint8_t> Decode(const std::string& in);
|
ASSIMP_API std::vector<uint8_t> Decode(const std::string &in);
|
||||||
|
|
||||||
} // namespace Base64
|
} // namespace Base64
|
||||||
} // namespace Assimp
|
} // namespace Assimp
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "UTFConverter.h"
|
|
||||||
|
|
||||||
namespace AssimpSamples {
|
|
||||||
namespace SharedCode {
|
|
||||||
|
|
||||||
//typename UTFConverter::UTFConverterImpl UTFConverter::impl_;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ASSIMP_SAMPLES_SHARED_CODE_UTFCONVERTER_H
|
|
||||||
#define ASSIMP_SAMPLES_SHARED_CODE_UTFCONVERTER_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#ifdef ASSIMP_USE_HUNTER
|
|
||||||
#include <utf8.h>
|
|
||||||
#else
|
|
||||||
#include "../contrib/utf8cpp/source/utf8.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace AssimpSamples {
|
|
||||||
namespace SharedCode {
|
|
||||||
|
|
||||||
// Used to convert between multibyte and unicode strings.
|
|
||||||
class UTFConverter {
|
|
||||||
public:
|
|
||||||
//utf8::utf16to8(start, end, back_inserter(str));
|
|
||||||
|
|
||||||
UTFConverter(const char* s) : s_(s), ws_() {
|
|
||||||
std::vector<unsigned char> str;
|
|
||||||
utf8::utf8to16(s, s + std::strlen(s) + 1, back_inserter(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
UTFConverter(const wchar_t* s) : s_(),ws_(s) {
|
|
||||||
std::vector<wchar_t> str;
|
|
||||||
utf8::utf16to8(s, s + ws_.size() + 1, back_inserter(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
UTFConverter(const std::string& s) : s_(s), ws_() {
|
|
||||||
std::vector<unsigned char> str;
|
|
||||||
utf8::utf8to16(s.c_str(), s.c_str() + s.size() + 1, back_inserter(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
UTFConverter(const std::wstring& s) : s_(), ws_(s) {
|
|
||||||
std::vector<wchar_t> str;
|
|
||||||
utf8::utf16to8(s.c_str(), s.c_str() + ws_.size() + 1, back_inserter(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const char* c_str() const {
|
|
||||||
return s_.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const std::string& str() const {
|
|
||||||
return s_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const wchar_t* c_wstr() const {
|
|
||||||
return ws_.c_str();
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
std::string s_;
|
|
||||||
std::wstring ws_;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ASSIMP_SAMPLES_SHARED_CODE_UTFCONVERTER_H
|
|
|
@ -33,8 +33,6 @@ ADD_EXECUTABLE( assimp_simpletextureddirectx11 WIN32
|
||||||
#SimpleTexturedDirectx11/VertexShader.hlsl
|
#SimpleTexturedDirectx11/VertexShader.hlsl
|
||||||
SimpleTexturedDirectx11/main.cpp
|
SimpleTexturedDirectx11/main.cpp
|
||||||
SimpleTexturedDirectx11/SafeRelease.hpp
|
SimpleTexturedDirectx11/SafeRelease.hpp
|
||||||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.cpp
|
|
||||||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletextureddirectx11)
|
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletextureddirectx11)
|
||||||
|
|
|
@ -21,8 +21,12 @@
|
||||||
#include <dxgi1_2.h>
|
#include <dxgi1_2.h>
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
#include <d3dcompiler.h>
|
#include <d3dcompiler.h>
|
||||||
|
#ifdef ASSIMP_USE_HUNTER
|
||||||
|
#include <utf8.h>
|
||||||
|
#else
|
||||||
|
#include "../contrib/utf8cpp/source/utf8.h"
|
||||||
|
#endif
|
||||||
#include "ModelLoader.h"
|
#include "ModelLoader.h"
|
||||||
#include "UTFConverter.h"
|
|
||||||
#include "SafeRelease.hpp"
|
#include "SafeRelease.hpp"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -33,7 +37,6 @@
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
using namespace AssimpSamples::SharedCode;
|
|
||||||
|
|
||||||
#define VERTEX_SHADER_FILE L"VertexShader.hlsl"
|
#define VERTEX_SHADER_FILE L"VertexShader.hlsl"
|
||||||
#define PIXEL_SHADER_FILE L"PixelShader.hlsl"
|
#define PIXEL_SHADER_FILE L"PixelShader.hlsl"
|
||||||
|
@ -154,8 +157,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the model file path.
|
// Retrieve the model file path.
|
||||||
g_ModelPath = UTFConverter(argv[1]).str();
|
std::wstring filename(argv[1]);
|
||||||
|
|
||||||
|
char *targetStart = new char[filename.size()+1];
|
||||||
|
memset(targetStart, '\0', filename.size() + 1);
|
||||||
|
|
||||||
|
utf8::utf16to8(filename.c_str(), filename.c_str() + filename.size(), targetStart);
|
||||||
|
g_ModelPath = targetStart;
|
||||||
|
delete[] targetStart;
|
||||||
free_command_line_allocated_memory();
|
free_command_line_allocated_memory();
|
||||||
|
|
||||||
WNDCLASSEX wc;
|
WNDCLASSEX wc;
|
||||||
|
@ -511,9 +520,9 @@ void InitPipeline()
|
||||||
{
|
{
|
||||||
ID3DBlob *VS, *PS;
|
ID3DBlob *VS, *PS;
|
||||||
if(FAILED(CompileShaderFromFile(SHADER_PATH VERTEX_SHADER_FILE, 0, "main", "vs_4_0", &VS)))
|
if(FAILED(CompileShaderFromFile(SHADER_PATH VERTEX_SHADER_FILE, 0, "main", "vs_4_0", &VS)))
|
||||||
Throwanerror(UTFConverter(L"Failed to compile shader from file " VERTEX_SHADER_FILE).c_str());
|
Throwanerror("Failed to compile shader from file");
|
||||||
if(FAILED(CompileShaderFromFile(SHADER_PATH PIXEL_SHADER_FILE, 0, "main", "ps_4_0", &PS)))
|
if(FAILED(CompileShaderFromFile(SHADER_PATH PIXEL_SHADER_FILE, 0, "main", "ps_4_0", &PS)))
|
||||||
Throwanerror(UTFConverter(L"Failed to compile shader from file " PIXEL_SHADER_FILE).c_str());
|
Throwanerror("Failed to compile shader from file ");
|
||||||
|
|
||||||
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), nullptr, &pVS);
|
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), nullptr, &pVS);
|
||||||
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), nullptr, &pPS);
|
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), nullptr, &pPS);
|
||||||
|
|
|
@ -30,8 +30,6 @@ LINK_DIRECTORIES(
|
||||||
|
|
||||||
ADD_EXECUTABLE( assimp_simpletexturedogl WIN32
|
ADD_EXECUTABLE( assimp_simpletexturedogl WIN32
|
||||||
SimpleTexturedOpenGL/src/model_loading.cpp
|
SimpleTexturedOpenGL/src/model_loading.cpp
|
||||||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.cpp
|
|
||||||
${SAMPLES_SHARED_CODE_DIR}/UTFConverter.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletexturedogl)
|
TARGET_USE_COMMON_OUTPUT_DIRECTORY(assimp_simpletexturedogl)
|
||||||
|
|
|
@ -55,12 +55,6 @@ AnimEvaluator::AnimEvaluator(const aiAnimation *pAnim) :
|
||||||
mLastPositions.resize(pAnim->mNumChannels, std::make_tuple(0, 0, 0));
|
mLastPositions.resize(pAnim->mNumChannels, std::make_tuple(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
// Destructor.
|
|
||||||
AnimEvaluator::~AnimEvaluator() {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Evaluates the animation tracks for a given time stamp.
|
// Evaluates the animation tracks for a given time stamp.
|
||||||
void AnimEvaluator::Evaluate(double pTime) {
|
void AnimEvaluator::Evaluate(double pTime) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
AnimEvaluator(const aiAnimation *pAnim);
|
AnimEvaluator(const aiAnimation *pAnim);
|
||||||
|
|
||||||
/// @brief The class destructor.
|
/// @brief The class destructor.
|
||||||
~AnimEvaluator();
|
~AnimEvaluator() = default;
|
||||||
|
|
||||||
/// @brief Evaluates the animation tracks for a given time stamp.
|
/// @brief Evaluates the animation tracks for a given time stamp.
|
||||||
/// The calculated pose can be retrieved as an array of transformation
|
/// The calculated pose can be retrieved as an array of transformation
|
||||||
|
|
|
@ -77,6 +77,13 @@ public:
|
||||||
pcScene = NULL;
|
pcScene = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the normal set to be used
|
||||||
|
void SetNormalSet(unsigned int iSet);
|
||||||
|
|
||||||
|
// flip all normal vectors
|
||||||
|
void FlipNormals();
|
||||||
|
void FlipNormalsInt();
|
||||||
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// default vertex data structure
|
// default vertex data structure
|
||||||
// (even if tangents, bitangents or normals aren't
|
// (even if tangents, bitangents or normals aren't
|
||||||
|
@ -221,16 +228,8 @@ public:
|
||||||
|
|
||||||
// Specifies the normal set to be used
|
// Specifies the normal set to be used
|
||||||
unsigned int iNormalSet;
|
unsigned int iNormalSet;
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// set the normal set to be used
|
|
||||||
void SetNormalSet(unsigned int iSet);
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
|
||||||
// flip all normal vectors
|
|
||||||
void FlipNormals();
|
|
||||||
void FlipNormalsInt();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace AssimpView
|
} // namespace AssimpView
|
||||||
|
|
||||||
#endif // !! IG
|
#endif // !! IG
|
||||||
|
|
|
@ -175,33 +175,29 @@ VOID WINAPI FillFunc(D3DXVECTOR4* pOut,
|
||||||
pOut->x = pOut->y = 1.0f;
|
pOut->x = pOut->y = 1.0f;
|
||||||
pOut->z = 0.0f;
|
pOut->z = 0.0f;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CMaterialManager::UpdateSpecularMaterials()
|
int CMaterialManager::UpdateSpecularMaterials() {
|
||||||
{
|
if (g_pcAsset && g_pcAsset->pcScene) {
|
||||||
if (g_pcAsset && g_pcAsset->pcScene)
|
for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i) {
|
||||||
{
|
if (aiShadingMode_Phong == g_pcAsset->apcMeshes[i]->eShadingMode) {
|
||||||
for (unsigned int i = 0; i < g_pcAsset->pcScene->mNumMeshes;++i)
|
|
||||||
{
|
|
||||||
if (aiShadingMode_Phong == g_pcAsset->apcMeshes[i]->eShadingMode)
|
|
||||||
{
|
|
||||||
this->DeleteMaterial(g_pcAsset->apcMeshes[i]);
|
this->DeleteMaterial(g_pcAsset->apcMeshes[i]);
|
||||||
this->CreateMaterial(g_pcAsset->apcMeshes[i],g_pcAsset->pcScene->mMeshes[i]);
|
this->CreateMaterial(g_pcAsset->apcMeshes[i],g_pcAsset->pcScene->mMeshes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CMaterialManager::SetDefaultTexture(IDirect3DTexture9** p_ppiOut)
|
int CMaterialManager::SetDefaultTexture(IDirect3DTexture9** p_ppiOut) {
|
||||||
{
|
|
||||||
if (sDefaultTexture) {
|
if (sDefaultTexture) {
|
||||||
sDefaultTexture->AddRef();
|
sDefaultTexture->AddRef();
|
||||||
*p_ppiOut = sDefaultTexture;
|
*p_ppiOut = sDefaultTexture;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(g_piDevice->CreateTexture(
|
if(FAILED(g_piDevice->CreateTexture(
|
||||||
256,
|
256,
|
||||||
256,
|
256,
|
||||||
|
|
|
@ -145,9 +145,7 @@ float g_fLoadTime = 0.0f;
|
||||||
// The loader thread loads the asset while the progress dialog displays the
|
// The loader thread loads the asset while the progress dialog displays the
|
||||||
// smart progress bar
|
// smart progress bar
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
DWORD WINAPI LoadThreadProc(LPVOID lpParameter) {
|
DWORD WINAPI LoadThreadProc(LPVOID) {
|
||||||
UNREFERENCED_PARAMETER(lpParameter);
|
|
||||||
|
|
||||||
// get current time
|
// get current time
|
||||||
double fCur = (double)timeGetTime();
|
double fCur = (double)timeGetTime();
|
||||||
|
|
||||||
|
@ -367,7 +365,7 @@ int CalculateBounds(aiNode *piNode, aiVector3D *p_avOut, const aiMatrix4x4 &piMa
|
||||||
// The function calculates the boundaries of the mesh and modifies the
|
// The function calculates the boundaries of the mesh and modifies the
|
||||||
// global world transformation matrix according to the aset AABB
|
// global world transformation matrix according to the aset AABB
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int ScaleAsset(void) {
|
int ScaleAsset() {
|
||||||
aiVector3D aiVecs[2] = { aiVector3D(1e10f, 1e10f, 1e10f),
|
aiVector3D aiVecs[2] = { aiVector3D(1e10f, 1e10f, 1e10f),
|
||||||
aiVector3D(-1e10f, -1e10f, -1e10f) };
|
aiVector3D(-1e10f, -1e10f, -1e10f) };
|
||||||
|
|
||||||
|
@ -521,8 +519,7 @@ int CreateAssetData() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// create 16 bit index buffer
|
// create 16 bit index buffer
|
||||||
if (FAILED(g_piDevice->CreateIndexBuffer(2 *
|
if (FAILED(g_piDevice->CreateIndexBuffer(2 * numIndices,
|
||||||
numIndices,
|
|
||||||
D3DUSAGE_WRITEONLY | dwUsage,
|
D3DUSAGE_WRITEONLY | dwUsage,
|
||||||
D3DFMT_INDEX16,
|
D3DFMT_INDEX16,
|
||||||
D3DPOOL_DEFAULT,
|
D3DPOOL_DEFAULT,
|
||||||
|
|
|
@ -98,6 +98,12 @@ namespace AssimpView {
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
class AssimpVew {
|
||||||
|
public:
|
||||||
|
AssimpVew();
|
||||||
|
~AssimpVew();
|
||||||
|
};
|
||||||
|
|
||||||
int InitD3D(void);
|
int InitD3D(void);
|
||||||
int ShutdownD3D(void);
|
int ShutdownD3D(void);
|
||||||
int CreateDevice(bool p_bMultiSample, bool p_bSuperSample, bool bHW = true);
|
int CreateDevice(bool p_bMultiSample, bool p_bSuperSample, bool bHW = true);
|
||||||
|
|
Loading…
Reference in New Issue