fix win32-build for assimp_viewer .
Signed-off-by: Kim Kulling <kim.kulling@googlemail.com>pull/664/head
parent
f435712273
commit
76dd9467b2
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -43,13 +43,21 @@ 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
|
||||||
|
|
||||||
class SceneAnimator;
|
#include <d3d9.h>
|
||||||
|
#include <d3dx9.h>
|
||||||
|
#include <d3dx9mesh.h>
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
#include <assimp/scene.h>
|
||||||
/** \brief Class to wrap ASSIMP's asset output structures
|
|
||||||
*/
|
namespace AssimpView {
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
class AssetHelper
|
class SceneAnimator;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
/** \brief Class to wrap ASSIMP's asset output structures
|
||||||
|
*/
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
class AssetHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
|
@ -66,7 +74,7 @@ class AssetHelper
|
||||||
|
|
||||||
// default constructor
|
// default constructor
|
||||||
AssetHelper()
|
AssetHelper()
|
||||||
: iNormalSet(ORIGINAL)
|
: iNormalSet( ORIGINAL )
|
||||||
{
|
{
|
||||||
mAnimator = NULL;
|
mAnimator = NULL;
|
||||||
apcMeshes = NULL;
|
apcMeshes = NULL;
|
||||||
|
@ -88,8 +96,8 @@ class AssetHelper
|
||||||
aiVector3D vBitangent;
|
aiVector3D vBitangent;
|
||||||
aiVector2D vTextureUV;
|
aiVector2D vTextureUV;
|
||||||
aiVector2D vTextureUV2;
|
aiVector2D vTextureUV2;
|
||||||
unsigned char mBoneIndices[4];
|
unsigned char mBoneIndices[ 4 ];
|
||||||
unsigned char mBoneWeights[4]; // last Weight not used, calculated inside the vertex shader
|
unsigned char mBoneWeights[ 4 ]; // last Weight not used, calculated inside the vertex shader
|
||||||
|
|
||||||
/** Returns the vertex declaration elements to create a declaration from. */
|
/** Returns the vertex declaration elements to create a declaration from. */
|
||||||
static D3DVERTEXELEMENT9* GetDeclarationElements()
|
static D3DVERTEXELEMENT9* GetDeclarationElements()
|
||||||
|
@ -135,26 +143,26 @@ class AssetHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MeshHelper ()
|
MeshHelper()
|
||||||
:
|
:
|
||||||
piVB (NULL),
|
piVB( NULL ),
|
||||||
piIB (NULL),
|
piIB( NULL ),
|
||||||
piVBNormals (NULL),
|
piVBNormals( NULL ),
|
||||||
piEffect (NULL),
|
piEffect( NULL ),
|
||||||
bSharedFX (false),
|
bSharedFX( false ),
|
||||||
piDiffuseTexture (NULL),
|
piDiffuseTexture( NULL ),
|
||||||
piSpecularTexture (NULL),
|
piSpecularTexture( NULL ),
|
||||||
piAmbientTexture (NULL),
|
piAmbientTexture( NULL ),
|
||||||
piEmissiveTexture (NULL),
|
piEmissiveTexture( NULL ),
|
||||||
piNormalTexture (NULL),
|
piNormalTexture( NULL ),
|
||||||
piOpacityTexture (NULL),
|
piOpacityTexture( NULL ),
|
||||||
piShininessTexture (NULL),
|
piShininessTexture( NULL ),
|
||||||
piLightmapTexture (NULL),
|
piLightmapTexture( NULL ),
|
||||||
twosided (false),
|
twosided( false ),
|
||||||
pvOriginalNormals (NULL)
|
pvOriginalNormals( NULL )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~MeshHelper ()
|
~MeshHelper()
|
||||||
{
|
{
|
||||||
// NOTE: This is done in DeleteAssetData()
|
// NOTE: This is done in DeleteAssetData()
|
||||||
// TODO: Make this a proper d'tor
|
// TODO: Make this a proper d'tor
|
||||||
|
@ -226,12 +234,13 @@ class AssetHelper
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// set the normal set to be used
|
// set the normal set to be used
|
||||||
void SetNormalSet(unsigned int iSet);
|
void SetNormalSet( unsigned int iSet );
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// flip all normal vectors
|
// flip all normal vectors
|
||||||
void FlipNormals();
|
void FlipNormals();
|
||||||
void FlipNormalsInt();
|
void FlipNormalsInt();
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !! IG
|
#endif // !! IG
|
||||||
|
|
|
@ -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)
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -38,40 +38,40 @@ 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
|
|
||||||
{
|
{
|
||||||
CBackgroundPainter()
|
CBackgroundPainter()
|
||||||
:
|
:
|
||||||
clrColor(D3DCOLOR_ARGB(0xFF,100,100,100)),
|
clrColor( D3DCOLOR_ARGB( 0xFF, 100, 100, 100 ) ),
|
||||||
pcTexture(NULL),
|
pcTexture( NULL ),
|
||||||
piSkyBoxEffect(NULL),
|
piSkyBoxEffect( NULL ),
|
||||||
eMode(SIMPLE_COLOR)
|
eMode( SIMPLE_COLOR )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Supported background draw modi
|
// Supported background draw modi
|
||||||
enum MODE {SIMPLE_COLOR, TEXTURE_2D, TEXTURE_CUBE};
|
enum MODE { SIMPLE_COLOR, TEXTURE_2D, TEXTURE_CUBE };
|
||||||
|
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CBackgroundPainter s_cInstance;
|
static CBackgroundPainter s_cInstance;
|
||||||
inline static CBackgroundPainter& Instance ()
|
inline static CBackgroundPainter& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the current background color
|
// set the current background color
|
||||||
// (this removes any textures loaded)
|
// (this removes any textures loaded)
|
||||||
void SetColor (D3DCOLOR p_clrNew);
|
void SetColor( D3DCOLOR p_clrNew );
|
||||||
|
|
||||||
// Setup a cubemap/a 2d texture as background
|
// Setup a cubemap/a 2d texture as background
|
||||||
void SetCubeMapBG (const char* p_szPath);
|
void SetCubeMapBG( const char* p_szPath );
|
||||||
void SetTextureBG (const char* p_szPath);
|
void SetTextureBG( const char* p_szPath );
|
||||||
|
|
||||||
// Called by the render loop
|
// Called by the render loop
|
||||||
void OnPreRender();
|
void OnPreRender();
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
void RecreateNativeResource();
|
void RecreateNativeResource();
|
||||||
|
|
||||||
// Rotate the skybox
|
// Rotate the skybox
|
||||||
void RotateSB(const aiMatrix4x4* pm);
|
void RotateSB( const aiMatrix4x4* pm );
|
||||||
|
|
||||||
// Reset the state of the skybox
|
// Reset the state of the skybox
|
||||||
void ResetSB();
|
void ResetSB();
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
return this->piSkyBoxEffect;
|
return this->piSkyBoxEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void RemoveSBDeps();
|
void RemoveSBDeps();
|
||||||
|
|
||||||
|
@ -125,4 +125,4 @@ private:
|
||||||
aiMatrix4x4 mMatrix;
|
aiMatrix4x4 mMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !! AV_BACKGROUND_H_INCLUDED
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,48 +53,51 @@ 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
|
{
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
class CDisplay
|
/* Corresponds to the "Display" combobox in the UI
|
||||||
|
*/
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
class CDisplay
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// helper class
|
// helper class
|
||||||
struct Info
|
struct Info
|
||||||
{
|
{
|
||||||
Info( D3DXVECTOR4* p1,
|
Info( D3DXVECTOR4* p1,
|
||||||
AssetHelper::MeshHelper* p2,
|
AssetHelper::MeshHelper* p2,
|
||||||
const char* p3)
|
const char* p3 )
|
||||||
: pclrColor(p1),pMesh(p2),szShaderParam(p3) {}
|
: pclrColor( p1 ), pMesh( p2 ), szShaderParam( p3 ) {}
|
||||||
|
|
||||||
D3DXVECTOR4* pclrColor;
|
D3DXVECTOR4* pclrColor;
|
||||||
AssetHelper::MeshHelper* pMesh;
|
AssetHelper::MeshHelper* pMesh;
|
||||||
const char* szShaderParam;
|
const char* szShaderParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
// default constructor
|
// default constructor
|
||||||
CDisplay()
|
CDisplay()
|
||||||
: m_iViewMode(VIEWMODE_FULL),
|
: m_iViewMode( VIEWMODE_FULL ),
|
||||||
m_pcCurrentTexture(NULL),
|
m_pcCurrentTexture( NULL ),
|
||||||
m_pcCurrentNode(NULL),
|
m_pcCurrentNode( NULL ),
|
||||||
m_pcCurrentMaterial(NULL),
|
m_pcCurrentMaterial( NULL ),
|
||||||
m_hImageList(NULL),
|
m_hImageList( NULL ),
|
||||||
m_hRoot(NULL),
|
m_hRoot( NULL ),
|
||||||
m_fTextureZoom(1000.0f)
|
m_fTextureZoom( 1000.0f )
|
||||||
{
|
{
|
||||||
this->m_aiImageList[0] = 0;
|
this->m_aiImageList[ 0 ] = 0;
|
||||||
this->m_aiImageList[1] = 1;
|
this->m_aiImageList[ 1 ] = 1;
|
||||||
this->m_aiImageList[2] = 2;
|
this->m_aiImageList[ 2 ] = 2;
|
||||||
this->m_aiImageList[3] = 3;
|
this->m_aiImageList[ 3 ] = 3;
|
||||||
this->m_aiImageList[4] = 4;
|
this->m_aiImageList[ 4 ] = 4;
|
||||||
|
|
||||||
this->m_avCheckerColors[0].x = this->m_avCheckerColors[0].y = this->m_avCheckerColors[0].z = 0.4f;
|
this->m_avCheckerColors[ 0 ].x = this->m_avCheckerColors[ 0 ].y = this->m_avCheckerColors[ 0 ].z = 0.4f;
|
||||||
this->m_avCheckerColors[1].x = this->m_avCheckerColors[1].y = this->m_avCheckerColors[1].z = 0.6f;
|
this->m_avCheckerColors[ 1 ].x = this->m_avCheckerColors[ 1 ].y = this->m_avCheckerColors[ 1 ].z = 0.6f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -181,7 +188,7 @@ public:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CDisplay s_cInstance;
|
static CDisplay s_cInstance;
|
||||||
inline static CDisplay& Instance ()
|
inline static CDisplay& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +204,7 @@ public:
|
||||||
// view the method determines the new view mode and performs all
|
// view the method determines the new view mode and performs all
|
||||||
// required operations
|
// required operations
|
||||||
// \param p_hTreeItem Selected tree view item
|
// \param p_hTreeItem Selected tree view item
|
||||||
int OnSetup(HTREEITEM p_hTreeItem);
|
int OnSetup( HTREEITEM p_hTreeItem );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Variant 1: Render the full scene with the asset
|
// Variant 1: Render the full scene with the asset
|
||||||
|
@ -223,14 +230,14 @@ public:
|
||||||
// Fill the UI combobox with a list of all supported view modi
|
// Fill the UI combobox with a list of all supported view modi
|
||||||
//
|
//
|
||||||
// The display modes are added in order
|
// The display modes are added in order
|
||||||
int FillDisplayList(void);
|
int FillDisplayList( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Add a material and all sub textures to the display mode list
|
// Add a material and all sub textures to the display mode list
|
||||||
// hRoot - Handle to the root of the tree view
|
// hRoot - Handle to the root of the tree view
|
||||||
// iIndex - Material index
|
// iIndex - Material index
|
||||||
int AddMaterialToDisplayList(HTREEITEM hRoot,
|
int AddMaterialToDisplayList( HTREEITEM hRoot,
|
||||||
unsigned int iIndex);
|
unsigned int iIndex );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Add a texture to the display list
|
// Add a texture to the display list
|
||||||
|
@ -240,14 +247,14 @@ public:
|
||||||
// iUVIndex - UV index to be used for the texture
|
// iUVIndex - UV index to be used for the texture
|
||||||
// fBlendFactor - Blend factor to be used for the texture
|
// fBlendFactor - Blend factor to be used for the texture
|
||||||
// eTextureOp - texture operation to be used for the texture
|
// eTextureOp - texture operation to be used for the texture
|
||||||
int AddTextureToDisplayList(unsigned int iType,
|
int AddTextureToDisplayList( unsigned int iType,
|
||||||
unsigned int iIndex,
|
unsigned int iIndex,
|
||||||
const aiString* szPath,
|
const aiString* szPath,
|
||||||
HTREEITEM hFX,
|
HTREEITEM hFX,
|
||||||
unsigned int iUVIndex = 0,
|
unsigned int iUVIndex = 0,
|
||||||
const float fBlendFactor = 0.0f,
|
const float fBlendFactor = 0.0f,
|
||||||
aiTextureOp eTextureOp = aiTextureOp_Multiply,
|
aiTextureOp eTextureOp = aiTextureOp_Multiply,
|
||||||
unsigned int iMesh = 0);
|
unsigned int iMesh = 0 );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Add a node to the display list
|
// Add a node to the display list
|
||||||
|
@ -260,7 +267,7 @@ public:
|
||||||
unsigned int iIndex,
|
unsigned int iIndex,
|
||||||
unsigned int iDepth,
|
unsigned int iDepth,
|
||||||
aiNode* pcNode,
|
aiNode* pcNode,
|
||||||
HTREEITEM hRoot);
|
HTREEITEM hRoot );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Add a mesh to the display list
|
// Add a mesh to the display list
|
||||||
|
@ -268,11 +275,11 @@ public:
|
||||||
// hRoot - Parent tree view node
|
// hRoot - Parent tree view node
|
||||||
int AddMeshToDisplayList(
|
int AddMeshToDisplayList(
|
||||||
unsigned int iIndex,
|
unsigned int iIndex,
|
||||||
HTREEITEM hRoot);
|
HTREEITEM hRoot );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Load the image list for the tree view item
|
// Load the image list for the tree view item
|
||||||
int LoadImageList(void);
|
int LoadImageList( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Expand all nodes in the tree
|
// Expand all nodes in the tree
|
||||||
|
@ -281,46 +288,46 @@ public:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Fill the UI combobox with a list of all supported animations
|
// Fill the UI combobox with a list of all supported animations
|
||||||
// The animations are added in order
|
// The animations are added in order
|
||||||
int FillAnimList(void);
|
int FillAnimList( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Clear the combox box containing the list of animations
|
// Clear the combox box containing the list of animations
|
||||||
int ClearAnimList(void);
|
int ClearAnimList( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Clear the combox box containing the list of scenegraph items
|
// Clear the combox box containing the list of scenegraph items
|
||||||
int ClearDisplayList(void);
|
int ClearDisplayList( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Fill in the default statistics
|
// Fill in the default statistics
|
||||||
int FillDefaultStatistics(void);
|
int FillDefaultStatistics( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Called by LoadAsset()
|
// Called by LoadAsset()
|
||||||
// reset the class instance to the default values
|
// reset the class instance to the default values
|
||||||
int Reset(void);
|
int Reset( void );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Replace the texture that is current selected with
|
// Replace the texture that is current selected with
|
||||||
// a new texture
|
// a new texture
|
||||||
int ReplaceCurrentTexture(const char* szPath);
|
int ReplaceCurrentTexture( const char* szPath );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Display the context menu (if there) for the specified tree item
|
// Display the context menu (if there) for the specified tree item
|
||||||
// hItem Valid tree view item handle
|
// hItem Valid tree view item handle
|
||||||
int ShowTreeViewContextMenu(HTREEITEM hItem);
|
int ShowTreeViewContextMenu( HTREEITEM hItem );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Event handling for pop-up menus displayed by th tree view
|
// Event handling for pop-up menus displayed by th tree view
|
||||||
int HandleTreeViewPopup(WPARAM wParam,LPARAM lParam);
|
int HandleTreeViewPopup( WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Enable animation-related parts of the UI
|
// Enable animation-related parts of the UI
|
||||||
int EnableAnimTools(BOOL hm) ;
|
int EnableAnimTools( BOOL hm );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// setter for m_iViewMode
|
// setter for m_iViewMode
|
||||||
inline void SetViewMode(unsigned int p_iNew)
|
inline void SetViewMode( unsigned int p_iNew )
|
||||||
{
|
{
|
||||||
this->m_iViewMode = p_iNew;
|
this->m_iViewMode = p_iNew;
|
||||||
}
|
}
|
||||||
|
@ -334,84 +341,84 @@ public:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// change the texture view's zoom factor
|
// change the texture view's zoom factor
|
||||||
inline void SetTextureViewZoom(float f)
|
inline void SetTextureViewZoom( float f )
|
||||||
{
|
{
|
||||||
// FIX: Removed log(), seems to make more problems than it fixes
|
// FIX: Removed log(), seems to make more problems than it fixes
|
||||||
this->m_fTextureZoom += f* 15;
|
this->m_fTextureZoom += f * 15;
|
||||||
if (this->m_fTextureZoom < 0.05f)this->m_fTextureZoom = 0.05f;
|
if( this->m_fTextureZoom < 0.05f )this->m_fTextureZoom = 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// change the texture view's offset on the x axis
|
// change the texture view's offset on the x axis
|
||||||
inline void SetTextureViewOffsetX(float f)
|
inline void SetTextureViewOffsetX( float f )
|
||||||
{
|
{
|
||||||
this->m_vTextureOffset.x += f;
|
this->m_vTextureOffset.x += f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// change the texture view's offset on the y axis
|
// change the texture view's offset on the y axis
|
||||||
inline void SetTextureViewOffsetY(float f)
|
inline void SetTextureViewOffsetY( float f )
|
||||||
{
|
{
|
||||||
this->m_vTextureOffset.y += f;
|
this->m_vTextureOffset.y += f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// add a new texture to the list
|
// add a new texture to the list
|
||||||
inline void AddTexture(const TextureInfo& info)
|
inline void AddTexture( const TextureInfo& info )
|
||||||
{
|
{
|
||||||
this->m_asTextures.push_back(info);
|
this->m_asTextures.push_back( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// add a new node to the list
|
// add a new node to the list
|
||||||
inline void AddNode(const NodeInfo& info)
|
inline void AddNode( const NodeInfo& info )
|
||||||
{
|
{
|
||||||
this->m_asNodes.push_back(info);
|
this->m_asNodes.push_back( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// add a new mesh to the list
|
// add a new mesh to the list
|
||||||
inline void AddMesh(const MeshInfo& info)
|
inline void AddMesh( const MeshInfo& info )
|
||||||
{
|
{
|
||||||
this->m_asMeshes.push_back(info);
|
this->m_asMeshes.push_back( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// add a new material to the list
|
// add a new material to the list
|
||||||
inline void AddMaterial(const MaterialInfo& info)
|
inline void AddMaterial( const MaterialInfo& info )
|
||||||
{
|
{
|
||||||
this->m_asMaterials.push_back(info);
|
this->m_asMaterials.push_back( info );
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// set the primary color of the checker pattern background
|
// set the primary color of the checker pattern background
|
||||||
inline void SetFirstCheckerColor(D3DXVECTOR4 c)
|
inline void SetFirstCheckerColor( D3DXVECTOR4 c )
|
||||||
{
|
{
|
||||||
this->m_avCheckerColors[0] = c;
|
this->m_avCheckerColors[ 0 ] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// set the secondary color of the checker pattern background
|
// set the secondary color of the checker pattern background
|
||||||
inline void SetSecondCheckerColor(D3DXVECTOR4 c)
|
inline void SetSecondCheckerColor( D3DXVECTOR4 c )
|
||||||
{
|
{
|
||||||
this->m_avCheckerColors[1] = c;
|
this->m_avCheckerColors[ 1 ] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// get the primary color of the checker pattern background
|
// get the primary color of the checker pattern background
|
||||||
inline const D3DXVECTOR4* GetFirstCheckerColor() const
|
inline const D3DXVECTOR4* GetFirstCheckerColor() const
|
||||||
{
|
{
|
||||||
return &this->m_avCheckerColors[0];
|
return &this->m_avCheckerColors[ 0 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// get the secondary color of the checker pattern background
|
// get the secondary color of the checker pattern background
|
||||||
inline const D3DXVECTOR4* GetSecondCheckerColor() const
|
inline const D3DXVECTOR4* GetSecondCheckerColor() const
|
||||||
{
|
{
|
||||||
return &this->m_avCheckerColors[1];
|
return &this->m_avCheckerColors[ 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Render a screen-filling square using the checker pattern shader
|
// Render a screen-filling square using the checker pattern shader
|
||||||
|
@ -422,8 +429,8 @@ private:
|
||||||
// piNode Node to be rendered
|
// piNode Node to be rendered
|
||||||
// piMatrix Current transformation matrix
|
// piMatrix Current transformation matrix
|
||||||
// bAlpha Render alpha or opaque objects only?
|
// bAlpha Render alpha or opaque objects only?
|
||||||
int RenderNode (aiNode* piNode,const aiMatrix4x4& piMatrix,
|
int RenderNode( aiNode* piNode, const aiMatrix4x4& piMatrix,
|
||||||
bool bAlpha = false);
|
bool bAlpha = false );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Setup the camera for the stereo view rendering mode
|
// Setup the camera for the stereo view rendering mode
|
||||||
|
@ -432,7 +439,7 @@ private:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Render the second view (for the right eye) in stereo mod
|
// Render the second view (for the right eye) in stereo mod
|
||||||
// m - World matrix
|
// m - World matrix
|
||||||
int RenderStereoView(const aiMatrix4x4& m);
|
int RenderStereoView( const aiMatrix4x4& m );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Handle user input
|
// Handle user input
|
||||||
|
@ -453,17 +460,17 @@ private:
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Used by OnSetup().
|
// Used by OnSetup().
|
||||||
// Do everything necessary to switch to texture view mode
|
// Do everything necessary to switch to texture view mode
|
||||||
int OnSetupTextureView(TextureInfo* pcNew);
|
int OnSetupTextureView( TextureInfo* pcNew );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Used by OnSetup().
|
// Used by OnSetup().
|
||||||
// Do everything necessary to switch to material view mode
|
// Do everything necessary to switch to material view mode
|
||||||
int OnSetupMaterialView(MaterialInfo* pcNew);
|
int OnSetupMaterialView( MaterialInfo* pcNew );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Used by OnSetup().
|
// Used by OnSetup().
|
||||||
// Do everything necessary to switch to node view mode
|
// Do everything necessary to switch to node view mode
|
||||||
int OnSetupNodeView(NodeInfo* pcNew);
|
int OnSetupNodeView( NodeInfo* pcNew );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Used by OnSetup().
|
// Used by OnSetup().
|
||||||
|
@ -472,16 +479,16 @@ private:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Used by HandleTreeViewPopup().
|
// Used by HandleTreeViewPopup().
|
||||||
int HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam);
|
int HandleTreeViewPopup2( WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Render skeleton
|
// Render skeleton
|
||||||
int RenderSkeleton (aiNode* piNode,const aiMatrix4x4& piMatrix,
|
int RenderSkeleton( aiNode* piNode, const aiMatrix4x4& piMatrix,
|
||||||
const aiMatrix4x4& parent);
|
const aiMatrix4x4& parent );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// view mode
|
// view mode
|
||||||
unsigned int m_iViewMode;
|
unsigned int m_iViewMode;
|
||||||
|
@ -508,7 +515,7 @@ private:
|
||||||
MaterialInfo* m_pcCurrentMaterial;
|
MaterialInfo* m_pcCurrentMaterial;
|
||||||
|
|
||||||
// indices into the image list of the "display" tree view control
|
// indices into the image list of the "display" tree view control
|
||||||
unsigned int m_aiImageList[5]; /* = {0,1,2,3,4};*/
|
unsigned int m_aiImageList[ 5 ]; /* = {0,1,2,3,4};*/
|
||||||
|
|
||||||
// Image list
|
// Image list
|
||||||
HIMAGELIST m_hImageList;
|
HIMAGELIST m_hImageList;
|
||||||
|
@ -524,11 +531,12 @@ private:
|
||||||
|
|
||||||
// Colors used to draw the checker pattern (for the
|
// Colors used to draw the checker pattern (for the
|
||||||
// texture viewer as background )
|
// texture viewer as background )
|
||||||
D3DXVECTOR4 m_avCheckerColors[2];
|
D3DXVECTOR4 m_avCheckerColors[ 2 ];
|
||||||
|
|
||||||
// View projection matrix
|
// View projection matrix
|
||||||
aiMatrix4x4 mViewProjection;
|
aiMatrix4x4 mViewProjection;
|
||||||
aiVector3D vPos;
|
aiVector3D vPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // AV_DISPLAY_H_INCLUDE
|
#endif // AV_DISPLAY_H_INCLUDE
|
|
@ -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
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -38,28 +38,31 @@ 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
|
{
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
class CLogDisplay
|
/** \brief Class to display log strings in the upper right corner of the view
|
||||||
|
*/
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
class CLogDisplay
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CLogDisplay() {}
|
CLogDisplay() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// data structure for an entry in the log queue
|
// data structure for an entry in the log queue
|
||||||
struct SEntry
|
struct SEntry
|
||||||
{
|
{
|
||||||
SEntry ()
|
SEntry()
|
||||||
:
|
:
|
||||||
clrColor(D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0x00)), dwStartTicks(0)
|
clrColor( D3DCOLOR_ARGB( 0xFF, 0xFF, 0xFF, 0x00 ) ), dwStartTicks( 0 )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::string szText;
|
std::string szText;
|
||||||
|
@ -69,14 +72,14 @@ public:
|
||||||
|
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CLogDisplay s_cInstance;
|
static CLogDisplay s_cInstance;
|
||||||
inline static CLogDisplay& Instance ()
|
inline static CLogDisplay& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add an entry to the log queue
|
// Add an entry to the log queue
|
||||||
void AddEntry(const std::string& szText,
|
void AddEntry( const std::string& szText,
|
||||||
const D3DCOLOR clrColor = D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0x00));
|
const D3DCOLOR clrColor = D3DCOLOR_ARGB( 0xFF, 0xFF, 0xFF, 0x00 ) );
|
||||||
|
|
||||||
// Release any native resources associated with the instance
|
// Release any native resources associated with the instance
|
||||||
void ReleaseNativeResource();
|
void ReleaseNativeResource();
|
||||||
|
@ -87,10 +90,10 @@ public:
|
||||||
// Called during the render loop
|
// Called during the render loop
|
||||||
void OnRender();
|
void OnRender();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::list<SEntry> asEntries;
|
std::list<SEntry> asEntries;
|
||||||
ID3DXFont* piFont;
|
ID3DXFont* piFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AV_LOG_DISPLAY_H_INCLUDE
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -42,46 +42,49 @@ 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
|
|
||||||
* log window.
|
|
||||||
*/
|
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
class CMyLogStream : public Assimp::LogStream
|
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
/** @brief Implementation of the abstract method */
|
|
||||||
void write(const char* message);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
/** \brief Class to display log strings in a separate window
|
/** \brief Subclass of Assimp::LogStream used to add all log messages to the
|
||||||
*/
|
* log window.
|
||||||
//-------------------------------------------------------------------------------
|
*/
|
||||||
class CLogWindow
|
//-------------------------------------------------------------------------------
|
||||||
|
class CMyLogStream : public Assimp::LogStream
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
/** @brief Implementation of the abstract method */
|
||||||
|
void write( const char* message );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
/** \brief Class to display log strings in a separate window
|
||||||
|
*/
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
class CLogWindow
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
friend class CMyLogStream;
|
friend class CMyLogStream;
|
||||||
friend INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
|
friend INT_PTR CALLBACK LogDialogProc( HWND hwndDlg, UINT uMsg,
|
||||||
WPARAM wParam,LPARAM lParam);
|
WPARAM wParam, LPARAM lParam );
|
||||||
|
|
||||||
CLogWindow() : hwnd(NULL), bIsVisible(false), bUpdate(true) {}
|
CLogWindow() : hwnd( NULL ), bIsVisible( false ), bUpdate( true ) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CLogWindow s_cInstance;
|
static CLogWindow s_cInstance;
|
||||||
inline static CLogWindow& Instance ()
|
inline static CLogWindow& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializes the log window
|
// initializes the log window
|
||||||
void Init ();
|
void Init();
|
||||||
|
|
||||||
// Shows the log window
|
// Shows the log window
|
||||||
void Show();
|
void Show();
|
||||||
|
@ -93,10 +96,10 @@ public:
|
||||||
void Save();
|
void Save();
|
||||||
|
|
||||||
// write a line to the log window
|
// write a line to the log window
|
||||||
void WriteLine(const char* message);
|
void WriteLine( const char* message );
|
||||||
|
|
||||||
// Set the bUpdate member
|
// Set the bUpdate member
|
||||||
inline void SetAutoUpdate(bool b)
|
inline void SetAutoUpdate( bool b )
|
||||||
{
|
{
|
||||||
this->bUpdate = b;
|
this->bUpdate = b;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +107,7 @@ public:
|
||||||
// updates the log file
|
// updates the log file
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Window handle
|
// Window handle
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
@ -120,9 +123,11 @@ private:
|
||||||
bool bUpdate;
|
bool bUpdate;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// associated log stream
|
// associated log stream
|
||||||
CMyLogStream* pcStream;
|
CMyLogStream* pcStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AV_LOG_DISPLA
|
#endif // AV_LOG_DISPLA
|
|
@ -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,'*');
|
||||||
|
|
|
@ -39,36 +39,42 @@ 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>
|
||||||
/* Helper class to create, access and destroy materials
|
|
||||||
*/
|
#include "AssetHelper.h"
|
||||||
//-------------------------------------------------------------------------------
|
|
||||||
class CMaterialManager
|
namespace AssimpView
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
/* Helper class to create, access and destroy materials
|
||||||
|
*/
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
|
class CMaterialManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
friend class CDisplay;
|
friend class CDisplay;
|
||||||
|
|
||||||
// default constructor
|
// default constructor
|
||||||
CMaterialManager()
|
CMaterialManager()
|
||||||
: m_iShaderCount (0), sDefaultTexture() {}
|
: m_iShaderCount( 0 ), sDefaultTexture() {}
|
||||||
|
|
||||||
~CMaterialManager() {
|
~CMaterialManager() {
|
||||||
if (sDefaultTexture) {
|
if( sDefaultTexture ) {
|
||||||
sDefaultTexture->Release();
|
sDefaultTexture->Release();
|
||||||
}
|
}
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CMaterialManager s_cInstance;
|
static CMaterialManager s_cInstance;
|
||||||
inline static CMaterialManager& Instance ()
|
inline static CMaterialManager& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +83,7 @@ public:
|
||||||
// Delete all resources of a given material
|
// Delete all resources of a given material
|
||||||
//
|
//
|
||||||
// Must be called before CreateMaterial() to prevent memory leaking
|
// Must be called before CreateMaterial() to prevent memory leaking
|
||||||
void DeleteMaterial(AssetHelper::MeshHelper* pcIn);
|
void DeleteMaterial( AssetHelper::MeshHelper* pcIn );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Create the material for a mesh.
|
// Create the material for a mesh.
|
||||||
|
@ -85,8 +91,8 @@ public:
|
||||||
// The function checks whether an identical shader is already in use.
|
// The function checks whether an identical shader is already in use.
|
||||||
// A shader is considered to be identical if it has the same input
|
// A shader is considered to be identical if it has the same input
|
||||||
// signature and takes the same number of texture channels.
|
// signature and takes the same number of texture channels.
|
||||||
int CreateMaterial(AssetHelper::MeshHelper* pcMesh,
|
int CreateMaterial( AssetHelper::MeshHelper* pcMesh,
|
||||||
const aiMesh* pcSource);
|
const aiMesh* pcSource );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Setup the material for a given mesh
|
// Setup the material for a given mesh
|
||||||
|
@ -97,17 +103,17 @@ public:
|
||||||
// vPos Position of the camera
|
// vPos Position of the camera
|
||||||
// TODO: Extract camera position from matrix ...
|
// TODO: Extract camera position from matrix ...
|
||||||
//
|
//
|
||||||
int SetupMaterial (AssetHelper::MeshHelper* pcMesh,
|
int SetupMaterial( AssetHelper::MeshHelper* pcMesh,
|
||||||
const aiMatrix4x4& pcProj,
|
const aiMatrix4x4& pcProj,
|
||||||
const aiMatrix4x4& aiMe,
|
const aiMatrix4x4& aiMe,
|
||||||
const aiMatrix4x4& pcCam,
|
const aiMatrix4x4& pcCam,
|
||||||
const aiVector3D& vPos);
|
const aiVector3D& vPos );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// End the material for a given mesh
|
// End the material for a given mesh
|
||||||
// Called after mesh rendering is complete
|
// Called after mesh rendering is complete
|
||||||
// pcMesh Mesh object
|
// pcMesh Mesh object
|
||||||
int EndMaterial (AssetHelper::MeshHelper* pcMesh);
|
int EndMaterial( AssetHelper::MeshHelper* pcMesh );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Recreate all specular materials depending on the current
|
// Recreate all specular materials depending on the current
|
||||||
|
@ -123,13 +129,13 @@ public:
|
||||||
// Handle 8.3 syntax correctly, search the environment of the
|
// Handle 8.3 syntax correctly, search the environment of the
|
||||||
// executable and the asset for a texture with a name very similar
|
// executable and the asset for a texture with a name very similar
|
||||||
// to a given one
|
// to a given one
|
||||||
int FindValidPath(aiString* p_szString);
|
int FindValidPath( aiString* p_szString );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Load a texture into memory and create a native D3D texture resource
|
// Load a texture into memory and create a native D3D texture resource
|
||||||
//
|
//
|
||||||
// The function tries to find a valid path for a texture
|
// The function tries to find a valid path for a texture
|
||||||
int LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath);
|
int LoadTexture( IDirect3DTexture9** p_ppiOut, aiString* szPath );
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -146,13 +152,13 @@ public:
|
||||||
inline void Reset()
|
inline void Reset()
|
||||||
{
|
{
|
||||||
this->m_iShaderCount = 0;
|
this->m_iShaderCount = 0;
|
||||||
for (TextureCache::iterator it = sCachedTextures.begin(); it != sCachedTextures.end(); ++it) {
|
for( TextureCache::iterator it = sCachedTextures.begin(); it != sCachedTextures.end(); ++it ) {
|
||||||
(*it).second->Release();
|
( *it ).second->Release();
|
||||||
}
|
}
|
||||||
sCachedTextures.clear();
|
sCachedTextures.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// find a valid path to a texture file
|
// find a valid path to a texture file
|
||||||
|
@ -160,22 +166,22 @@ private:
|
||||||
// Handle 8.3 syntax correctly, search the environment of the
|
// Handle 8.3 syntax correctly, search the environment of the
|
||||||
// executable and the asset for a texture with a name very similar
|
// executable and the asset for a texture with a name very similar
|
||||||
// to a given one
|
// to a given one
|
||||||
bool TryLongerPath(char* szTemp,aiString* p_szString);
|
bool TryLongerPath( char* szTemp, aiString* p_szString );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Setup the default texture for a texture channel
|
// Setup the default texture for a texture channel
|
||||||
//
|
//
|
||||||
// Generates a default checker pattern for a texture
|
// Generates a default checker pattern for a texture
|
||||||
int SetDefaultTexture(IDirect3DTexture9** p_ppiOut);
|
int SetDefaultTexture( IDirect3DTexture9** p_ppiOut );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Convert a height map to a normal map if necessary
|
// Convert a height map to a normal map if necessary
|
||||||
//
|
//
|
||||||
// The function tries to detect the type of a texture automatically.
|
// The function tries to detect the type of a texture automatically.
|
||||||
// However, this wont work in every case.
|
// However, this wont work in every case.
|
||||||
void HMtoNMIfNecessary(IDirect3DTexture9* piTexture,
|
void HMtoNMIfNecessary( IDirect3DTexture9* piTexture,
|
||||||
IDirect3DTexture9** piTextureOut,
|
IDirect3DTexture9** piTextureOut,
|
||||||
bool bWasOriginallyHM = true);
|
bool bWasOriginallyHM = true );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Search for non-opaque pixels in a texture
|
// Search for non-opaque pixels in a texture
|
||||||
|
@ -183,9 +189,9 @@ private:
|
||||||
// A pixel is considered to be non-opaque if its alpha value is
|
// A pixel is considered to be non-opaque if its alpha value is
|
||||||
// less than 255
|
// less than 255
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
bool HasAlphaPixels(IDirect3DTexture9* piTexture);
|
bool HasAlphaPixels( IDirect3DTexture9* piTexture );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
//
|
//
|
||||||
// Specifies the number of different shaders generated for
|
// Specifies the number of different shaders generated for
|
||||||
|
@ -195,8 +201,8 @@ private:
|
||||||
unsigned int m_iShaderCount;
|
unsigned int m_iShaderCount;
|
||||||
IDirect3DTexture9* sDefaultTexture;
|
IDirect3DTexture9* sDefaultTexture;
|
||||||
|
|
||||||
typedef std::map<std::string,IDirect3DTexture9*> TextureCache;
|
typedef std::map<std::string, IDirect3DTexture9*> TextureCache;
|
||||||
TextureCache sCachedTextures;
|
TextureCache sCachedTextures;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!! include guard
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,15 +42,16 @@ 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 {
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
/* Helper class tp render meshes
|
/* Helper class tp render meshes
|
||||||
*/
|
*/
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
class CMeshRenderer
|
class CMeshRenderer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// default constructor
|
// default constructor
|
||||||
CMeshRenderer()
|
CMeshRenderer()
|
||||||
|
@ -59,12 +60,12 @@ private:
|
||||||
// no other members to initialize
|
// no other members to initialize
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Singleton accessors
|
// Singleton accessors
|
||||||
static CMeshRenderer s_cInstance;
|
static CMeshRenderer s_cInstance;
|
||||||
inline static CMeshRenderer& Instance ()
|
inline static CMeshRenderer& Instance()
|
||||||
{
|
{
|
||||||
return s_cInstance;
|
return s_cInstance;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,7 @@ public:
|
||||||
// iIndex Index of the mesh to be drawn
|
// iIndex Index of the mesh to be drawn
|
||||||
//
|
//
|
||||||
// The function draws all faces in order, regardless of their distance
|
// The function draws all faces in order, regardless of their distance
|
||||||
int DrawUnsorted(unsigned int iIndex);
|
int DrawUnsorted( unsigned int iIndex );
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Draw a mesh in the global mesh list using the current pipeline state
|
// Draw a mesh in the global mesh list using the current pipeline state
|
||||||
|
@ -84,14 +85,15 @@ public:
|
||||||
// The method sorts all vertices by their distance (back to front)
|
// The method sorts all vertices by their distance (back to front)
|
||||||
//
|
//
|
||||||
// mWorld World matrix for the node
|
// mWorld World matrix for the node
|
||||||
int DrawSorted(unsigned int iIndex,
|
int DrawSorted( unsigned int iIndex,
|
||||||
const aiMatrix4x4& mWorld);
|
const aiMatrix4x4& mWorld );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif //!! include guard
|
#endif //!! include guard
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -105,30 +106,30 @@ namespace AssimpView
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
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);
|
||||||
int CreateDevice (void);
|
int CreateDevice (void);
|
||||||
int ShutdownDevice(void);
|
int ShutdownDevice(void);
|
||||||
int GetProjectionMatrix (aiMatrix4x4& p_mOut);
|
int GetProjectionMatrix (aiMatrix4x4& p_mOut);
|
||||||
int LoadAsset(void);
|
int LoadAsset(void);
|
||||||
int CreateAssetData(void);
|
int CreateAssetData(void);
|
||||||
int DeleteAssetData(bool bNoMaterials = false);
|
int DeleteAssetData(bool bNoMaterials = false);
|
||||||
int ScaleAsset(void);
|
int ScaleAsset(void);
|
||||||
int DeleteAsset(void);
|
int DeleteAsset(void);
|
||||||
int SetupFPSView();
|
int SetupFPSView();
|
||||||
|
|
||||||
aiVector3D GetCameraMatrix (aiMatrix4x4& p_mOut);
|
aiVector3D GetCameraMatrix (aiMatrix4x4& p_mOut);
|
||||||
int CreateMaterial(AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource);
|
int CreateMaterial(AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource);
|
||||||
|
|
||||||
void HandleMouseInputFPS( void );
|
void HandleMouseInputFPS( void );
|
||||||
void HandleMouseInputLightRotate( void );
|
void HandleMouseInputLightRotate( void );
|
||||||
void HandleMouseInputLocal( void );
|
void HandleMouseInputLocal( void );
|
||||||
void HandleKeyboardInputFPS( void );
|
void HandleKeyboardInputFPS( void );
|
||||||
void HandleMouseInputLightIntensityAndColor( void );
|
void HandleMouseInputLightIntensityAndColor( void );
|
||||||
void HandleMouseInputSkyBox( void );
|
void HandleMouseInputSkyBox( void );
|
||||||
void HandleKeyboardInputTextureView( void );
|
void HandleKeyboardInputTextureView( void );
|
||||||
void HandleMouseInputTextureView( void );
|
void HandleMouseInputTextureView( void );
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue