fix win32-build for assimp_viewer .

Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>
pull/664/head
Kim Kulling 2015-04-17 20:02:55 +02:00
parent f435712273
commit 76dd9467b2
24 changed files with 4278 additions and 4158 deletions

1
.gitignore vendored
View File

@ -58,3 +58,4 @@ test/gtest/src/gtest-stamp/gtest-gitinfo.txt
test/gtest/src/gtest-stamp/gtest-gitclone-lastrun.txt test/gtest/src/gtest-stamp/gtest-gitclone-lastrun.txt
Assimp.opensdf Assimp.opensdf
contrib/zlib/CTestTestfile.cmake contrib/zlib/CTestTestfile.cmake
ipch/assimp_viewer-44bbbcd1/assimp_viewerd-ccc45335.ipch

View File

@ -51,6 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define INCLUDED_AI_STRING_WORKERS_H #define INCLUDED_AI_STRING_WORKERS_H
#include "../include/assimp/ai_assert.h" #include "../include/assimp/ai_assert.h"
#include "StringComparison.h"
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>

View File

@ -39,7 +39,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
using namespace AssimpView; using namespace AssimpView;

View File

@ -43,6 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (!defined AV_ASSET_HELPER_H_INCLUDED) #if (!defined AV_ASSET_HELPER_H_INCLUDED)
#define AV_ASSET_HELPER_H_INCLUDED #define AV_ASSET_HELPER_H_INCLUDED
#include <d3d9.h>
#include <d3dx9.h>
#include <d3dx9mesh.h>
#include <assimp/scene.h>
namespace AssimpView {
class SceneAnimator; class SceneAnimator;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@ -233,5 +241,6 @@ class AssetHelper
void FlipNormals(); void FlipNormals();
void FlipNormalsInt(); void FlipNormalsInt();
}; };
}
#endif // !! IG #endif // !! IG

View File

@ -39,12 +39,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
namespace AssimpView { namespace AssimpView {
extern std::string g_szSkyboxShader;
// From: U3D build 1256 (src\kernel\graphic\scenegraph\SkyBox.cpp) // From: U3D build 1256 (src\kernel\graphic\scenegraph\SkyBox.cpp)
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------

View File

@ -38,10 +38,10 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#pragma once
#if (!defined AV_BACKGROUND_H_INCLUDED) namespace AssimpView
#define AV_BACKGROUND_H_INCLUDED {
class CBackgroundPainter class CBackgroundPainter
{ {
@ -125,4 +125,4 @@ private:
aiMatrix4x4 mMatrix; aiMatrix4x4 mMatrix;
}; };
#endif // !! AV_BACKGROUND_H_INCLUDED }

View File

@ -38,13 +38,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "AnimEvaluator.h"
#include "SceneAnimator.h"
namespace AssimpView { namespace AssimpView {
using namespace Assimp;
extern std::string g_szCheckerBackgroundShader;
struct SVertex struct SVertex
{ {
float x,y,z,w,u,v; float x,y,z,w,u,v;
@ -2240,7 +2243,7 @@ int CDisplay::RenderTextureView()
const float ny = (float)sRect.bottom; const float ny = (float)sRect.bottom;
const float x = (float)sDesc.Width; const float x = (float)sDesc.Width;
const float y = (float)sDesc.Height; const float y = (float)sDesc.Height;
float f = std::min((nx-30) / x,(ny-30) / y) * (m_fTextureZoom/1000.0f); float f = min((nx-30) / x,(ny-30) / y) * (m_fTextureZoom/1000.0f);
float fHalfX = (nx - (f * x)) / 2.0f; float fHalfX = (nx - (f * x)) / 2.0f;
float fHalfY = (ny - (f * y)) / 2.0f; float fHalfY = (ny - (f * y)) / 2.0f;

View File

@ -42,6 +42,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (!defined AV_DISPLAY_H_INCLUDED) #if (!defined AV_DISPLAY_H_INCLUDED)
#define AV_DISPLAY_H_INCLUDE #define AV_DISPLAY_H_INCLUDE
#include <windows.h>
#include <shellapi.h>
#include <commctrl.h>
// see CDisplay::m_aiImageList // see CDisplay::m_aiImageList
#define AI_VIEW_IMGLIST_NODE 0x0 #define AI_VIEW_IMGLIST_NODE 0x0
#define AI_VIEW_IMGLIST_MATERIAL 0x1 #define AI_VIEW_IMGLIST_MATERIAL 0x1
@ -49,6 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_VIEW_IMGLIST_TEXTURE_INVALID 0x3 #define AI_VIEW_IMGLIST_TEXTURE_INVALID 0x3
#define AI_VIEW_IMGLIST_MODEL 0x4 #define AI_VIEW_IMGLIST_MODEL 0x4
namespace AssimpView
{
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
/* Corresponds to the "Display" combobox in the UI /* Corresponds to the "Display" combobox in the UI
*/ */
@ -531,4 +538,5 @@ private:
aiVector3D vPos; aiVector3D vPos;
}; };
}
#endif // AV_DISPLAY_H_INCLUDE #endif // AV_DISPLAY_H_INCLUDE

View File

@ -39,14 +39,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "richedit.h" #include "richedit.h"
namespace AssimpView { namespace AssimpView {
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Message procedure for the help dialog // Message procedure for the help dialog
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------

View File

@ -39,10 +39,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
namespace AssimpView { namespace AssimpView {
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------

View File

@ -39,14 +39,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
namespace AssimpView { namespace AssimpView {
CLogDisplay CLogDisplay::s_cInstance;
/* extern */ CLogDisplay CLogDisplay::s_cInstance;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
void CLogDisplay::AddEntry(const std::string& szText, void CLogDisplay::AddEntry(const std::string& szText,

View File

@ -38,9 +38,12 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#pragma once
#if (!defined AV_LOG_DISPLAY_H_INCLUDED) #include <list>
#define AV_LOG_DISPLAY_H_INCLUDE
namespace AssimpView
{
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
/** \brief Class to display log strings in the upper right corner of the view /** \brief Class to display log strings in the upper right corner of the view
@ -93,4 +96,4 @@ private:
ID3DXFont* piFont; ID3DXFont* piFont;
}; };
#endif // AV_LOG_DISPLAY_H_INCLUDE }

View File

@ -39,13 +39,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "richedit.h" #include "richedit.h"
namespace AssimpView { namespace AssimpView {
/* extern */ CLogWindow CLogWindow::s_cInstance; CLogWindow CLogWindow::s_cInstance;
extern HKEY g_hRegistry; extern HKEY g_hRegistry;
// header for the RTF log file // header for the RTF log file

View File

@ -42,6 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (!defined AV_LOG_WINDOW_H_INCLUDED) #if (!defined AV_LOG_WINDOW_H_INCLUDED)
#define AV_LOG_WINDOW_H_INCLUDE #define AV_LOG_WINDOW_H_INCLUDE
namespace AssimpView
{
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
/** \brief Subclass of Assimp::LogStream used to add all log messages to the /** \brief Subclass of Assimp::LogStream used to add all log messages to the
@ -125,4 +128,6 @@ public:
CMyLogStream* pcStream; CMyLogStream* pcStream;
}; };
}
#endif // AV_LOG_DISPLA #endif // AV_LOG_DISPLA

View File

@ -38,15 +38,106 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include "MaterialManager.h"
#include "AssetHelper.h"
#include <assimp/cimport.h>
#include <assimp/Importer.hpp>
#include <assimp/ai_assert.h>
#include <assimp/cfileio.h>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <assimp/IOSystem.hpp>
#include <assimp/IOStream.hpp>
#include <assimp/LogStream.hpp>
#include <assimp/DefaultLogger.hpp>
#include <../code/StringComparison.h>
#include <vector>
#include <algorithm>
namespace AssimpView { namespace AssimpView {
using namespace Assimp;
/*static */ CMaterialManager CMaterialManager::s_cInstance; extern std::string g_szMaterialShader;
extern HINSTANCE g_hInstance /*= NULL*/;
extern HWND g_hDlg /*= NULL*/;
extern IDirect3D9* g_piD3D /*= NULL*/;
extern IDirect3DDevice9* g_piDevice /*= NULL*/;
extern IDirect3DVertexDeclaration9* gDefaultVertexDecl /*= NULL*/;
extern double g_fFPS /*= 0.0f*/;
extern char g_szFileName[ MAX_PATH ];
extern ID3DXEffect* g_piDefaultEffect /*= NULL*/;
extern ID3DXEffect* g_piNormalsEffect /*= NULL*/;
extern ID3DXEffect* g_piPassThroughEffect /*= NULL*/;
extern ID3DXEffect* g_piPatternEffect /*= NULL*/;
extern bool g_bMousePressed /*= false*/;
extern bool g_bMousePressedR /*= false*/;
extern bool g_bMousePressedM /*= false*/;
extern bool g_bMousePressedBoth /*= false*/;
extern float g_fElpasedTime /*= 0.0f*/;
extern D3DCAPS9 g_sCaps;
extern bool g_bLoadingFinished /*= false*/;
extern HANDLE g_hThreadHandle /*= NULL*/;
extern float g_fWheelPos /*= -10.0f*/;
extern bool g_bLoadingCanceled /*= false*/;
extern IDirect3DTexture9* g_pcTexture /*= NULL*/;
extern aiMatrix4x4 g_mWorld;
extern aiMatrix4x4 g_mWorldRotate;
extern aiVector3D g_vRotateSpeed /*= aiVector3D(0.5f,0.5f,0.5f)*/;
extern aiVector3D g_avLightDirs[ 1 ] /* =
{ aiVector3D(-0.5f,0.6f,0.2f) ,
aiVector3D(-0.5f,0.5f,0.5f)} */;
extern POINT g_mousePos /*= {0,0};*/;
extern POINT g_LastmousePos /*= {0,0}*/;
extern bool g_bFPSView /*= false*/;
extern bool g_bInvert /*= false*/;
extern EClickPos g_eClick;
extern unsigned int g_iCurrentColor /*= 0*/;
// NOTE: The light intensity is separated from the color, it can
// directly be manipulated using the middle mouse button.
// When the user chooses a color from the palette the intensity
// is reset to 1.0
// index[2] is the ambient color
extern float g_fLightIntensity /*=0.0f*/;
extern D3DCOLOR g_avLightColors[ 3 ];
extern RenderOptions g_sOptions;
extern Camera g_sCamera;
extern AssetHelper *g_pcAsset /*= NULL*/;
//
// Contains the mask image for the HUD
// (used to determine the position of a click)
//
// The size of the image is identical to the size of the main
// HUD texture
//
extern unsigned char* g_szImageMask /*= NULL*/;
extern float g_fACMR /*= 3.0f*/;
extern IDirect3DQuery9* g_piQuery;
extern bool g_bPlay /*= false*/;
extern double g_dCurrent;
extern float g_smoothAngle /*= 80.f*/;
extern unsigned int ppsteps, ppstepsdefault;
extern bool nopointslines;
CMaterialManager CMaterialManager::s_cInstance;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// D3DX callback function to fill a texture with a checkers pattern // D3DX callback function to fill a texture with a checkers pattern
@ -184,7 +275,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
for (unsigned int i = 0; i < iSizeFound;++i) for (unsigned int i = 0; i < iSizeFound;++i)
info.cFileName[i] = (CHAR)tolower(info.cFileName[i]); info.cFileName[i] = (CHAR)tolower(info.cFileName[i]);
if (0 == memcmp(info.cFileName,szFile2, std::min(iSizeFound,iSize))) if (0 == memcmp(info.cFileName,szFile2, min(iSizeFound,iSize)))
{ {
// we have it. Build the full path ... // we have it. Build the full path ...
char* sz = strrchr(szTempB,'*'); char* sz = strrchr(szTempB,'*');

View File

@ -39,8 +39,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#if (!defined AV_MATERIAL_H_INCLUDED) #pragma once
#define AV_MATERIAL_H_INCLUDE
#include <map>
#include "AssetHelper.h"
namespace AssimpView
{
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
/* Helper class to create, access and destroy materials /* Helper class to create, access and destroy materials
@ -199,4 +205,4 @@ private:
TextureCache sCachedTextures; TextureCache sCachedTextures;
}; };
#endif //!! include guard }

View File

@ -39,7 +39,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include <map> #include <map>
@ -47,7 +46,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace AssimpView { namespace AssimpView {
CMeshRenderer CMeshRenderer::s_cInstance; CMeshRenderer CMeshRenderer::s_cInstance;
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------

View File

@ -42,6 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (!defined AV_MESH_RENDERER_H_INCLUDED) #if (!defined AV_MESH_RENDERER_H_INCLUDED)
#define AV_MESH_RENDERER_H_INCLUDED #define AV_MESH_RENDERER_H_INCLUDED
namespace AssimpView {
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@ -94,4 +95,5 @@ private:
}; };
}
#endif //!! include guard #endif //!! include guard

View File

@ -39,12 +39,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include <assimp/Exporter.hpp>
#include <algorithm>
#include <windowsx.h> #include <windowsx.h>
namespace AssimpView { namespace AssimpView {
using namespace Assimp;
// Static array to keep custom color values // Static array to keep custom color values
COLORREF g_aclCustomColors[16] = {0}; COLORREF g_aclCustomColors[16] = {0};
@ -1044,9 +1048,9 @@ void DoExport(size_t formatId)
ai_assert(strlen(szFileName) <= MAX_PATH); ai_assert(strlen(szFileName) <= MAX_PATH);
// invent a nice default file name // invent a nice default file name
char* sz = std::max(strrchr(szFileName,'\\'),strrchr(szFileName,'/')); char* sz = max(strrchr(szFileName,'\\'),strrchr(szFileName,'/'));
if (sz) { if (sz) {
strncpy(sz,std::max(strrchr(g_szFileName,'\\'),strrchr(g_szFileName,'/')),MAX_PATH); strncpy(sz,max(strrchr(g_szFileName,'\\'),strrchr(g_szFileName,'/')),MAX_PATH);
} }
} }
else { else {

View File

@ -40,7 +40,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
// note: these are no longer part of the public API, but they are // note: these are no longer part of the public API, but they are
@ -53,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace AssimpView { namespace AssimpView {
using namespace Assimp;
bool g_bWasFlipped = false; bool g_bWasFlipped = false;
float g_smoothAngle = 80.f; float g_smoothAngle = 80.f;

View File

@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the utility class SceneAnimator * @brief Implementation of the utility class SceneAnimator
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
using namespace AssimpView; using namespace AssimpView;

View File

@ -38,13 +38,9 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
namespace AssimpView {
namespace AssimpView
{
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string g_szNormalsShader = std::string( std::string g_szNormalsShader = std::string(

View File

@ -40,16 +40,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "stdafx.h"
#include "assimp_view.h" #include "assimp_view.h"
#include <map> #include <map>
using namespace std; using namespace std;
namespace AssimpView { namespace AssimpView {
extern std::string g_szNormalsShader;
extern std::string g_szDefaultShader;
extern std::string g_szPassThroughShader;
//-------------------------------------------------------------------------------
// evil globals
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
HWND g_hDlg = NULL; HWND g_hDlg = NULL;
@ -361,12 +362,12 @@ int CalculateBounds(aiNode* piNode, aiVector3D* p_avOut,
D3DXVec3TransformCoord((D3DXVECTOR3*)&pc1,(D3DXVECTOR3*)&pc, D3DXVec3TransformCoord((D3DXVECTOR3*)&pc1,(D3DXVECTOR3*)&pc,
(D3DXMATRIX*)&aiMe); (D3DXMATRIX*)&aiMe);
p_avOut[0].x = std::min( p_avOut[0].x, pc1.x); p_avOut[0].x = min( p_avOut[0].x, pc1.x);
p_avOut[0].y = std::min( p_avOut[0].y, pc1.y); p_avOut[0].y = min( p_avOut[0].y, pc1.y);
p_avOut[0].z = std::min( p_avOut[0].z, pc1.z); p_avOut[0].z = min( p_avOut[0].z, pc1.z);
p_avOut[1].x = std::max( p_avOut[1].x, pc1.x); p_avOut[1].x = max( p_avOut[1].x, pc1.x);
p_avOut[1].y = std::max( p_avOut[1].y, pc1.y); p_avOut[1].y = max( p_avOut[1].y, pc1.y);
p_avOut[1].z = std::max( p_avOut[1].z, pc1.z); p_avOut[1].z = max( p_avOut[1].z, pc1.z);
} }
} }
for (unsigned int i = 0; i < piNode->mNumChildren;++i) for (unsigned int i = 0; i < piNode->mNumChildren;++i)
@ -593,10 +594,10 @@ int CreateAssetData()
if (mesh->HasVertexColors( 0)) { if (mesh->HasVertexColors( 0)) {
pbData2->dColorDiffuse = D3DCOLOR_ARGB( pbData2->dColorDiffuse = D3DCOLOR_ARGB(
((unsigned char)std::max( std::min( mesh->mColors[0][x].a * 255.0f, 255.0f),0.0f)), ((unsigned char)max( min( mesh->mColors[0][x].a * 255.0f, 255.0f),0.0f)),
((unsigned char)std::max( std::min( mesh->mColors[0][x].r * 255.0f, 255.0f),0.0f)), ((unsigned char)max( min( mesh->mColors[0][x].r * 255.0f, 255.0f),0.0f)),
((unsigned char)std::max( std::min( mesh->mColors[0][x].g * 255.0f, 255.0f),0.0f)), ((unsigned char)max( min( mesh->mColors[0][x].g * 255.0f, 255.0f),0.0f)),
((unsigned char)std::max( std::min( mesh->mColors[0][x].b * 255.0f, 255.0f),0.0f))); ((unsigned char)max( min( mesh->mColors[0][x].b * 255.0f, 255.0f),0.0f)));
} }
else pbData2->dColorDiffuse = D3DCOLOR_ARGB(0xFF,0xff,0xff,0xff); else pbData2->dColorDiffuse = D3DCOLOR_ARGB(0xFF,0xff,0xff,0xff);

View File

@ -47,6 +47,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// include resource definitions // include resource definitions
#include "resource.h" #include "resource.h"
#include <assert.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>
#include <time.h>
// Include ASSIMP headers (XXX: do we really need all of them?) // Include ASSIMP headers (XXX: do we really need all of them?)
#include <assimp/cimport.h> #include <assimp/cimport.h>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
@ -59,29 +67,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/LogStream.hpp> #include <assimp/LogStream.hpp>
#include <assimp/DefaultLogger.hpp> #include <assimp/DefaultLogger.hpp>
#include "../../code/AssimpPCH.h" /* HACK */
#include "../../code/MaterialSystem.h" // aiMaterial class #include "../../code/MaterialSystem.h" // aiMaterial class
#include "../../code/StringComparison.h" // ASSIMP_stricmp and ASSIMP_strincmp #include "../../code/StringComparison.h" // ASSIMP_stricmp and ASSIMP_strincmp
// in order for std::min and std::max to behave properly // in order for std::min and std::max to behave properly
#ifdef min /*#ifdef min
#undef min #undef min
#endif // min #endif // min
#ifdef max #ifdef max
#undef max #undef max
#endif // min #endif // min*/
#include <time.h> #include <time.h>
// default movement speed // default movement speed
#define MOVE_SPEED 3.f #define MOVE_SPEED 3.f
using namespace Assimp;
namespace AssimpView
{
#include "AssetHelper.h" #include "AssetHelper.h"
#include "Camera.h" #include "Camera.h"
#include "RenderOptions.h" #include "RenderOptions.h"
@ -93,7 +95,6 @@ namespace AssimpView
#include "MeshRenderer.h" #include "MeshRenderer.h"
#include "MaterialManager.h" #include "MaterialManager.h"
} // end of namespace AssimpView - for a while
// outside of namespace, to help Intellisense and solve boost::metatype_stuff_miracle // outside of namespace, to help Intellisense and solve boost::metatype_stuff_miracle
#include "AnimEvaluator.h" #include "AnimEvaluator.h"
@ -160,7 +161,7 @@ INT_PTR CALLBACK AboutMessageProc(HWND hwndDlg,UINT uMsg,
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// //
// Dialog prcoedure for the help dialog // Dialog procedure for the help dialog
// //
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg, INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg,
@ -182,7 +183,7 @@ type clamp(intype in)
{ {
// for unsigned types only ... // for unsigned types only ...
intype mask = (0x1u << (sizeof(type)*8))-1; intype mask = (0x1u << (sizeof(type)*8))-1;
return (type)std::max((intype)0,std::min(in,mask)); return (type)max((intype)0,min(in,mask));
} }