Merge branch 'master' into sample-simpletextureddirectx11-nullptr
commit
872001c1c9
|
@ -238,11 +238,6 @@ SET(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_M
|
||||||
SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
|
SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
|
||||||
SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
|
||||||
|
|
||||||
IF( UNIX )
|
|
||||||
# Use GNUInstallDirs for Unix predefined directories
|
|
||||||
INCLUDE(GNUInstallDirs)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Grouped compiler settings
|
# Grouped compiler settings
|
||||||
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT CMAKE_COMPILER_IS_MINGW)
|
||||||
IF(NOT ASSIMP_HUNTER_ENABLED)
|
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||||
|
@ -350,14 +345,6 @@ ELSE()
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
# Cache these to allow the user to override them manually.
|
|
||||||
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
|
|
||||||
"Path the built library files are installed to." )
|
|
||||||
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
|
|
||||||
"Path the header files are installed to." )
|
|
||||||
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
|
|
||||||
"Path the tool executables are installed to." )
|
|
||||||
|
|
||||||
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
|
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
|
||||||
IF (ASSIMP_INJECT_DEBUG_POSTFIX AND (is_multi_config OR CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
IF (ASSIMP_INJECT_DEBUG_POSTFIX AND (is_multi_config OR CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||||
|
@ -417,6 +404,28 @@ ELSE()
|
||||||
else()
|
else()
|
||||||
set(BUILD_LIB_TYPE STATIC)
|
set(BUILD_LIB_TYPE STATIC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
IF( UNIX )
|
||||||
|
# Use GNUInstallDirs for Unix predefined directories
|
||||||
|
INCLUDE(GNUInstallDirs)
|
||||||
|
|
||||||
|
SET( ASSIMP_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
SET( ASSIMP_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
SET( ASSIMP_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
|
||||||
|
ELSE()
|
||||||
|
# Cache these to allow the user to override them on non-Unix platforms
|
||||||
|
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
|
||||||
|
"Path the built library files are installed to." )
|
||||||
|
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
|
||||||
|
"Path the header files are installed to." )
|
||||||
|
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
|
||||||
|
"Path the tool executables are installed to." )
|
||||||
|
|
||||||
|
SET(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_INCLUDE_INSTALL_DIR})
|
||||||
|
SET(CMAKE_INSTALL_FULL_LIBDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR})
|
||||||
|
SET(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_BIN_INSTALL_DIR})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE)
|
||||||
IF (is_multi_config)
|
IF (is_multi_config)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
prefix=@CMAKE_INSTALL_PREFIX@
|
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||||
exec_prefix=@CMAKE_INSTALL_PREFIX@/
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@
|
|
||||||
includedir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_INCLUDE_INSTALL_DIR@
|
|
||||||
|
|
||||||
Name: @CMAKE_PROJECT_NAME@
|
Name: @CMAKE_PROJECT_NAME@
|
||||||
Description: Import various well-known 3D model formats in an uniform manner.
|
Description: Import various well-known 3D model formats in an uniform manner.
|
||||||
|
|
|
@ -44,22 +44,22 @@ if(MSVC)
|
||||||
# Import target "assimp::assimp" for configuration "Debug"
|
# Import target "assimp::assimp" for configuration "Debug"
|
||||||
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/${importLibraryName}"
|
IMPORTED_IMPLIB_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}"
|
||||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
|
IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}")
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" )
|
||||||
else()
|
else()
|
||||||
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
||||||
|
|
||||||
# Import target "assimp::assimp" for configuration "Debug"
|
# Import target "assimp::assimp" for configuration "Debug"
|
||||||
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
|
IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}")
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -75,17 +75,17 @@ else()
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_SONAME_DEBUG "${sharedLibraryName}"
|
IMPORTED_SONAME_DEBUG "${sharedLibraryName}"
|
||||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
|
IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" )
|
||||||
else()
|
else()
|
||||||
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
|
IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ if(MSVC)
|
||||||
# Import target "assimp::assimp" for configuration "Release"
|
# Import target "assimp::assimp" for configuration "Release"
|
||||||
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${importLibraryName}"
|
IMPORTED_IMPLIB_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}"
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/${sharedLibraryName}"
|
IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${importLibraryName}")
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}")
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/bin/${sharedLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" )
|
||||||
else()
|
else()
|
||||||
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ if(MSVC)
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
|
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}")
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -75,18 +75,17 @@ else()
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_SONAME_RELEASE "${sharedLibraryName}"
|
IMPORTED_SONAME_RELEASE "${sharedLibraryName}"
|
||||||
|
IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}"
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${sharedLibraryName}"
|
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${sharedLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" )
|
||||||
else()
|
else()
|
||||||
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@")
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${staticLibraryName}"
|
IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}"
|
||||||
)
|
)
|
||||||
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp )
|
||||||
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "${_IMPORT_PREFIX}/lib/${staticLibraryName}" )
|
list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -43,23 +43,13 @@ unset(_targetsDefined)
|
||||||
unset(_targetsNotDefined)
|
unset(_targetsNotDefined)
|
||||||
unset(_expectedTargets)
|
unset(_expectedTargets)
|
||||||
|
|
||||||
|
|
||||||
# Compute the installation prefix relative to this file.
|
|
||||||
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
||||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
||||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
||||||
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
||||||
if(_IMPORT_PREFIX STREQUAL "/")
|
|
||||||
set(_IMPORT_PREFIX "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Create imported target assimp::assimp
|
# Create imported target assimp::assimp
|
||||||
add_library(assimp::assimp @BUILD_LIB_TYPE@ IMPORTED)
|
add_library(assimp::assimp @BUILD_LIB_TYPE@ IMPORTED)
|
||||||
|
|
||||||
set_target_properties(assimp::assimp PROPERTIES
|
set_target_properties(assimp::assimp PROPERTIES
|
||||||
COMPATIBLE_INTERFACE_STRING "assimp_MAJOR_VERSION"
|
COMPATIBLE_INTERFACE_STRING "assimp_MAJOR_VERSION"
|
||||||
INTERFACE_assimp_MAJOR_VERSION "1"
|
INTERFACE_assimp_MAJOR_VERSION "1"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include"
|
INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_FULL_INCLUDEDIR@"
|
||||||
#INTERFACE_LINK_LIBRARIES "TxtUtils::TxtUtils;MealyMachine::MealyMachine"
|
#INTERFACE_LINK_LIBRARIES "TxtUtils::TxtUtils;MealyMachine::MealyMachine"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -74,9 +64,6 @@ foreach(f ${CONFIG_FILES})
|
||||||
include(${f})
|
include(${f})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Cleanup temporary variables.
|
|
||||||
set(_IMPORT_PREFIX)
|
|
||||||
|
|
||||||
# Loop over all imported files and verify that they actually exist
|
# Loop over all imported files and verify that they actually exist
|
||||||
foreach(target ${_IMPORT_CHECK_TARGETS} )
|
foreach(target ${_IMPORT_CHECK_TARGETS} )
|
||||||
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
|
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
|
||||||
|
|
|
@ -44,15 +44,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @brief Implementation of the Plain-C API
|
* @brief Implementation of the Plain-C API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
#include <assimp/Exceptional.h>
|
||||||
|
#include <assimp/GenericProperty.h>
|
||||||
#include <assimp/cimport.h>
|
#include <assimp/cimport.h>
|
||||||
#include <assimp/LogStream.hpp>
|
|
||||||
#include <assimp/DefaultLogger.hpp>
|
|
||||||
#include <assimp/Importer.hpp>
|
|
||||||
#include <assimp/importerdesc.h>
|
#include <assimp/importerdesc.h>
|
||||||
#include <assimp/scene.h>
|
#include <assimp/scene.h>
|
||||||
#include <assimp/GenericProperty.h>
|
#include <assimp/DefaultLogger.hpp>
|
||||||
#include <assimp/Exceptional.h>
|
#include <assimp/Importer.hpp>
|
||||||
#include <assimp/BaseImporter.h>
|
#include <assimp/LogStream.hpp>
|
||||||
|
|
||||||
#include "CApi/CInterfaceIOWrapper.h"
|
#include "CApi/CInterfaceIOWrapper.h"
|
||||||
#include "Importer.h"
|
#include "Importer.h"
|
||||||
|
@ -62,8 +62,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
# include <thread>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
#endif
|
#endif
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
@ -100,8 +100,7 @@ namespace Assimp {
|
||||||
|
|
||||||
/** will delete all registered importers. */
|
/** will delete all registered importers. */
|
||||||
void DeleteImporterInstanceList(std::vector<BaseImporter *> &out);
|
void DeleteImporterInstanceList(std::vector<BaseImporter *> &out);
|
||||||
} // namespace assimp
|
} // namespace Assimp
|
||||||
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
/** Global mutex to manage the access to the log-stream map */
|
/** Global mutex to manage the access to the log-stream map */
|
||||||
|
@ -112,8 +111,8 @@ static std::mutex gLogStreamMutex;
|
||||||
// Custom LogStream implementation for the C-API
|
// Custom LogStream implementation for the C-API
|
||||||
class LogToCallbackRedirector : public LogStream {
|
class LogToCallbackRedirector : public LogStream {
|
||||||
public:
|
public:
|
||||||
explicit LogToCallbackRedirector(const aiLogStream& s)
|
explicit LogToCallbackRedirector(const aiLogStream &s) :
|
||||||
: stream (s) {
|
stream(s) {
|
||||||
ai_assert(NULL != s.callback);
|
ai_assert(NULL != s.callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,8 +211,7 @@ const aiScene* aiImportFileFromMemory(
|
||||||
const char *pBuffer,
|
const char *pBuffer,
|
||||||
unsigned int pLength,
|
unsigned int pLength,
|
||||||
unsigned int pFlags,
|
unsigned int pFlags,
|
||||||
const char* pHint)
|
const char *pHint) {
|
||||||
{
|
|
||||||
return aiImportFileFromMemoryWithProperties(pBuffer, pLength, pFlags, pHint, NULL);
|
return aiImportFileFromMemoryWithProperties(pBuffer, pLength, pFlags, pHint, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,8 +221,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
unsigned int pLength,
|
unsigned int pLength,
|
||||||
unsigned int pFlags,
|
unsigned int pFlags,
|
||||||
const char *pHint,
|
const char *pHint,
|
||||||
const aiPropertyStore* props)
|
const aiPropertyStore *props) {
|
||||||
{
|
|
||||||
ai_assert(NULL != pBuffer);
|
ai_assert(NULL != pBuffer);
|
||||||
ai_assert(0 != pLength);
|
ai_assert(0 != pLength);
|
||||||
|
|
||||||
|
@ -251,8 +248,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
if (scene) {
|
if (scene) {
|
||||||
ScenePrivateData *priv = const_cast<ScenePrivateData *>(ScenePriv(scene));
|
ScenePrivateData *priv = const_cast<ScenePrivateData *>(ScenePriv(scene));
|
||||||
priv->mOrigImporter = imp;
|
priv->mOrigImporter = imp;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// if failed, extract error code and destroy the import
|
// if failed, extract error code and destroy the import
|
||||||
gLastErrorString = imp->GetErrorString();
|
gLastErrorString = imp->GetErrorString();
|
||||||
delete imp;
|
delete imp;
|
||||||
|
@ -264,8 +260,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Releases all resources associated with the given import process.
|
// Releases all resources associated with the given import process.
|
||||||
void aiReleaseImport( const aiScene* pScene)
|
void aiReleaseImport(const aiScene *pScene) {
|
||||||
{
|
|
||||||
if (!pScene) {
|
if (!pScene) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -276,8 +271,7 @@ void aiReleaseImport( const aiScene* pScene)
|
||||||
const ScenePrivateData *priv = ScenePriv(pScene);
|
const ScenePrivateData *priv = ScenePriv(pScene);
|
||||||
if (!priv || !priv->mOrigImporter) {
|
if (!priv || !priv->mOrigImporter) {
|
||||||
delete pScene;
|
delete pScene;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// deleting the Importer also deletes the scene
|
// deleting the Importer also deletes the scene
|
||||||
// Note: the reason that this is not written as 'delete priv->mOrigImporter'
|
// Note: the reason that this is not written as 'delete priv->mOrigImporter'
|
||||||
// is a suspected bug in gcc 4.4+ (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339)
|
// is a suspected bug in gcc 4.4+ (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52339)
|
||||||
|
@ -290,11 +284,9 @@ void aiReleaseImport( const aiScene* pScene)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API const aiScene *aiApplyPostProcessing(const aiScene *pScene,
|
ASSIMP_API const aiScene *aiApplyPostProcessing(const aiScene *pScene,
|
||||||
unsigned int pFlags)
|
unsigned int pFlags) {
|
||||||
{
|
|
||||||
const aiScene *sc = NULL;
|
const aiScene *sc = NULL;
|
||||||
|
|
||||||
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// find the importer associated with this data
|
// find the importer associated with this data
|
||||||
|
@ -343,8 +335,7 @@ ASSIMP_API const aiScene *aiApplyCustomizedPostProcessing( const aiScene *scene,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CallbackToLogRedirector (const char* msg, char* dt)
|
void CallbackToLogRedirector(const char *msg, char *dt) {
|
||||||
{
|
|
||||||
ai_assert(NULL != msg);
|
ai_assert(NULL != msg);
|
||||||
ai_assert(NULL != dt);
|
ai_assert(NULL != dt);
|
||||||
LogStream *s = (LogStream *)dt;
|
LogStream *s = (LogStream *)dt;
|
||||||
|
@ -353,8 +344,7 @@ void CallbackToLogRedirector (const char* msg, char* dt)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const char* file)
|
ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream, const char *file) {
|
||||||
{
|
|
||||||
aiLogStream sout;
|
aiLogStream sout;
|
||||||
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
@ -362,8 +352,7 @@ ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
sout.callback = NULL;
|
sout.callback = NULL;
|
||||||
sout.user = NULL;
|
sout.user = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sout.callback = &CallbackToLogRedirector;
|
sout.callback = &CallbackToLogRedirector;
|
||||||
sout.user = (char *)stream;
|
sout.user = (char *)stream;
|
||||||
}
|
}
|
||||||
|
@ -373,8 +362,7 @@ ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
|
ASSIMP_API void aiAttachLogStream(const aiLogStream *stream) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
|
@ -392,8 +380,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
|
ASSIMP_API aiReturn aiDetachLogStream(const aiLogStream *stream) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
|
@ -418,8 +405,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiDetachAllLogStreams(void)
|
ASSIMP_API void aiDetachAllLogStreams(void) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
#ifndef ASSIMP_BUILD_SINGLETHREADED
|
||||||
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
std::lock_guard<std::mutex> lock(gLogStreamMutex);
|
||||||
|
@ -440,8 +426,7 @@ ASSIMP_API void aiDetachAllLogStreams(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiEnableVerboseLogging(aiBool d)
|
ASSIMP_API void aiEnableVerboseLogging(aiBool d) {
|
||||||
{
|
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
|
DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
|
||||||
}
|
}
|
||||||
|
@ -450,29 +435,25 @@ ASSIMP_API void aiEnableVerboseLogging(aiBool d)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns the error text of the last failed import process.
|
// Returns the error text of the last failed import process.
|
||||||
const char* aiGetErrorString()
|
const char *aiGetErrorString() {
|
||||||
{
|
|
||||||
return gLastErrorString.c_str();
|
return gLastErrorString.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
// Return the description of a importer given its index
|
// Return the description of a importer given its index
|
||||||
const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex)
|
const aiImporterDesc *aiGetImportFormatDescription(size_t pIndex) {
|
||||||
{
|
|
||||||
return Importer().GetImporterInfo(pIndex);
|
return Importer().GetImporterInfo(pIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------
|
||||||
// Return the number of importers
|
// Return the number of importers
|
||||||
size_t aiGetImportFormatCount(void)
|
size_t aiGetImportFormatCount(void) {
|
||||||
{
|
|
||||||
return Importer().GetImporterCount();
|
return Importer().GetImporterCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns the error text of the last failed import process.
|
// Returns the error text of the last failed import process.
|
||||||
aiBool aiIsExtensionSupported(const char* szExtension)
|
aiBool aiIsExtensionSupported(const char *szExtension) {
|
||||||
{
|
|
||||||
ai_assert(NULL != szExtension);
|
ai_assert(NULL != szExtension);
|
||||||
aiBool candoit = AI_FALSE;
|
aiBool candoit = AI_FALSE;
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
@ -487,8 +468,7 @@ aiBool aiIsExtensionSupported(const char* szExtension)
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Get a list of all file extensions supported by ASSIMP
|
// Get a list of all file extensions supported by ASSIMP
|
||||||
void aiGetExtensionList(aiString* szOut)
|
void aiGetExtensionList(aiString *szOut) {
|
||||||
{
|
|
||||||
ai_assert(NULL != szOut);
|
ai_assert(NULL != szOut);
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
|
@ -502,8 +482,7 @@ void aiGetExtensionList(aiString* szOut)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Get the memory requirements for a particular import.
|
// Get the memory requirements for a particular import.
|
||||||
void aiGetMemoryRequirements(const C_STRUCT aiScene *pIn,
|
void aiGetMemoryRequirements(const C_STRUCT aiScene *pIn,
|
||||||
C_STRUCT aiMemoryInfo* in)
|
C_STRUCT aiMemoryInfo *in) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
|
|
||||||
// find the importer associated with this data
|
// find the importer associated with this data
|
||||||
|
@ -518,21 +497,18 @@ void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API aiPropertyStore* aiCreatePropertyStore(void)
|
ASSIMP_API aiPropertyStore *aiCreatePropertyStore(void) {
|
||||||
{
|
|
||||||
return reinterpret_cast<aiPropertyStore *>(new PropertyMap());
|
return reinterpret_cast<aiPropertyStore *>(new PropertyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore* p)
|
ASSIMP_API void aiReleasePropertyStore(aiPropertyStore *p) {
|
||||||
{
|
|
||||||
delete reinterpret_cast<PropertyMap *>(p);
|
delete reinterpret_cast<PropertyMap *>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyInteger
|
// Importer::SetPropertyInteger
|
||||||
ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szName, int value)
|
ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore *p, const char *szName, int value) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
||||||
SetGenericProperty<int>(pp->ints, szName, value);
|
SetGenericProperty<int>(pp->ints, szName, value);
|
||||||
|
@ -541,8 +517,7 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyFloat
|
// Importer::SetPropertyFloat
|
||||||
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value)
|
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore *p, const char *szName, ai_real value) {
|
||||||
{
|
|
||||||
ASSIMP_BEGIN_EXCEPTION_REGION();
|
ASSIMP_BEGIN_EXCEPTION_REGION();
|
||||||
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
PropertyMap *pp = reinterpret_cast<PropertyMap *>(p);
|
||||||
SetGenericProperty<ai_real>(pp->floats, szName, value);
|
SetGenericProperty<ai_real>(pp->floats, szName, value);
|
||||||
|
@ -552,8 +527,7 @@ ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName,
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyString
|
// Importer::SetPropertyString
|
||||||
ASSIMP_API void aiSetImportPropertyString(aiPropertyStore *p, const char *szName,
|
ASSIMP_API void aiSetImportPropertyString(aiPropertyStore *p, const char *szName,
|
||||||
const C_STRUCT aiString* st)
|
const C_STRUCT aiString *st) {
|
||||||
{
|
|
||||||
if (!st) {
|
if (!st) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -566,8 +540,7 @@ ASSIMP_API void aiSetImportPropertyString(aiPropertyStore* p, const char* szName
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Importer::SetPropertyMatrix
|
// Importer::SetPropertyMatrix
|
||||||
ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore *p, const char *szName,
|
ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore *p, const char *szName,
|
||||||
const C_STRUCT aiMatrix4x4* mat)
|
const C_STRUCT aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
if (!mat) {
|
if (!mat) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -579,8 +552,7 @@ ASSIMP_API void aiSetImportPropertyMatrix(aiPropertyStore* p, const char* szName
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Rotation matrix to quaternion
|
// Rotation matrix to quaternion
|
||||||
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
|
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion *quat, const aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != quat);
|
ai_assert(NULL != quat);
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*quat = aiQuaternion(*mat);
|
*quat = aiQuaternion(*mat);
|
||||||
|
@ -590,8 +562,7 @@ ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x
|
||||||
// Matrix decomposition
|
// Matrix decomposition
|
||||||
ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4 *mat, aiVector3D *scaling,
|
ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4 *mat, aiVector3D *scaling,
|
||||||
aiQuaternion *rotation,
|
aiQuaternion *rotation,
|
||||||
aiVector3D* position)
|
aiVector3D *position) {
|
||||||
{
|
|
||||||
ai_assert(NULL != rotation);
|
ai_assert(NULL != rotation);
|
||||||
ai_assert(NULL != position);
|
ai_assert(NULL != position);
|
||||||
ai_assert(NULL != scaling);
|
ai_assert(NULL != scaling);
|
||||||
|
@ -601,15 +572,13 @@ ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Matrix transpose
|
// Matrix transpose
|
||||||
ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3* mat)
|
ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
mat->Transpose();
|
mat->Transpose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
|
ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
mat->Transpose();
|
mat->Transpose();
|
||||||
}
|
}
|
||||||
|
@ -617,8 +586,7 @@ ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Vector transformation
|
// Vector transformation
|
||||||
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D *vec,
|
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D *vec,
|
||||||
const aiMatrix3x3* mat)
|
const aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
ai_assert(NULL != vec);
|
ai_assert(NULL != vec);
|
||||||
*vec *= (*mat);
|
*vec *= (*mat);
|
||||||
|
@ -626,8 +594,7 @@ ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D *vec,
|
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D *vec,
|
||||||
const aiMatrix4x4* mat)
|
const aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
ai_assert(NULL != vec);
|
ai_assert(NULL != vec);
|
||||||
|
|
||||||
|
@ -638,8 +605,7 @@ ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
|
||||||
// Matrix multiplication
|
// Matrix multiplication
|
||||||
ASSIMP_API void aiMultiplyMatrix4(
|
ASSIMP_API void aiMultiplyMatrix4(
|
||||||
aiMatrix4x4 *dst,
|
aiMatrix4x4 *dst,
|
||||||
const aiMatrix4x4* src)
|
const aiMatrix4x4 *src) {
|
||||||
{
|
|
||||||
ai_assert(NULL != dst);
|
ai_assert(NULL != dst);
|
||||||
ai_assert(NULL != src);
|
ai_assert(NULL != src);
|
||||||
*dst = (*dst) * (*src);
|
*dst = (*dst) * (*src);
|
||||||
|
@ -648,8 +614,7 @@ ASSIMP_API void aiMultiplyMatrix4(
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiMultiplyMatrix3(
|
ASSIMP_API void aiMultiplyMatrix3(
|
||||||
aiMatrix3x3 *dst,
|
aiMatrix3x3 *dst,
|
||||||
const aiMatrix3x3* src)
|
const aiMatrix3x3 *src) {
|
||||||
{
|
|
||||||
ai_assert(NULL != dst);
|
ai_assert(NULL != dst);
|
||||||
ai_assert(NULL != src);
|
ai_assert(NULL != src);
|
||||||
*dst = (*dst) * (*src);
|
*dst = (*dst) * (*src);
|
||||||
|
@ -658,16 +623,14 @@ ASSIMP_API void aiMultiplyMatrix3(
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Matrix identity
|
// Matrix identity
|
||||||
ASSIMP_API void aiIdentityMatrix3(
|
ASSIMP_API void aiIdentityMatrix3(
|
||||||
aiMatrix3x3* mat)
|
aiMatrix3x3 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*mat = aiMatrix3x3();
|
*mat = aiMatrix3x3();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
ASSIMP_API void aiIdentityMatrix4(
|
ASSIMP_API void aiIdentityMatrix4(
|
||||||
aiMatrix4x4* mat)
|
aiMatrix4x4 *mat) {
|
||||||
{
|
|
||||||
ai_assert(NULL != mat);
|
ai_assert(NULL != mat);
|
||||||
*mat = aiMatrix4x4();
|
*mat = aiMatrix4x4();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -50,27 +49,25 @@ namespace Assimp {
|
||||||
namespace FBX {
|
namespace FBX {
|
||||||
|
|
||||||
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
|
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
|
||||||
struct ImportSettings
|
struct ImportSettings {
|
||||||
{
|
ImportSettings() :
|
||||||
ImportSettings()
|
strictMode(true),
|
||||||
: strictMode(true)
|
readAllLayers(true),
|
||||||
, readAllLayers(true)
|
readAllMaterials(false),
|
||||||
, readAllMaterials(false)
|
readMaterials(true),
|
||||||
, readMaterials(true)
|
readTextures(true),
|
||||||
, readTextures(true)
|
readCameras(true),
|
||||||
, readCameras(true)
|
readLights(true),
|
||||||
, readLights(true)
|
readAnimations(true),
|
||||||
, readAnimations(true)
|
readWeights(true),
|
||||||
, readWeights(true)
|
preservePivots(true),
|
||||||
, preservePivots(true)
|
optimizeEmptyAnimationCurves(true),
|
||||||
, optimizeEmptyAnimationCurves(true)
|
useLegacyEmbeddedTextureNaming(false),
|
||||||
, useLegacyEmbeddedTextureNaming(false)
|
removeEmptyBones(true),
|
||||||
, removeEmptyBones( true )
|
convertToMeters(false) {
|
||||||
, convertToMeters( false ) {
|
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** enable strict mode:
|
/** enable strict mode:
|
||||||
* - only accept fbx 2012, 2013 files
|
* - only accept fbx 2012, 2013 files
|
||||||
* - on the slightest error, give up.
|
* - on the slightest error, give up.
|
||||||
|
@ -94,7 +91,6 @@ struct ImportSettings
|
||||||
* This bit is ignored unless readMaterials=true*/
|
* This bit is ignored unless readMaterials=true*/
|
||||||
bool readAllMaterials;
|
bool readAllMaterials;
|
||||||
|
|
||||||
|
|
||||||
/** import materials (true) or skip them and assign a default
|
/** import materials (true) or skip them and assign a default
|
||||||
* material. The default value is true.*/
|
* material. The default value is true.*/
|
||||||
bool readMaterials;
|
bool readMaterials;
|
||||||
|
@ -156,9 +152,7 @@ struct ImportSettings
|
||||||
bool convertToMeters;
|
bool convertToMeters;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace FBX
|
||||||
} // !FBX
|
} // namespace Assimp
|
||||||
} // !Assimp
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -55,18 +54,20 @@ namespace Assimp {
|
||||||
|
|
||||||
// TinyFormatter.h
|
// TinyFormatter.h
|
||||||
namespace Formatter {
|
namespace Formatter {
|
||||||
template <typename T,typename TR, typename A> class basic_formatter;
|
|
||||||
|
template <typename T, typename TR, typename A>
|
||||||
|
class basic_formatter;
|
||||||
|
|
||||||
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
typedef class basic_formatter<char, std::char_traits<char>, std::allocator<char>> format;
|
||||||
}
|
|
||||||
|
} // namespace Formatter
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
/** Load the Autodesk FBX file format.
|
/// Loads the Autodesk FBX file format.
|
||||||
|
///
|
||||||
See http://en.wikipedia.org/wiki/FBX
|
/// See http://en.wikipedia.org/wiki/FBX
|
||||||
*/
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter>
|
class FBXImporter : public BaseImporter, public LogFunctions<FBXImporter> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
FBXImporter();
|
FBXImporter();
|
||||||
virtual ~FBXImporter();
|
virtual ~FBXImporter();
|
||||||
|
@ -74,11 +75,9 @@ public:
|
||||||
// --------------------
|
// --------------------
|
||||||
bool CanRead(const std::string &pFile,
|
bool CanRead(const std::string &pFile,
|
||||||
IOSystem *pIOHandler,
|
IOSystem *pIOHandler,
|
||||||
bool checkSig
|
bool checkSig) const;
|
||||||
) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
const aiImporterDesc *GetInfo() const;
|
const aiImporterDesc *GetInfo() const;
|
||||||
|
|
||||||
|
@ -88,8 +87,7 @@ protected:
|
||||||
// --------------------
|
// --------------------
|
||||||
void InternReadFile(const std::string &pFile,
|
void InternReadFile(const std::string &pFile,
|
||||||
aiScene *pScene,
|
aiScene *pScene,
|
||||||
IOSystem* pIOHandler
|
IOSystem *pIOHandler);
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FBX::ImportSettings settings;
|
FBX::ImportSettings settings;
|
||||||
|
@ -97,4 +95,3 @@ private:
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
#endif // !INCLUDED_AI_FBX_IMPORTER_H
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2020, assimp team
|
Copyright (c) 2006-2020, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -100,13 +98,27 @@ struct aiMetadataEntry {
|
||||||
*/
|
*/
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline aiMetadataType GetAiType( bool ) { return AI_BOOL; }
|
inline aiMetadataType GetAiType(bool) {
|
||||||
inline aiMetadataType GetAiType( int32_t ) { return AI_INT32; }
|
return AI_BOOL;
|
||||||
inline aiMetadataType GetAiType( uint64_t ) { return AI_UINT64; }
|
}
|
||||||
inline aiMetadataType GetAiType( float ) { return AI_FLOAT; }
|
inline aiMetadataType GetAiType(int32_t) {
|
||||||
inline aiMetadataType GetAiType( double ) { return AI_DOUBLE; }
|
return AI_INT32;
|
||||||
inline aiMetadataType GetAiType( const aiString & ) { return AI_AISTRING; }
|
}
|
||||||
inline aiMetadataType GetAiType( const aiVector3D & ) { return AI_AIVECTOR3D; }
|
inline aiMetadataType GetAiType(uint64_t) {
|
||||||
|
return AI_UINT64;
|
||||||
|
}
|
||||||
|
inline aiMetadataType GetAiType(float) {
|
||||||
|
return AI_FLOAT;
|
||||||
|
}
|
||||||
|
inline aiMetadataType GetAiType(double) {
|
||||||
|
return AI_DOUBLE;
|
||||||
|
}
|
||||||
|
inline aiMetadataType GetAiType(const aiString &) {
|
||||||
|
return AI_AISTRING;
|
||||||
|
}
|
||||||
|
inline aiMetadataType GetAiType(const aiVector3D &) {
|
||||||
|
return AI_AIVECTOR3D;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
@ -134,16 +146,14 @@ struct aiMetadata {
|
||||||
* @brief The default constructor, set all members to zero by default.
|
* @brief The default constructor, set all members to zero by default.
|
||||||
*/
|
*/
|
||||||
aiMetadata() AI_NO_EXCEPT
|
aiMetadata() AI_NO_EXCEPT
|
||||||
: mNumProperties(0)
|
: mNumProperties(0),
|
||||||
, mKeys(nullptr)
|
mKeys(nullptr),
|
||||||
, mValues(nullptr) {
|
mValues(nullptr) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
aiMetadata( const aiMetadata &rhs )
|
aiMetadata(const aiMetadata &rhs) :
|
||||||
: mNumProperties( rhs.mNumProperties )
|
mNumProperties(rhs.mNumProperties), mKeys(nullptr), mValues(nullptr) {
|
||||||
, mKeys( nullptr )
|
|
||||||
, mValues( nullptr ) {
|
|
||||||
mKeys = new aiString[mNumProperties];
|
mKeys = new aiString[mNumProperties];
|
||||||
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
for (size_t i = 0; i < static_cast<size_t>(mNumProperties); ++i) {
|
||||||
mKeys[i] = rhs.mKeys[i];
|
mKeys[i] = rhs.mKeys[i];
|
||||||
|
@ -160,45 +170,38 @@ struct aiMetadata {
|
||||||
int32_t v;
|
int32_t v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(int32_t));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(int32_t));
|
||||||
mValues[i].mData = new int32_t(v);
|
mValues[i].mData = new int32_t(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_UINT64: {
|
case AI_UINT64: {
|
||||||
uint64_t v;
|
uint64_t v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint64_t));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(uint64_t));
|
||||||
mValues[i].mData = new uint64_t(v);
|
mValues[i].mData = new uint64_t(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_FLOAT: {
|
case AI_FLOAT: {
|
||||||
float v;
|
float v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(float));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(float));
|
||||||
mValues[i].mData = new float(v);
|
mValues[i].mData = new float(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_DOUBLE: {
|
case AI_DOUBLE: {
|
||||||
double v;
|
double v;
|
||||||
::memcpy(&v, rhs.mValues[i].mData, sizeof(double));
|
::memcpy(&v, rhs.mValues[i].mData, sizeof(double));
|
||||||
mValues[i].mData = new double(v);
|
mValues[i].mData = new double(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_AISTRING: {
|
case AI_AISTRING: {
|
||||||
aiString v;
|
aiString v;
|
||||||
rhs.Get<aiString>(mKeys[i], v);
|
rhs.Get<aiString>(mKeys[i], v);
|
||||||
mValues[i].mData = new aiString(v);
|
mValues[i].mData = new aiString(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case AI_AIVECTOR3D: {
|
case AI_AIVECTOR3D: {
|
||||||
aiVector3D v;
|
aiVector3D v;
|
||||||
rhs.Get<aiVector3D>(mKeys[i], v);
|
rhs.Get<aiVector3D>(mKeys[i], v);
|
||||||
mValues[i].mData = new aiVector3D(v);
|
mValues[i].mData = new aiVector3D(v);
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
case FORCE_32BIT:
|
case FORCE_32BIT:
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,8 +255,7 @@ struct aiMetadata {
|
||||||
* @brief Allocates property fields + keys.
|
* @brief Allocates property fields + keys.
|
||||||
* @param numProperties Number of requested properties.
|
* @param numProperties Number of requested properties.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline aiMetadata *Alloc(unsigned int numProperties) {
|
||||||
aiMetadata *Alloc( unsigned int numProperties ) {
|
|
||||||
if (0 == numProperties) {
|
if (0 == numProperties) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -269,19 +271,16 @@ struct aiMetadata {
|
||||||
/**
|
/**
|
||||||
* @brief Deallocates property fields + keys.
|
* @brief Deallocates property fields + keys.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline void Dealloc(aiMetadata *metadata) {
|
||||||
void Dealloc( aiMetadata *metadata ) {
|
|
||||||
delete metadata;
|
delete metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline void Add(const std::string &key, const T &value) {
|
||||||
void Add(const std::string& key, const T& value) {
|
|
||||||
aiString *new_keys = new aiString[mNumProperties + 1];
|
aiString *new_keys = new aiString[mNumProperties + 1];
|
||||||
aiMetadataEntry *new_values = new aiMetadataEntry[mNumProperties + 1];
|
aiMetadataEntry *new_values = new aiMetadataEntry[mNumProperties + 1];
|
||||||
|
|
||||||
for(unsigned int i = 0; i < mNumProperties; ++i)
|
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||||
{
|
|
||||||
new_keys[i] = mKeys[i];
|
new_keys[i] = mKeys[i];
|
||||||
new_values[i] = mValues[i];
|
new_values[i] = mValues[i];
|
||||||
}
|
}
|
||||||
|
@ -298,8 +297,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Set(unsigned index, const std::string &key, const T &value) {
|
||||||
bool Set( unsigned index, const std::string& key, const T& value ) {
|
|
||||||
// In range assertion
|
// In range assertion
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -322,8 +320,25 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Set( const std::string &key, const T &value ) {
|
||||||
bool Get( unsigned index, T& value ) const {
|
if (key.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||||
|
if (key == mKeys[i].C_Str()) {
|
||||||
|
Set(i, key, value);
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline bool Get(unsigned index, T &value) const {
|
||||||
// In range assertion
|
// In range assertion
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -343,8 +358,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Get(const aiString &key, T &value) const {
|
||||||
bool Get( const aiString& key, T& value ) const {
|
|
||||||
// Search for the given key
|
// Search for the given key
|
||||||
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
for (unsigned int i = 0; i < mNumProperties; ++i) {
|
||||||
if (mKeys[i] == key) {
|
if (mKeys[i] == key) {
|
||||||
|
@ -355,8 +369,7 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline bool Get(const std::string &key, T &value) const {
|
||||||
bool Get( const std::string& key, T& value ) const {
|
|
||||||
return Get(aiString(key), value);
|
return Get(aiString(key), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,8 +378,7 @@ struct aiMetadata {
|
||||||
/// \param [out] pKey - pointer to the key value.
|
/// \param [out] pKey - pointer to the key value.
|
||||||
/// \param [out] pEntry - pointer to the entry: type and value.
|
/// \param [out] pEntry - pointer to the entry: type and value.
|
||||||
/// \return false - if pIndex is out of range, else - true.
|
/// \return false - if pIndex is out of range, else - true.
|
||||||
inline
|
inline bool Get(size_t index, const aiString *&key, const aiMetadataEntry *&entry) const {
|
||||||
bool Get(size_t index, const aiString*& key, const aiMetadataEntry*& entry) const {
|
|
||||||
if (index >= mNumProperties) {
|
if (index >= mNumProperties) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -379,8 +391,7 @@ struct aiMetadata {
|
||||||
|
|
||||||
/// Check whether there is a metadata entry for the given key.
|
/// Check whether there is a metadata entry for the given key.
|
||||||
/// \param [in] Key - the key value value to check for.
|
/// \param [in] Key - the key value value to check for.
|
||||||
inline
|
inline bool HasKey(const char *key) {
|
||||||
bool HasKey(const char* key) {
|
|
||||||
if (nullptr == key) {
|
if (nullptr == key) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +406,6 @@ struct aiMetadata {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AI_METADATA_H_INC
|
#endif // AI_METADATA_H_INC
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
|
|
||||||
|
#pragma warning(disable: 4100) // Disable warning 'unreferenced formal parameter'
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "contrib/stb_image/stb_image.h"
|
#include "contrib/stb_image/stb_image.h"
|
||||||
|
#pragma warning(default: 4100) // Enable warning 'unreferenced formal parameter'
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
@ -38,10 +40,10 @@
|
||||||
// The default hard-coded path. Can be overridden by supplying a path through the command line.
|
// The default hard-coded path. Can be overridden by supplying a path through the command line.
|
||||||
static std::string modelpath = "../../test/models/OBJ/spider.obj";
|
static std::string modelpath = "../../test/models/OBJ/spider.obj";
|
||||||
|
|
||||||
HGLRC hRC=NULL; // Permanent Rendering Context
|
HGLRC hRC=nullptr; // Permanent Rendering Context
|
||||||
HDC hDC=NULL; // Private GDI Device Context
|
HDC hDC=nullptr; // Private GDI Device Context
|
||||||
HWND hWnd=NULL; // Holds Window Handle
|
HWND g_hWnd=nullptr; // Holds Window Handle
|
||||||
HINSTANCE hInstance; // Holds The Instance Of The Application
|
HINSTANCE g_hInstance=nullptr; // Holds The Instance Of The Application
|
||||||
|
|
||||||
bool keys[256]; // Array used for Keyboard Routine;
|
bool keys[256]; // Array used for Keyboard Routine;
|
||||||
bool active=TRUE; // Window Active Flag Set To TRUE by Default
|
bool active=TRUE; // Window Active Flag Set To TRUE by Default
|
||||||
|
@ -64,7 +66,7 @@ GLfloat LightPosition[]= { 0.0f, 0.0f, 15.0f, 1.0f };
|
||||||
|
|
||||||
|
|
||||||
// the global Assimp scene object
|
// the global Assimp scene object
|
||||||
const aiScene* scene = NULL;
|
const aiScene* g_scene = nullptr;
|
||||||
GLuint scene_list = 0;
|
GLuint scene_list = 0;
|
||||||
aiVector3D scene_min, scene_max, scene_center;
|
aiVector3D scene_min, scene_max, scene_center;
|
||||||
|
|
||||||
|
@ -122,15 +124,15 @@ bool Import3DFromFile( const std::string& pFile)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox(NULL, UTFConverter("Couldn't open file: " + pFile).c_wstr() , TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
MessageBox(nullptr, UTFConverter("Couldn't open file: " + pFile).c_wstr() , TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
||||||
logInfo( importer.GetErrorString());
|
logInfo( importer.GetErrorString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scene = importer.ReadFile( pFile, aiProcessPreset_TargetRealtime_Quality);
|
g_scene = importer.ReadFile(pFile, aiProcessPreset_TargetRealtime_Quality);
|
||||||
|
|
||||||
// If the import failed, report it
|
// If the import failed, report it
|
||||||
if( !scene)
|
if(!g_scene)
|
||||||
{
|
{
|
||||||
logInfo( importer.GetErrorString());
|
logInfo( importer.GetErrorString());
|
||||||
return false;
|
return false;
|
||||||
|
@ -179,7 +181,7 @@ void freeTextureIds()
|
||||||
if (textureIds)
|
if (textureIds)
|
||||||
{
|
{
|
||||||
delete[] textureIds;
|
delete[] textureIds;
|
||||||
textureIds = NULL;
|
textureIds = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +217,7 @@ int LoadGLTextures(const aiScene* scene)
|
||||||
while (texFound == AI_SUCCESS)
|
while (texFound == AI_SUCCESS)
|
||||||
{
|
{
|
||||||
texFound = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE, texIndex, &path);
|
texFound = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE, texIndex, &path);
|
||||||
textureIdMap[path.data] = NULL; //fill map with textures, pointers still NULL yet
|
textureIdMap[path.data] = nullptr; //fill map with textures, pointers still NULL yet
|
||||||
texIndex++;
|
texIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,7 +285,7 @@ int LoadGLTextures(const aiScene* scene)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Error occurred */
|
/* Error occurred */
|
||||||
MessageBox(NULL, UTFConverter("Couldn't load Image: " + fileloc).c_wstr(), TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
MessageBox(nullptr, UTFConverter("Couldn't load Image: " + fileloc).c_wstr(), TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Because we have already copied image data into texture data we can release memory used by image.
|
// Because we have already copied image data into texture data we can release memory used by image.
|
||||||
|
@ -299,7 +301,7 @@ int LoadGLTextures(const aiScene* scene)
|
||||||
// All Setup For OpenGL goes here
|
// All Setup For OpenGL goes here
|
||||||
int InitGL()
|
int InitGL()
|
||||||
{
|
{
|
||||||
if (!LoadGLTextures(scene))
|
if (!LoadGLTextures(g_scene))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -440,12 +442,12 @@ void recursive_render (const struct aiScene *sc, const struct aiNode* nd, float
|
||||||
// draw all meshes assigned to this node
|
// draw all meshes assigned to this node
|
||||||
for (; n < nd->mNumMeshes; ++n)
|
for (; n < nd->mNumMeshes; ++n)
|
||||||
{
|
{
|
||||||
const struct aiMesh* mesh = scene->mMeshes[nd->mMeshes[n]];
|
const struct aiMesh* mesh = sc->mMeshes[nd->mMeshes[n]];
|
||||||
|
|
||||||
apply_material(sc->mMaterials[mesh->mMaterialIndex]);
|
apply_material(sc->mMaterials[mesh->mMaterialIndex]);
|
||||||
|
|
||||||
|
|
||||||
if(mesh->mNormals == NULL)
|
if(mesh->mNormals == nullptr)
|
||||||
{
|
{
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
@ -454,7 +456,7 @@ void recursive_render (const struct aiScene *sc, const struct aiNode* nd, float
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mesh->mColors[0] != NULL)
|
if(mesh->mColors[0] != nullptr)
|
||||||
{
|
{
|
||||||
glEnable(GL_COLOR_MATERIAL);
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
}
|
}
|
||||||
|
@ -480,9 +482,9 @@ void recursive_render (const struct aiScene *sc, const struct aiNode* nd, float
|
||||||
for(i = 0; i < face->mNumIndices; i++) // go through all vertices in face
|
for(i = 0; i < face->mNumIndices; i++) // go through all vertices in face
|
||||||
{
|
{
|
||||||
int vertexIndex = face->mIndices[i]; // get group index for current index
|
int vertexIndex = face->mIndices[i]; // get group index for current index
|
||||||
if(mesh->mColors[0] != NULL)
|
if(mesh->mColors[0] != nullptr)
|
||||||
Color4f(&mesh->mColors[0][vertexIndex]);
|
Color4f(&mesh->mColors[0][vertexIndex]);
|
||||||
if(mesh->mNormals != NULL)
|
if(mesh->mNormals != nullptr)
|
||||||
|
|
||||||
if(mesh->HasTextureCoords(0)) //HasTextureCoords(texture_coordinates_set)
|
if(mesh->HasTextureCoords(0)) //HasTextureCoords(texture_coordinates_set)
|
||||||
{
|
{
|
||||||
|
@ -527,7 +529,7 @@ int DrawGLScene() //Here's where we do all the drawing
|
||||||
glRotatef(yrot, 0.0f, 1.0f, 0.0f);
|
glRotatef(yrot, 0.0f, 1.0f, 0.0f);
|
||||||
glRotatef(zrot, 0.0f, 0.0f, 1.0f);
|
glRotatef(zrot, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
drawAiScene(scene);
|
drawAiScene(g_scene);
|
||||||
|
|
||||||
//xrot+=0.3f;
|
//xrot+=0.3f;
|
||||||
yrot+=0.2f;
|
yrot+=0.2f;
|
||||||
|
@ -541,50 +543,50 @@ void KillGLWindow() // Properly Kill The Window
|
||||||
{
|
{
|
||||||
if (fullscreen) // Are We In Fullscreen Mode?
|
if (fullscreen) // Are We In Fullscreen Mode?
|
||||||
{
|
{
|
||||||
ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop
|
ChangeDisplaySettings(nullptr, 0); // If So Switch Back To The Desktop
|
||||||
ShowCursor(TRUE); // Show Mouse Pointer
|
ShowCursor(TRUE); // Show Mouse Pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hRC) // Do We Have A Rendering Context?
|
if (hRC) // Do We Have A Rendering Context?
|
||||||
{
|
{
|
||||||
if (!wglMakeCurrent(NULL, NULL)) // Are We Able To Release The DC And RC Contexts?
|
if (!wglMakeCurrent(nullptr, nullptr)) // Are We Able To Release The DC And RC Contexts?
|
||||||
{
|
{
|
||||||
MessageBox(NULL, TEXT("Release Of DC And RC Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
MessageBox(nullptr, TEXT("Release Of DC And RC Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
|
if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
|
||||||
{
|
{
|
||||||
MessageBox(NULL, TEXT("Release Rendering Context Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
MessageBox(nullptr, TEXT("Release Rendering Context Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
hRC = NULL;
|
hRC = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hDC)
|
if (hDC)
|
||||||
{
|
{
|
||||||
if (!ReleaseDC(hWnd, hDC)) // Are We able to Release The DC?
|
if (!ReleaseDC(g_hWnd, hDC)) // Are We able to Release The DC?
|
||||||
MessageBox(NULL, TEXT("Release Device Context Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
MessageBox(nullptr, TEXT("Release Device Context Failed."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
||||||
hDC = NULL;
|
hDC = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hWnd)
|
if (g_hWnd)
|
||||||
{
|
{
|
||||||
if (!DestroyWindow(hWnd)) // Are We Able To Destroy The Window
|
if (!DestroyWindow(g_hWnd)) // Are We Able To Destroy The Window
|
||||||
MessageBox(NULL, TEXT("Could Not Release hWnd."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
MessageBox(nullptr, TEXT("Could Not Release hWnd."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
||||||
hWnd = NULL;
|
g_hWnd = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hInstance)
|
if (g_hInstance)
|
||||||
{
|
{
|
||||||
if (!UnregisterClass(TEXT("OpenGL"), hInstance)) // Are We Able To Unregister Class
|
if (!UnregisterClass(TEXT("OpenGL"), g_hInstance)) // Are We Able To Unregister Class
|
||||||
MessageBox(NULL, TEXT("Could Not Unregister Class."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
MessageBox(nullptr, TEXT("Could Not Unregister Class."), TEXT("SHUTDOWN ERROR"), MB_OK | MB_ICONINFORMATION);
|
||||||
hInstance = NULL;
|
g_hInstance = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GLboolean abortGLInit(const char* abortMessage)
|
GLboolean abortGLInit(const char* abortMessage)
|
||||||
{
|
{
|
||||||
KillGLWindow(); // Reset Display
|
KillGLWindow(); // Reset Display
|
||||||
MessageBox(NULL, UTFConverter(abortMessage).c_wstr(), TEXT("ERROR"), MB_OK|MB_ICONEXCLAMATION);
|
MessageBox(nullptr, UTFConverter(abortMessage).c_wstr(), TEXT("ERROR"), MB_OK|MB_ICONEXCLAMATION);
|
||||||
return FALSE; // quit and return False
|
return FALSE; // quit and return False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,21 +604,21 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
|
|
||||||
fullscreen = fullscreenflag;
|
fullscreen = fullscreenflag;
|
||||||
|
|
||||||
hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window
|
g_hInstance = GetModuleHandle(nullptr); // Grab An Instance For Our Window
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Move, And Own DC For Window
|
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Move, And Own DC For Window
|
||||||
wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc handles Messages
|
wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc handles Messages
|
||||||
wc.cbClsExtra = 0; // No Extra Window Data
|
wc.cbClsExtra = 0; // No Extra Window Data
|
||||||
wc.cbWndExtra = 0; // No Extra Window Data
|
wc.cbWndExtra = 0; // No Extra Window Data
|
||||||
wc.hInstance = hInstance;
|
wc.hInstance = g_hInstance;
|
||||||
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon
|
wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO); // Load The Default Icon
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the default arrow
|
wc.hCursor = LoadCursor(nullptr, IDC_ARROW); // Load the default arrow
|
||||||
wc.hbrBackground= NULL; // No Background required for OpenGL
|
wc.hbrBackground= nullptr; // No Background required for OpenGL
|
||||||
wc.lpszMenuName = NULL; // No Menu
|
wc.lpszMenuName = nullptr; // No Menu
|
||||||
wc.lpszClassName= TEXT("OpenGL"); // Class Name
|
wc.lpszClassName= TEXT("OpenGL"); // Class Name
|
||||||
|
|
||||||
if (!RegisterClass(&wc))
|
if (!RegisterClass(&wc))
|
||||||
{
|
{
|
||||||
MessageBox(NULL, TEXT("Failed to register the window class"), TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
MessageBox(nullptr, TEXT("Failed to register the window class"), TEXT("ERROR"), MB_OK | MB_ICONEXCLAMATION);
|
||||||
return FALSE; //exit and return false
|
return FALSE; //exit and return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,14 +636,14 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
|
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
|
||||||
{
|
{
|
||||||
// If The Mode Fails, Offer Two Options. Quit Or Run In A Window.
|
// If The Mode Fails, Offer Two Options. Quit Or Run In A Window.
|
||||||
if (MessageBox(NULL,TEXT("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?"),TEXT("NeHe GL"),MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
if (MessageBox(nullptr,TEXT("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?"),TEXT("NeHe GL"),MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
||||||
{
|
{
|
||||||
fullscreen = FALSE; // Select Windowed Mode (Fullscreen = FALSE)
|
fullscreen = FALSE; // Select Windowed Mode (Fullscreen = FALSE)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Popup Messagebox: Closing
|
//Popup Messagebox: Closing
|
||||||
MessageBox(NULL, TEXT("Program will close now."), TEXT("ERROR"), MB_OK|MB_ICONSTOP);
|
MessageBox(nullptr, TEXT("Program will close now."), TEXT("ERROR"), MB_OK|MB_ICONSTOP);
|
||||||
return FALSE; //exit, return false
|
return FALSE; //exit, return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -661,7 +663,7 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
|
|
||||||
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requestes Size
|
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requestes Size
|
||||||
|
|
||||||
if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window
|
if (nullptr == (g_hWnd=CreateWindowEx(dwExStyle, // Extended Style For The Window
|
||||||
TEXT("OpenGL"), // Class Name
|
TEXT("OpenGL"), // Class Name
|
||||||
UTFConverter(title).c_wstr(), // Window Title
|
UTFConverter(title).c_wstr(), // Window Title
|
||||||
WS_CLIPSIBLINGS | // Required Window Style
|
WS_CLIPSIBLINGS | // Required Window Style
|
||||||
|
@ -670,10 +672,10 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
0, 0, // Window Position
|
0, 0, // Window Position
|
||||||
WindowRect.right-WindowRect.left, // Calc adjusted Window Width
|
WindowRect.right-WindowRect.left, // Calc adjusted Window Width
|
||||||
WindowRect.bottom-WindowRect.top, // Calc adjustes Window Height
|
WindowRect.bottom-WindowRect.top, // Calc adjustes Window Height
|
||||||
NULL, // No Parent Window
|
nullptr, // No Parent Window
|
||||||
NULL, // No Menu
|
nullptr, // No Menu
|
||||||
hInstance, // Instance
|
g_hInstance, // Instance
|
||||||
NULL ))) // Don't pass anything To WM_CREATE
|
nullptr ))) // Don't pass anything To WM_CREATE
|
||||||
{
|
{
|
||||||
abortGLInit("Window Creation Error.");
|
abortGLInit("Window Creation Error.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -701,13 +703,13 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
0, 0, 0 // Layer Masks Ignored
|
0, 0, 0 // Layer Masks Ignored
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!(hDC=GetDC(hWnd))) // Did we get the Device Context?
|
if (nullptr == (hDC=GetDC(g_hWnd))) // Did we get the Device Context?
|
||||||
{
|
{
|
||||||
abortGLInit("Can't Create A GL Device Context.");
|
abortGLInit("Can't Create A GL Device Context.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(PixelFormat=ChoosePixelFormat(hDC, &pfd))) // Did We Find a matching pixel Format?
|
if (0 == (PixelFormat=ChoosePixelFormat(hDC, &pfd))) // Did We Find a matching pixel Format?
|
||||||
{
|
{
|
||||||
abortGLInit("Can't Find Suitable PixelFormat");
|
abortGLInit("Can't Find Suitable PixelFormat");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -719,7 +721,7 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(hRC=wglCreateContext(hDC)))
|
if (nullptr == (hRC=wglCreateContext(hDC)))
|
||||||
{
|
{
|
||||||
abortGLInit("Can't Create A GL Rendering Context.");
|
abortGLInit("Can't Create A GL Rendering Context.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -733,9 +735,9 @@ BOOL CreateGLWindow(const char* title, int width, int height, int bits, bool ful
|
||||||
|
|
||||||
//// *** everything okay ***
|
//// *** everything okay ***
|
||||||
|
|
||||||
ShowWindow(hWnd, SW_SHOW); // Show The Window
|
ShowWindow(g_hWnd, SW_SHOW); // Show The Window
|
||||||
SetForegroundWindow(hWnd); // Slightly Higher Prio
|
SetForegroundWindow(g_hWnd); // Slightly Higher Prio
|
||||||
SetFocus(hWnd); // Sets Keyboard Focus To The Window
|
SetFocus(g_hWnd); // Sets Keyboard Focus To The Window
|
||||||
ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen
|
ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen
|
||||||
|
|
||||||
if (!InitGL())
|
if (!InitGL())
|
||||||
|
@ -753,7 +755,7 @@ void cleanup()
|
||||||
|
|
||||||
destroyAILogger();
|
destroyAILogger();
|
||||||
|
|
||||||
if (hWnd)
|
if (g_hWnd)
|
||||||
KillGLWindow();
|
KillGLWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -818,12 +820,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, // Handles for this Window
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI WinMain( HINSTANCE hInstance, // The instance
|
int WINAPI WinMain( HINSTANCE /*hInstance*/, // The instance
|
||||||
HINSTANCE hPrevInstance, // Previous instance
|
HINSTANCE /*hPrevInstance*/, // Previous instance
|
||||||
LPSTR lpCmdLine, // Command Line Parameters
|
LPSTR /*lpCmdLine*/, // Command Line Parameters
|
||||||
int nShowCmd ) // Window Show State
|
int /*nShowCmd*/ ) // Window Show State
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg = {};
|
||||||
BOOL done=FALSE;
|
BOOL done=FALSE;
|
||||||
|
|
||||||
createAILogger();
|
createAILogger();
|
||||||
|
@ -832,7 +834,7 @@ int WINAPI WinMain( HINSTANCE hInstance, // The instance
|
||||||
// Check the command line for an override file path.
|
// Check the command line for an override file path.
|
||||||
int argc;
|
int argc;
|
||||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||||
if (argv != NULL && argc > 1)
|
if (argv != nullptr && argc > 1)
|
||||||
{
|
{
|
||||||
std::wstring modelpathW(argv[1]);
|
std::wstring modelpathW(argv[1]);
|
||||||
modelpath = UTFConverter(modelpathW).str();
|
modelpath = UTFConverter(modelpathW).str();
|
||||||
|
@ -846,7 +848,7 @@ int WINAPI WinMain( HINSTANCE hInstance, // The instance
|
||||||
|
|
||||||
logInfo("=============== Post Import ====================");
|
logInfo("=============== Post Import ====================");
|
||||||
|
|
||||||
if (MessageBox(NULL, TEXT("Would You Like To Run In Fullscreen Mode?"), TEXT("Start Fullscreen?"), MB_YESNO|MB_ICONEXCLAMATION)==IDNO)
|
if (MessageBox(nullptr, TEXT("Would You Like To Run In Fullscreen Mode?"), TEXT("Start Fullscreen?"), MB_YESNO|MB_ICONEXCLAMATION)==IDNO)
|
||||||
{
|
{
|
||||||
fullscreen=FALSE;
|
fullscreen=FALSE;
|
||||||
}
|
}
|
||||||
|
@ -859,7 +861,7 @@ int WINAPI WinMain( HINSTANCE hInstance, // The instance
|
||||||
|
|
||||||
while(!done) // Game Loop
|
while(!done) // Game Loop
|
||||||
{
|
{
|
||||||
if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE))
|
if (PeekMessage(&msg, nullptr, 0,0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
if (msg.message==WM_QUIT)
|
if (msg.message==WM_QUIT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,6 +213,10 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
|
||||||
double factor(0.0);
|
double factor(0.0);
|
||||||
scene->mMetaData->Get("UnitScaleFactor", factor);
|
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||||
EXPECT_DOUBLE_EQ(500.0, factor);
|
EXPECT_DOUBLE_EQ(500.0, factor);
|
||||||
|
|
||||||
|
scene->mMetaData->Set("UnitScaleFactor", factor * 2);
|
||||||
|
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||||
|
EXPECT_DOUBLE_EQ(1000.0, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ void CBackgroundPainter::SetColor (D3DCOLOR p_clrNew)
|
||||||
if (pcTexture)
|
if (pcTexture)
|
||||||
{
|
{
|
||||||
pcTexture->Release();
|
pcTexture->Release();
|
||||||
pcTexture = NULL;
|
pcTexture = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -135,7 +135,7 @@ void CBackgroundPainter::SetCubeMapBG (const char* p_szPath)
|
||||||
if (pcTexture)
|
if (pcTexture)
|
||||||
{
|
{
|
||||||
pcTexture->Release();
|
pcTexture->Release();
|
||||||
pcTexture = NULL;
|
pcTexture = nullptr;
|
||||||
if(TEXTURE_CUBE ==eMode)bHad = true;
|
if(TEXTURE_CUBE ==eMode)bHad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ void CBackgroundPainter::SetTextureBG (const char* p_szPath)
|
||||||
if (pcTexture)
|
if (pcTexture)
|
||||||
{
|
{
|
||||||
pcTexture->Release();
|
pcTexture->Release();
|
||||||
pcTexture = NULL;
|
pcTexture = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
eMode = TEXTURE_2D;
|
eMode = TEXTURE_2D;
|
||||||
|
@ -223,12 +223,12 @@ void CBackgroundPainter::OnPreRender()
|
||||||
// the color buffer )
|
// the color buffer )
|
||||||
if (g_sOptions.eDrawMode == RenderOptions::WIREFRAME)
|
if (g_sOptions.eDrawMode == RenderOptions::WIREFRAME)
|
||||||
{
|
{
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET,
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET,
|
||||||
D3DCOLOR_ARGB(0xff,100,100,100),1.0f,0);
|
D3DCOLOR_ARGB(0xff,100,100,100),1.0f,0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER,0,1.0f,0);
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_ZBUFFER,0,1.0f,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEXTURE_2D == eMode)
|
if (TEXTURE_2D == eMode)
|
||||||
|
@ -293,7 +293,7 @@ void CBackgroundPainter::OnPreRender()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// clear both the render target and the z-buffer
|
// clear both the render target and the z-buffer
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
|
||||||
clrColor,1.0f,0);
|
clrColor,1.0f,0);
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -342,12 +342,12 @@ void CBackgroundPainter::ReleaseNativeResource()
|
||||||
if ( piSkyBoxEffect)
|
if ( piSkyBoxEffect)
|
||||||
{
|
{
|
||||||
piSkyBoxEffect->Release();
|
piSkyBoxEffect->Release();
|
||||||
piSkyBoxEffect = NULL;
|
piSkyBoxEffect = nullptr;
|
||||||
}
|
}
|
||||||
if (pcTexture)
|
if (pcTexture)
|
||||||
{
|
{
|
||||||
pcTexture->Release();
|
pcTexture->Release();
|
||||||
pcTexture = NULL;
|
pcTexture = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -377,8 +377,8 @@ void CBackgroundPainter::RecreateNativeResource()
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
(IDirect3DCubeTexture9**)&pcTexture)))
|
(IDirect3DCubeTexture9**)&pcTexture)))
|
||||||
{
|
{
|
||||||
const char* szEnd = strrchr(szPath.c_str(),'\\');
|
const char* szEnd = strrchr(szPath.c_str(),'\\');
|
||||||
|
@ -411,8 +411,8 @@ void CBackgroundPainter::RecreateNativeResource()
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
(IDirect3DTexture9**)&pcTexture)))
|
(IDirect3DTexture9**)&pcTexture)))
|
||||||
{
|
{
|
||||||
const char* szEnd = strrchr(szPath.c_str(),'\\');
|
const char* szEnd = strrchr(szPath.c_str(),'\\');
|
||||||
|
@ -433,15 +433,15 @@ void CBackgroundPainter::RecreateNativeResource()
|
||||||
}
|
}
|
||||||
if (!piSkyBoxEffect)
|
if (!piSkyBoxEffect)
|
||||||
{
|
{
|
||||||
ID3DXBuffer* piBuffer = NULL;
|
ID3DXBuffer* piBuffer = nullptr;
|
||||||
if(FAILED( D3DXCreateEffect(
|
if(FAILED( D3DXCreateEffect(
|
||||||
g_piDevice,
|
g_piDevice,
|
||||||
g_szSkyboxShader.c_str(),
|
g_szSkyboxShader.c_str(),
|
||||||
(UINT)g_szSkyboxShader.length(),
|
(UINT)g_szSkyboxShader.length(),
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
AI_SHADER_COMPILE_FLAGS,
|
AI_SHADER_COMPILE_FLAGS,
|
||||||
NULL,
|
nullptr,
|
||||||
&piSkyBoxEffect,&piBuffer)))
|
&piSkyBoxEffect,&piBuffer)))
|
||||||
{
|
{
|
||||||
// failed to compile the shader
|
// failed to compile the shader
|
||||||
|
|
|
@ -158,8 +158,8 @@ int CDisplay::AddNodeToDisplayList(
|
||||||
aiNode* pcNode,
|
aiNode* pcNode,
|
||||||
HTREEITEM hRoot)
|
HTREEITEM hRoot)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcNode);
|
ai_assert(nullptr != pcNode);
|
||||||
ai_assert(NULL != hRoot);
|
ai_assert(nullptr != hRoot);
|
||||||
|
|
||||||
char chTemp[MAXLEN];
|
char chTemp[MAXLEN];
|
||||||
|
|
||||||
|
@ -269,13 +269,13 @@ int CDisplay::AddMeshToDisplayList(unsigned int iIndex, HTREEITEM hRoot)
|
||||||
// Replace the currently selected texture by another one
|
// Replace the currently selected texture by another one
|
||||||
int CDisplay::ReplaceCurrentTexture(const char* szPath)
|
int CDisplay::ReplaceCurrentTexture(const char* szPath)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != szPath);
|
ai_assert(nullptr != szPath);
|
||||||
|
|
||||||
// well ... try to load it
|
// well ... try to load it
|
||||||
IDirect3DTexture9* piTexture = NULL;
|
IDirect3DTexture9* piTexture = nullptr;
|
||||||
aiString szString;
|
aiString szString;
|
||||||
strcpy(szString.data,szPath);
|
strcpy(szString.data,szPath);
|
||||||
szString.length = strlen(szPath);
|
szString.length = static_cast<ai_uint32>(strlen(szPath));
|
||||||
CMaterialManager::Instance().LoadTexture(&piTexture,&szString);
|
CMaterialManager::Instance().LoadTexture(&piTexture,&szString);
|
||||||
|
|
||||||
if (!piTexture) {
|
if (!piTexture) {
|
||||||
|
@ -301,8 +301,8 @@ int CDisplay::ReplaceCurrentTexture(const char* szPath)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AssetHelper::MeshHelper* pcMesh = g_pcAsset->apcMeshes[i];
|
AssetHelper::MeshHelper* pcMesh = g_pcAsset->apcMeshes[i];
|
||||||
IDirect3DTexture9** tex = NULL;
|
IDirect3DTexture9** tex = nullptr;
|
||||||
const char* tex_string = NULL;
|
const char* tex_string = nullptr;
|
||||||
|
|
||||||
switch (this->m_pcCurrentTexture->iType)
|
switch (this->m_pcCurrentTexture->iType)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,7 @@ int CDisplay::AddTextureToDisplayList(unsigned int iType,
|
||||||
aiTextureOp eTextureOp /*= aiTextureOp_Multiply*/,
|
aiTextureOp eTextureOp /*= aiTextureOp_Multiply*/,
|
||||||
unsigned int iMesh /*= 0*/)
|
unsigned int iMesh /*= 0*/)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != szPath);
|
ai_assert(nullptr != szPath);
|
||||||
|
|
||||||
char chTemp[512];
|
char chTemp[512];
|
||||||
char chTempEmb[256];
|
char chTempEmb[256];
|
||||||
|
@ -388,8 +388,8 @@ int CDisplay::AddTextureToDisplayList(unsigned int iType,
|
||||||
{
|
{
|
||||||
if ('*' == *szPath->data)
|
if ('*' == *szPath->data)
|
||||||
{
|
{
|
||||||
int iIndex = atoi(szPath->data+1);
|
int iIndex2 = atoi(szPath->data+1);
|
||||||
ai_snprintf(chTempEmb,256,"Embedded #%i",iIndex);
|
ai_snprintf(chTempEmb,256,"Embedded #%i",iIndex2);
|
||||||
sz = chTempEmb;
|
sz = chTempEmb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -436,15 +436,15 @@ int CDisplay::AddTextureToDisplayList(unsigned int iType,
|
||||||
szType = "Lightmap";
|
szType = "Lightmap";
|
||||||
break;
|
break;
|
||||||
case aiTextureType_DISPLACEMENT:
|
case aiTextureType_DISPLACEMENT:
|
||||||
piTexture = NULL;
|
piTexture = nullptr;
|
||||||
szType = "Displacement";
|
szType = "Displacement";
|
||||||
break;
|
break;
|
||||||
case aiTextureType_REFLECTION:
|
case aiTextureType_REFLECTION:
|
||||||
piTexture = NULL;
|
piTexture = nullptr;
|
||||||
szType = "Reflection";
|
szType = "Reflection";
|
||||||
break;
|
break;
|
||||||
case aiTextureType_UNKNOWN:
|
case aiTextureType_UNKNOWN:
|
||||||
piTexture = NULL;
|
piTexture = nullptr;
|
||||||
szType = "Unknown";
|
szType = "Unknown";
|
||||||
break;
|
break;
|
||||||
default: // opacity + opacity | mask
|
default: // opacity + opacity | mask
|
||||||
|
@ -521,7 +521,7 @@ int CDisplay::AddTextureToDisplayList(unsigned int iType,
|
||||||
int CDisplay::AddMaterialToDisplayList(HTREEITEM hRoot,
|
int CDisplay::AddMaterialToDisplayList(HTREEITEM hRoot,
|
||||||
unsigned int iIndex)
|
unsigned int iIndex)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != hRoot);
|
ai_assert(nullptr != hRoot);
|
||||||
|
|
||||||
aiMaterial* pcMat = g_pcAsset->pcScene->mMaterials[iIndex];
|
aiMaterial* pcMat = g_pcAsset->pcScene->mMaterials[iIndex];
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ int CDisplay::AddMaterialToDisplayList(HTREEITEM hRoot,
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (AI_SUCCESS != aiGetMaterialTexture(pcMat,(aiTextureType)i,iNum,
|
if (AI_SUCCESS != aiGetMaterialTexture(pcMat,(aiTextureType)i,iNum,
|
||||||
&szPath,NULL, &iUV,&fBlend,&eOp))
|
&szPath,nullptr, &iUV,&fBlend,&eOp))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -658,23 +658,23 @@ int CDisplay::LoadImageList(void)
|
||||||
|
|
||||||
// Load the bitmaps and add them to the image lists.
|
// Load the bitmaps and add them to the image lists.
|
||||||
HBITMAP hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BFX));
|
HBITMAP hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BFX));
|
||||||
m_aiImageList[AI_VIEW_IMGLIST_MATERIAL] = ImageList_Add(hIml, hBmp, NULL);
|
m_aiImageList[AI_VIEW_IMGLIST_MATERIAL] = ImageList_Add(hIml, hBmp, nullptr);
|
||||||
DeleteObject(hBmp);
|
DeleteObject(hBmp);
|
||||||
|
|
||||||
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BNODE));
|
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BNODE));
|
||||||
m_aiImageList[AI_VIEW_IMGLIST_NODE] = ImageList_Add(hIml, hBmp, NULL);
|
m_aiImageList[AI_VIEW_IMGLIST_NODE] = ImageList_Add(hIml, hBmp, nullptr);
|
||||||
DeleteObject(hBmp);
|
DeleteObject(hBmp);
|
||||||
|
|
||||||
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTX));
|
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTX));
|
||||||
m_aiImageList[AI_VIEW_IMGLIST_TEXTURE] = ImageList_Add(hIml, hBmp, NULL);
|
m_aiImageList[AI_VIEW_IMGLIST_TEXTURE] = ImageList_Add(hIml, hBmp, nullptr);
|
||||||
DeleteObject(hBmp);
|
DeleteObject(hBmp);
|
||||||
|
|
||||||
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTXI));
|
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BTXI));
|
||||||
m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID] = ImageList_Add(hIml, hBmp, NULL);
|
m_aiImageList[AI_VIEW_IMGLIST_TEXTURE_INVALID] = ImageList_Add(hIml, hBmp, nullptr);
|
||||||
DeleteObject(hBmp);
|
DeleteObject(hBmp);
|
||||||
|
|
||||||
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BROOT));
|
hBmp = LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BROOT));
|
||||||
m_aiImageList[AI_VIEW_IMGLIST_MODEL] = ImageList_Add(hIml, hBmp, NULL);
|
m_aiImageList[AI_VIEW_IMGLIST_MODEL] = ImageList_Add(hIml, hBmp, nullptr);
|
||||||
DeleteObject(hBmp);
|
DeleteObject(hBmp);
|
||||||
|
|
||||||
// Associate the image list with the tree.
|
// Associate the image list with the tree.
|
||||||
|
@ -778,7 +778,7 @@ int CDisplay::OnRender()
|
||||||
|
|
||||||
// present the back-buffer
|
// present the back-buffer
|
||||||
g_piDevice->EndScene();
|
g_piDevice->EndScene();
|
||||||
g_piDevice->Present(NULL,NULL,NULL,NULL);
|
g_piDevice->Present(nullptr,nullptr,nullptr,nullptr);
|
||||||
|
|
||||||
// don't remove this, problems on some older machines (AMD timing bug)
|
// don't remove this, problems on some older machines (AMD timing bug)
|
||||||
Sleep(10);
|
Sleep(10);
|
||||||
|
@ -788,9 +788,9 @@ int CDisplay::OnRender()
|
||||||
// Update UI
|
// Update UI
|
||||||
void UpdateColorFieldsInUI()
|
void UpdateColorFieldsInUI()
|
||||||
{
|
{
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),nullptr,TRUE);
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),nullptr,TRUE);
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),nullptr,TRUE);
|
||||||
|
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
||||||
|
@ -859,7 +859,7 @@ int CDisplay::Reset(void)
|
||||||
m_asNodes.clear();
|
m_asNodes.clear();
|
||||||
m_asMeshes.clear();
|
m_asMeshes.clear();
|
||||||
|
|
||||||
m_hRoot = NULL;
|
m_hRoot = nullptr;
|
||||||
|
|
||||||
return OnSetupNormalView();
|
return OnSetupNormalView();
|
||||||
}
|
}
|
||||||
|
@ -896,9 +896,9 @@ int CDisplay::OnSetupNormalView()
|
||||||
SetViewMode(VIEWMODE_FULL);
|
SetViewMode(VIEWMODE_FULL);
|
||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
m_pcCurrentMaterial = NULL;
|
m_pcCurrentMaterial = nullptr;
|
||||||
m_pcCurrentTexture = NULL;
|
m_pcCurrentTexture = nullptr;
|
||||||
m_pcCurrentNode = NULL;
|
m_pcCurrentNode = nullptr;
|
||||||
|
|
||||||
// redraw the color fields in the UI --- their purpose has possibly changed
|
// redraw the color fields in the UI --- their purpose has possibly changed
|
||||||
UpdateColorFieldsInUI();
|
UpdateColorFieldsInUI();
|
||||||
|
@ -908,7 +908,7 @@ int CDisplay::OnSetupNormalView()
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CDisplay::OnSetupNodeView(NodeInfo* pcNew)
|
int CDisplay::OnSetupNodeView(NodeInfo* pcNew)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcNew);
|
ai_assert(nullptr != pcNew);
|
||||||
|
|
||||||
if (m_pcCurrentNode == pcNew)return 2;
|
if (m_pcCurrentNode == pcNew)return 2;
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ int CDisplay::OnSetupNodeView(NodeInfo* pcNew)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CDisplay::OnSetupMaterialView(MaterialInfo* pcNew)
|
int CDisplay::OnSetupMaterialView(MaterialInfo* pcNew)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcNew);
|
ai_assert(nullptr != pcNew);
|
||||||
|
|
||||||
if (m_pcCurrentMaterial == pcNew)return 2;
|
if (m_pcCurrentMaterial == pcNew)return 2;
|
||||||
|
|
||||||
|
@ -973,7 +973,7 @@ int CDisplay::OnSetupMaterialView(MaterialInfo* pcNew)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CDisplay::OnSetupTextureView(TextureInfo* pcNew)
|
int CDisplay::OnSetupTextureView(TextureInfo* pcNew)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcNew);
|
ai_assert(nullptr != pcNew);
|
||||||
|
|
||||||
if (this->m_pcCurrentTexture == pcNew)return 2;
|
if (this->m_pcCurrentTexture == pcNew)return 2;
|
||||||
|
|
||||||
|
@ -1099,7 +1099,7 @@ int CDisplay::OnSetup(HTREEITEM p_hTreeItem)
|
||||||
MaterialInfo* pcNew3;
|
MaterialInfo* pcNew3;
|
||||||
};
|
};
|
||||||
|
|
||||||
pcNew = NULL;
|
pcNew = nullptr;
|
||||||
for (std::vector<TextureInfo>::iterator i = m_asTextures.begin();i != m_asTextures.end();++i){
|
for (std::vector<TextureInfo>::iterator i = m_asTextures.begin();i != m_asTextures.end();++i){
|
||||||
if (p_hTreeItem == (*i).hTreeItem) {
|
if (p_hTreeItem == (*i).hTreeItem) {
|
||||||
pcNew = &(*i);
|
pcNew = &(*i);
|
||||||
|
@ -1136,12 +1136,12 @@ int CDisplay::OnSetup(HTREEITEM p_hTreeItem)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem)
|
int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != hItem);
|
ai_assert(nullptr != hItem);
|
||||||
|
|
||||||
HMENU hDisplay = NULL;
|
HMENU hDisplay = nullptr;
|
||||||
|
|
||||||
// search in our list for the item
|
// search in our list for the item
|
||||||
TextureInfo* pcNew = NULL;
|
TextureInfo* pcNew = nullptr;
|
||||||
for (std::vector<TextureInfo>::iterator
|
for (std::vector<TextureInfo>::iterator
|
||||||
i = m_asTextures.begin();
|
i = m_asTextures.begin();
|
||||||
i != m_asTextures.end();++i)
|
i != m_asTextures.end();++i)
|
||||||
|
@ -1158,7 +1158,7 @@ int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
// search in the material list for the item
|
// search in the material list for the item
|
||||||
MaterialInfo* pcNew2 = NULL;
|
MaterialInfo* pcNew2 = nullptr;
|
||||||
for (std::vector<MaterialInfo>::iterator
|
for (std::vector<MaterialInfo>::iterator
|
||||||
i = m_asMaterials.begin();
|
i = m_asMaterials.begin();
|
||||||
i != m_asMaterials.end();++i)
|
i != m_asMaterials.end();++i)
|
||||||
|
@ -1173,7 +1173,7 @@ int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem)
|
||||||
HMENU hMenu = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDR_MATPOPUP));
|
HMENU hMenu = LoadMenu(g_hInstance,MAKEINTRESOURCE(IDR_MATPOPUP));
|
||||||
hDisplay = GetSubMenu(hMenu,0);
|
hDisplay = GetSubMenu(hMenu,0);
|
||||||
}
|
}
|
||||||
if (NULL != hDisplay)
|
if (nullptr != hDisplay)
|
||||||
{
|
{
|
||||||
// select this entry (this should all OnSetup())
|
// select this entry (this should all OnSetup())
|
||||||
TreeView_Select(GetDlgItem(g_hDlg,IDC_TREE1),hItem,TVGN_CARET);
|
TreeView_Select(GetDlgItem(g_hDlg,IDC_TREE1),hItem,TVGN_CARET);
|
||||||
|
@ -1185,7 +1185,7 @@ int CDisplay::ShowTreeViewContextMenu(HTREEITEM hItem)
|
||||||
POINT sPoint;
|
POINT sPoint;
|
||||||
GetCursorPos(&sPoint);
|
GetCursorPos(&sPoint);
|
||||||
TrackPopupMenu(hDisplay, TPM_LEFTALIGN, sPoint.x, sPoint.y, 0,
|
TrackPopupMenu(hDisplay, TPM_LEFTALIGN, sPoint.x, sPoint.y, 0,
|
||||||
g_hDlg,NULL);
|
g_hDlg,nullptr);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1260,8 +1260,8 @@ int CDisplay::HandleTreeViewPopup(WPARAM wParam,LPARAM lParam)
|
||||||
clamp<unsigned char>(clrOld.g * 255.0f),
|
clamp<unsigned char>(clrOld.g * 255.0f),
|
||||||
clamp<unsigned char>(clrOld.b * 255.0f));
|
clamp<unsigned char>(clrOld.b * 255.0f));
|
||||||
clr.lpCustColors = g_aclCustomColors;
|
clr.lpCustColors = g_aclCustomColors;
|
||||||
clr.lpfnHook = NULL;
|
clr.lpfnHook = nullptr;
|
||||||
clr.lpTemplateName = NULL;
|
clr.lpTemplateName = nullptr;
|
||||||
clr.lCustData = 0;
|
clr.lCustData = 0;
|
||||||
|
|
||||||
ChooseColor(&clr);
|
ChooseColor(&clr);
|
||||||
|
@ -1308,7 +1308,7 @@ int CALLBACK TreeViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM /*lParam*/)
|
||||||
{
|
{
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
|
@ -1318,7 +1318,7 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
case ID_HEY_REPLACE:
|
case ID_HEY_REPLACE:
|
||||||
{
|
{
|
||||||
// get a path to a new texture
|
// get a path to a new texture
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"ReplaceTextureSrc",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"ReplaceTextureSrc",nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp))
|
(BYTE*)szFileName,&dwTemp))
|
||||||
{
|
{
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
|
@ -1335,13 +1335,13 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"Textures\0*.png;*.dds;*.tga;*.bmp;*.tif;*.ppm;*.ppx;*.jpg;*.jpeg;*.exr\0*.*\0",
|
"Textures\0*.png;*.dds;*.tga;*.bmp;*.tif;*.ppm;*.ppx;*.jpg;*.jpeg;*.exr\0*.*\0",
|
||||||
NULL, 0, 1,
|
nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Replace this texture",
|
"Replace this texture",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".jpg", 0, NULL, NULL
|
0, 1, ".jpg", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetOpenFileName(&sFilename1) == 0) return 0;
|
if(GetOpenFileName(&sFilename1) == 0) return 0;
|
||||||
|
|
||||||
|
@ -1353,7 +1353,7 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
|
|
||||||
case ID_HEY_EXPORT:
|
case ID_HEY_EXPORT:
|
||||||
{
|
{
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"TextureExportDest",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"TextureExportDest",nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp))
|
(BYTE*)szFileName,&dwTemp))
|
||||||
{
|
{
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
|
@ -1370,12 +1370,12 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"Textures\0*.png;*.dds;*.bmp;*.tif;*.pfm;*.jpg;*.jpeg;*.hdr\0*.*\0", NULL, 0, 1,
|
"Textures\0*.png;*.dds;*.bmp;*.tif;*.pfm;*.jpg;*.jpeg;*.hdr\0*.*\0", nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Export texture to file",
|
"Export texture to file",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".png", 0, NULL, NULL
|
0, 1, ".png", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetSaveFileName(&sFilename1) == 0) return 0;
|
if(GetSaveFileName(&sFilename1) == 0) return 0;
|
||||||
|
|
||||||
|
@ -1397,9 +1397,9 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get a pointer to the first surface of the current texture
|
// get a pointer to the first surface of the current texture
|
||||||
IDirect3DSurface9* pi = NULL;
|
IDirect3DSurface9* pi = nullptr;
|
||||||
(*this->m_pcCurrentTexture->piTexture)->GetSurfaceLevel(0,&pi);
|
(*this->m_pcCurrentTexture->piTexture)->GetSurfaceLevel(0,&pi);
|
||||||
if(!pi || FAILED(D3DXSaveSurfaceToFile(szFileName,eFormat,pi,NULL,NULL)))
|
if(!pi || FAILED(D3DXSaveSurfaceToFile(szFileName,eFormat,pi,nullptr,nullptr)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to export texture",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to export texture",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
|
@ -1495,7 +1495,7 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
||||||
// Setup stereo view
|
// Setup stereo view
|
||||||
int CDisplay::SetupStereoView()
|
int CDisplay::SetupStereoView()
|
||||||
{
|
{
|
||||||
if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode)
|
if (nullptr != g_pcAsset && nullptr != g_pcAsset->pcScene->mRootNode)
|
||||||
{
|
{
|
||||||
// enable the RED, GREEN and ALPHA channels
|
// enable the RED, GREEN and ALPHA channels
|
||||||
g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
|
g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
|
||||||
|
@ -1513,7 +1513,7 @@ int CDisplay::SetupStereoView()
|
||||||
int CDisplay::RenderStereoView(const aiMatrix4x4& m)
|
int CDisplay::RenderStereoView(const aiMatrix4x4& m)
|
||||||
{
|
{
|
||||||
// and rerender the scene
|
// and rerender the scene
|
||||||
if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode)
|
if (nullptr != g_pcAsset && nullptr != g_pcAsset->pcScene->mRootNode)
|
||||||
{
|
{
|
||||||
// enable the BLUE, GREEN and ALPHA channels
|
// enable the BLUE, GREEN and ALPHA channels
|
||||||
g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
|
g_piDevice->SetRenderState(D3DRS_COLORWRITEENABLE,
|
||||||
|
@ -1522,7 +1522,7 @@ int CDisplay::RenderStereoView(const aiMatrix4x4& m)
|
||||||
D3DCOLORWRITEENABLE_BLUE);
|
D3DCOLORWRITEENABLE_BLUE);
|
||||||
|
|
||||||
// clear the z-buffer
|
// clear the z-buffer
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER,0,1.0f,0);
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_ZBUFFER,0,1.0f,0);
|
||||||
|
|
||||||
// move the camera a little bit to the right
|
// move the camera a little bit to the right
|
||||||
g_sCamera.vPos += g_sCamera.vRight * 0.06f;
|
g_sCamera.vPos += g_sCamera.vRight * 0.06f;
|
||||||
|
@ -1751,7 +1751,7 @@ int CDisplay::RenderFullScene()
|
||||||
|
|
||||||
// draw all opaque objects in the scene
|
// draw all opaque objects in the scene
|
||||||
aiMatrix4x4 m;
|
aiMatrix4x4 m;
|
||||||
if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode)
|
if (nullptr != g_pcAsset && nullptr != g_pcAsset->pcScene->mRootNode)
|
||||||
{
|
{
|
||||||
HandleInput();
|
HandleInput();
|
||||||
m = g_mWorld * g_mWorldRotate;
|
m = g_mWorld * g_mWorldRotate;
|
||||||
|
@ -1766,7 +1766,7 @@ int CDisplay::RenderFullScene()
|
||||||
CBackgroundPainter::Instance().OnPostRender();
|
CBackgroundPainter::Instance().OnPostRender();
|
||||||
|
|
||||||
// draw all non-opaque objects in the scene
|
// draw all non-opaque objects in the scene
|
||||||
if (NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode)
|
if (nullptr != g_pcAsset && nullptr != g_pcAsset->pcScene->mRootNode)
|
||||||
{
|
{
|
||||||
// disable the z-buffer
|
// disable the z-buffer
|
||||||
if (!g_sOptions.bNoAlphaBlending) {
|
if (!g_sOptions.bNoAlphaBlending) {
|
||||||
|
@ -1784,7 +1784,7 @@ int CDisplay::RenderFullScene()
|
||||||
RenderStereoView(m);
|
RenderStereoView(m);
|
||||||
|
|
||||||
// render the skeleton if necessary
|
// render the skeleton if necessary
|
||||||
if (g_sOptions.bSkeleton && NULL != g_pcAsset && NULL != g_pcAsset->pcScene->mRootNode) {
|
if (g_sOptions.bSkeleton && nullptr != g_pcAsset && nullptr != g_pcAsset->pcScene->mRootNode) {
|
||||||
// disable the z-buffer
|
// disable the z-buffer
|
||||||
g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE);
|
g_piDevice->SetRenderState(D3DRS_ZWRITEENABLE,FALSE);
|
||||||
|
|
||||||
|
@ -1795,11 +1795,11 @@ int CDisplay::RenderFullScene()
|
||||||
g_piDevice->SetVertexDeclaration( gDefaultVertexDecl);
|
g_piDevice->SetVertexDeclaration( gDefaultVertexDecl);
|
||||||
// this is very similar to the code in SetupMaterial()
|
// this is very similar to the code in SetupMaterial()
|
||||||
ID3DXEffect* piEnd = g_piNormalsEffect;
|
ID3DXEffect* piEnd = g_piNormalsEffect;
|
||||||
aiMatrix4x4 pcProj = m * mViewProjection;
|
aiMatrix4x4 pcProj2 = m * mViewProjection;
|
||||||
|
|
||||||
D3DXVECTOR4 vVector(1.f,0.f,0.f,1.f);
|
D3DXVECTOR4 vVector(1.f,0.f,0.f,1.f);
|
||||||
piEnd->SetVector("OUTPUT_COLOR",&vVector);
|
piEnd->SetVector("OUTPUT_COLOR",&vVector);
|
||||||
piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj);
|
piEnd->SetMatrix("WorldViewProjection", (const D3DXMATRIX*)&pcProj2);
|
||||||
|
|
||||||
UINT dwPasses = 0;
|
UINT dwPasses = 0;
|
||||||
piEnd->Begin(&dwPasses,0);
|
piEnd->Begin(&dwPasses,0);
|
||||||
|
@ -2098,14 +2098,14 @@ int CDisplay::RenderPatternBG()
|
||||||
{
|
{
|
||||||
// seems we have not yet compiled this shader.
|
// seems we have not yet compiled this shader.
|
||||||
// and NOW is the best time to do that ...
|
// and NOW is the best time to do that ...
|
||||||
ID3DXBuffer* piBuffer = NULL;
|
ID3DXBuffer* piBuffer = nullptr;
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szCheckerBackgroundShader.c_str(),
|
g_szCheckerBackgroundShader.c_str(),
|
||||||
(UINT)g_szCheckerBackgroundShader.length(),
|
(UINT)g_szCheckerBackgroundShader.length(),
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
D3DXSHADER_USE_LEGACY_D3DX9_31_DLL,
|
D3DXSHADER_USE_LEGACY_D3DX9_31_DLL,
|
||||||
NULL,
|
nullptr,
|
||||||
&g_piPatternEffect,&piBuffer)))
|
&g_piPatternEffect,&piBuffer)))
|
||||||
{
|
{
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
|
@ -2118,7 +2118,7 @@ int CDisplay::RenderPatternBG()
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
piBuffer->Release();
|
piBuffer->Release();
|
||||||
piBuffer = NULL;
|
piBuffer = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2126,14 +2126,14 @@ int CDisplay::RenderPatternBG()
|
||||||
// clear the color buffer in magenta
|
// clear the color buffer in magenta
|
||||||
// (hopefully this is ugly enough that every ps_2_0 cards owner
|
// (hopefully this is ugly enough that every ps_2_0 cards owner
|
||||||
// runs to the next shop to buy himself a new card ...)
|
// runs to the next shop to buy himself a new card ...)
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the depth buffer only
|
// clear the depth buffer only
|
||||||
g_piDevice->Clear(0,NULL,D3DCLEAR_ZBUFFER,
|
g_piDevice->Clear(0,nullptr,D3DCLEAR_ZBUFFER,
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0xFF), 1.0f,0 );
|
||||||
|
|
||||||
// setup the colors to be used ...
|
// setup the colors to be used ...
|
||||||
|
|
|
@ -53,8 +53,8 @@ INT_PTR CALLBACK HelpDialogProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM ) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
// load the help file ...
|
// load the help file ...
|
||||||
HRSRC res = FindResource(NULL,MAKEINTRESOURCE(IDR_TEXT1),"TEXT");
|
HRSRC res = FindResource(nullptr,MAKEINTRESOURCE(IDR_TEXT1),"TEXT");
|
||||||
HGLOBAL hg = LoadResource(NULL,res);
|
HGLOBAL hg = LoadResource(nullptr,res);
|
||||||
void* pData = LockResource(hg);
|
void* pData = LockResource(hg);
|
||||||
|
|
||||||
SETTEXTEX sInfo;
|
SETTEXTEX sInfo;
|
||||||
|
|
|
@ -117,29 +117,29 @@ void CLogDisplay::OnRender() {
|
||||||
sCopy.top = sWndRect.top+1;
|
sCopy.top = sWndRect.top+1;
|
||||||
sCopy.bottom = sWndRect.bottom+1;
|
sCopy.bottom = sWndRect.bottom+1;
|
||||||
sCopy.right = sWndRect.right+1;
|
sCopy.right = sWndRect.right+1;
|
||||||
this->piFont->DrawText(NULL,szText ,
|
this->piFont->DrawText(nullptr,szText ,
|
||||||
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
||||||
sCopy.left = sWndRect.left+1;
|
sCopy.left = sWndRect.left+1;
|
||||||
sCopy.top = sWndRect.top+1;
|
sCopy.top = sWndRect.top+1;
|
||||||
sCopy.bottom = sWndRect.bottom-1;
|
sCopy.bottom = sWndRect.bottom-1;
|
||||||
sCopy.right = sWndRect.right-1;
|
sCopy.right = sWndRect.right-1;
|
||||||
this->piFont->DrawText(NULL,szText ,
|
this->piFont->DrawText(nullptr,szText ,
|
||||||
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
||||||
sCopy.left = sWndRect.left-1;
|
sCopy.left = sWndRect.left-1;
|
||||||
sCopy.top = sWndRect.top-1;
|
sCopy.top = sWndRect.top-1;
|
||||||
sCopy.bottom = sWndRect.bottom+1;
|
sCopy.bottom = sWndRect.bottom+1;
|
||||||
sCopy.right = sWndRect.right+1;
|
sCopy.right = sWndRect.right+1;
|
||||||
this->piFont->DrawText(NULL,szText ,
|
this->piFont->DrawText(nullptr,szText ,
|
||||||
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
||||||
sCopy.left = sWndRect.left-1;
|
sCopy.left = sWndRect.left-1;
|
||||||
sCopy.top = sWndRect.top-1;
|
sCopy.top = sWndRect.top-1;
|
||||||
sCopy.bottom = sWndRect.bottom-1;
|
sCopy.bottom = sWndRect.bottom-1;
|
||||||
sCopy.right = sWndRect.right-1;
|
sCopy.right = sWndRect.right-1;
|
||||||
this->piFont->DrawText(NULL,szText ,
|
this->piFont->DrawText(nullptr,szText ,
|
||||||
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
-1,&sCopy,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(100,0x0,0x0,0x0));
|
||||||
|
|
||||||
// text
|
// text
|
||||||
this->piFont->DrawText(NULL,szText ,
|
this->piFont->DrawText(nullptr,szText ,
|
||||||
-1,&sWndRect,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0xFF));
|
-1,&sWndRect,DT_CENTER | DT_VCENTER,D3DCOLOR_ARGB(0xFF,0xFF,0xFF,0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void CLogDisplay::OnRender() {
|
||||||
sCopy.top = sRect.top+1;
|
sCopy.top = sRect.top+1;
|
||||||
sCopy.bottom = sRect.bottom+1;
|
sCopy.bottom = sRect.bottom+1;
|
||||||
sCopy.right = sRect.right+1;
|
sCopy.right = sRect.right+1;
|
||||||
this->piFont->DrawText(NULL,szText,
|
this->piFont->DrawText(nullptr,szText,
|
||||||
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
||||||
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void CLogDisplay::OnRender() {
|
||||||
sCopy.top = sRect.top-1;
|
sCopy.top = sRect.top-1;
|
||||||
sCopy.bottom = sRect.bottom-1;
|
sCopy.bottom = sRect.bottom-1;
|
||||||
sCopy.right = sRect.right-1;
|
sCopy.right = sRect.right-1;
|
||||||
this->piFont->DrawText(NULL,szText,
|
this->piFont->DrawText(nullptr,szText,
|
||||||
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
||||||
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ void CLogDisplay::OnRender() {
|
||||||
sCopy.top = sRect.top-1;
|
sCopy.top = sRect.top-1;
|
||||||
sCopy.bottom = sRect.bottom+1;
|
sCopy.bottom = sRect.bottom+1;
|
||||||
sCopy.right = sRect.right+1;
|
sCopy.right = sRect.right+1;
|
||||||
this->piFont->DrawText(NULL,szText,
|
this->piFont->DrawText(nullptr,szText,
|
||||||
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
||||||
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
||||||
|
|
||||||
|
@ -200,12 +200,12 @@ void CLogDisplay::OnRender() {
|
||||||
sCopy.top = sRect.top+1;
|
sCopy.top = sRect.top+1;
|
||||||
sCopy.bottom = sRect.bottom-1;
|
sCopy.bottom = sRect.bottom-1;
|
||||||
sCopy.right = sRect.right-1;
|
sCopy.right = sRect.right-1;
|
||||||
this->piFont->DrawText(NULL,szText,
|
this->piFont->DrawText(nullptr,szText,
|
||||||
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
-1,&sCopy,DT_RIGHT | DT_TOP,D3DCOLOR_ARGB(
|
||||||
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
(unsigned char)(fAlpha * 100.0f),0x0,0x0,0x0));
|
||||||
|
|
||||||
// draw the text itself
|
// draw the text itself
|
||||||
int iPX = this->piFont->DrawText(NULL,szText,
|
int iPX = this->piFont->DrawText(nullptr,szText,
|
||||||
-1,&sRect,DT_RIGHT | DT_TOP,clrColor);
|
-1,&sRect,DT_RIGHT | DT_TOP,clrColor);
|
||||||
|
|
||||||
sRect.top += iPX;
|
sRect.top += iPX;
|
||||||
|
|
|
@ -70,7 +70,7 @@ static const char* AI_VIEW_RTF_LOG_HEADER =
|
||||||
// Message procedure for the log window
|
// Message procedure for the log window
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
|
INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
|
||||||
WPARAM wParam,LPARAM lParam)
|
WPARAM /*wParam*/,LPARAM lParam)
|
||||||
{
|
{
|
||||||
(void)lParam;
|
(void)lParam;
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
|
@ -86,7 +86,7 @@ INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
|
||||||
int x = LOWORD(lParam);
|
int x = LOWORD(lParam);
|
||||||
int y = HIWORD(lParam);
|
int y = HIWORD(lParam);
|
||||||
|
|
||||||
SetWindowPos(GetDlgItem(hwndDlg,IDC_EDIT1),NULL,0,0,
|
SetWindowPos(GetDlgItem(hwndDlg,IDC_EDIT1),nullptr,0,0,
|
||||||
x-10,y-12,SWP_NOMOVE|SWP_NOZORDER);
|
x-10,y-12,SWP_NOMOVE|SWP_NOZORDER);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -103,7 +103,7 @@ INT_PTR CALLBACK LogDialogProc(HWND hwndDlg,UINT uMsg,
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
void CLogWindow::Init () {
|
void CLogWindow::Init () {
|
||||||
this->hwnd = ::CreateDialog(g_hInstance,MAKEINTRESOURCE(IDD_LOGVIEW),
|
this->hwnd = ::CreateDialog(g_hInstance,MAKEINTRESOURCE(IDD_LOGVIEW),
|
||||||
NULL,&LogDialogProc);
|
nullptr,&LogDialogProc);
|
||||||
|
|
||||||
if (!this->hwnd) {
|
if (!this->hwnd) {
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to create logger window",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to create logger window",
|
||||||
|
@ -156,7 +156,7 @@ void CLogWindow::Save() {
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
|
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LogDestination",NULL,NULL,(BYTE*)szFileName,&dwTemp)) {
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LogDestination",nullptr,nullptr,(BYTE*)szFileName,&dwTemp)) {
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
strcpy(szFileName,"");
|
strcpy(szFileName,"");
|
||||||
} else {
|
} else {
|
||||||
|
@ -169,12 +169,12 @@ void CLogWindow::Save() {
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"Log files\0*.txt", NULL, 0, 1,
|
"Log files\0*.txt", nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Save log to file",
|
"Save log to file",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".txt", 0, NULL, NULL
|
0, 1, ".txt", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetSaveFileName(&sFilename1) == 0) return;
|
if(GetSaveFileName(&sFilename1) == 0) return;
|
||||||
|
|
||||||
|
|
|
@ -210,15 +210,15 @@ int CMaterialManager::SetDefaultTexture(IDirect3DTexture9** p_ppiOut)
|
||||||
D3DFMT_A8R8G8B8,
|
D3DFMT_A8R8G8B8,
|
||||||
D3DPOOL_MANAGED,
|
D3DPOOL_MANAGED,
|
||||||
p_ppiOut,
|
p_ppiOut,
|
||||||
NULL)))
|
nullptr)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to create default texture",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to create default texture",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
|
|
||||||
*p_ppiOut = NULL;
|
*p_ppiOut = nullptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
D3DXFillTexture(*p_ppiOut,&FillFunc,NULL);
|
D3DXFillTexture(*p_ppiOut,&FillFunc,nullptr);
|
||||||
sDefaultTexture = *p_ppiOut;
|
sDefaultTexture = *p_ppiOut;
|
||||||
sDefaultTexture->AddRef();
|
sDefaultTexture->AddRef();
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
|
||||||
size_t iLen2 = iLen+1;
|
size_t iLen2 = iLen+1;
|
||||||
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
||||||
memcpy(p_szString->data,szTempB,iLen2);
|
memcpy(p_szString->data,szTempB,iLen2);
|
||||||
p_szString->length = iLen;
|
p_szString->length = static_cast<ai_uint32>(iLen);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
|
||||||
size_t iLen2 = iLen+1;
|
size_t iLen2 = iLen+1;
|
||||||
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
||||||
memcpy(p_szString->data,szTempB,iLen2);
|
memcpy(p_szString->data,szTempB,iLen2);
|
||||||
p_szString->length = iLen;
|
p_szString->length = static_cast<ai_uint32>(iLen);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ bool CMaterialManager::TryLongerPath(char* szTemp,aiString* p_szString)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CMaterialManager::FindValidPath(aiString* p_szString)
|
int CMaterialManager::FindValidPath(aiString* p_szString)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != p_szString);
|
ai_assert(nullptr != p_szString);
|
||||||
aiString pcpy = *p_szString;
|
aiString pcpy = *p_szString;
|
||||||
if ('*' == p_szString->data[0]) {
|
if ('*' == p_szString->data[0]) {
|
||||||
// '*' as first character indicates an embedded file
|
// '*' as first character indicates an embedded file
|
||||||
|
@ -389,10 +389,10 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
|
||||||
if( !q ) q=strrchr( tmp2,'\\' );
|
if( !q ) q=strrchr( tmp2,'\\' );
|
||||||
if( q ){
|
if( q ){
|
||||||
strcpy( q+1,p+1 );
|
strcpy( q+1,p+1 );
|
||||||
if((pFile=fopen( tmp2,"r" ))){
|
if((pFile=fopen( tmp2,"r" )) != nullptr){
|
||||||
fclose( pFile );
|
fclose( pFile );
|
||||||
strcpy(p_szString->data,tmp2);
|
strcpy(p_szString->data,tmp2);
|
||||||
p_szString->length = strlen(tmp2);
|
p_szString->length = static_cast<ai_uint32>(strlen(tmp2));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
|
||||||
size_t iLen2 = iLen+1;
|
size_t iLen2 = iLen+1;
|
||||||
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
||||||
memcpy(p_szString->data,szTemp,iLen2);
|
memcpy(p_szString->data,szTemp,iLen2);
|
||||||
p_szString->length = iLen;
|
p_szString->length = static_cast<ai_uint32>(iLen);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -415,10 +415,10 @@ int CMaterialManager::FindValidPath(aiString* p_szString)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != p_ppiOut);
|
ai_assert(nullptr != p_ppiOut);
|
||||||
ai_assert(NULL != szPath);
|
ai_assert(nullptr != szPath);
|
||||||
|
|
||||||
*p_ppiOut = NULL;
|
*p_ppiOut = nullptr;
|
||||||
|
|
||||||
const std::string s = szPath->data;
|
const std::string s = szPath->data;
|
||||||
TextureCache::iterator ff;
|
TextureCache::iterator ff;
|
||||||
|
@ -453,7 +453,7 @@ int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
&info,
|
&info,
|
||||||
NULL,
|
nullptr,
|
||||||
p_ppiOut)))
|
p_ppiOut)))
|
||||||
{
|
{
|
||||||
std::string sz = "[ERROR] Unable to load embedded texture (#1): ";
|
std::string sz = "[ERROR] Unable to load embedded texture (#1): ";
|
||||||
|
@ -470,7 +470,7 @@ int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
||||||
if(FAILED(g_piDevice->CreateTexture(
|
if(FAILED(g_piDevice->CreateTexture(
|
||||||
g_pcAsset->pcScene->mTextures[iIndex]->mWidth,
|
g_pcAsset->pcScene->mTextures[iIndex]->mWidth,
|
||||||
g_pcAsset->pcScene->mTextures[iIndex]->mHeight,
|
g_pcAsset->pcScene->mTextures[iIndex]->mHeight,
|
||||||
0,D3DUSAGE_AUTOGENMIPMAP,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,p_ppiOut,NULL)))
|
0,D3DUSAGE_AUTOGENMIPMAP,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,p_ppiOut,nullptr)))
|
||||||
{
|
{
|
||||||
std::string sz = "[ERROR] Unable to load embedded texture (#2): ";
|
std::string sz = "[ERROR] Unable to load embedded texture (#2): ";
|
||||||
sz.append(szPath->data);
|
sz.append(szPath->data);
|
||||||
|
@ -482,7 +482,7 @@ int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
||||||
|
|
||||||
// now copy the data to it ... (assume non pow2 to be supported)
|
// now copy the data to it ... (assume non pow2 to be supported)
|
||||||
D3DLOCKED_RECT sLock;
|
D3DLOCKED_RECT sLock;
|
||||||
(*p_ppiOut)->LockRect(0,&sLock,NULL,0);
|
(*p_ppiOut)->LockRect(0,&sLock,nullptr,0);
|
||||||
|
|
||||||
const aiTexel* pcData = g_pcAsset->pcScene->mTextures[iIndex]->pcData;
|
const aiTexel* pcData = g_pcAsset->pcScene->mTextures[iIndex]->pcData;
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ int CMaterialManager::LoadTexture(IDirect3DTexture9** p_ppiOut,aiString* szPath)
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
p_ppiOut)))
|
p_ppiOut)))
|
||||||
{
|
{
|
||||||
// error ... use the default texture instead
|
// error ... use the default texture instead
|
||||||
|
@ -550,44 +550,44 @@ void CMaterialManager::DeleteMaterial(AssetHelper::MeshHelper* pcIn)
|
||||||
if (pcIn->piDiffuseTexture)
|
if (pcIn->piDiffuseTexture)
|
||||||
{
|
{
|
||||||
pcIn->piDiffuseTexture->Release();
|
pcIn->piDiffuseTexture->Release();
|
||||||
pcIn->piDiffuseTexture = NULL;
|
pcIn->piDiffuseTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piSpecularTexture)
|
if (pcIn->piSpecularTexture)
|
||||||
{
|
{
|
||||||
pcIn->piSpecularTexture->Release();
|
pcIn->piSpecularTexture->Release();
|
||||||
pcIn->piSpecularTexture = NULL;
|
pcIn->piSpecularTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piEmissiveTexture)
|
if (pcIn->piEmissiveTexture)
|
||||||
{
|
{
|
||||||
pcIn->piEmissiveTexture->Release();
|
pcIn->piEmissiveTexture->Release();
|
||||||
pcIn->piEmissiveTexture = NULL;
|
pcIn->piEmissiveTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piAmbientTexture)
|
if (pcIn->piAmbientTexture)
|
||||||
{
|
{
|
||||||
pcIn->piAmbientTexture->Release();
|
pcIn->piAmbientTexture->Release();
|
||||||
pcIn->piAmbientTexture = NULL;
|
pcIn->piAmbientTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piOpacityTexture)
|
if (pcIn->piOpacityTexture)
|
||||||
{
|
{
|
||||||
pcIn->piOpacityTexture->Release();
|
pcIn->piOpacityTexture->Release();
|
||||||
pcIn->piOpacityTexture = NULL;
|
pcIn->piOpacityTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piNormalTexture)
|
if (pcIn->piNormalTexture)
|
||||||
{
|
{
|
||||||
pcIn->piNormalTexture->Release();
|
pcIn->piNormalTexture->Release();
|
||||||
pcIn->piNormalTexture = NULL;
|
pcIn->piNormalTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piShininessTexture)
|
if (pcIn->piShininessTexture)
|
||||||
{
|
{
|
||||||
pcIn->piShininessTexture->Release();
|
pcIn->piShininessTexture->Release();
|
||||||
pcIn->piShininessTexture = NULL;
|
pcIn->piShininessTexture = nullptr;
|
||||||
}
|
}
|
||||||
if (pcIn->piLightmapTexture)
|
if (pcIn->piLightmapTexture)
|
||||||
{
|
{
|
||||||
pcIn->piLightmapTexture->Release();
|
pcIn->piLightmapTexture->Release();
|
||||||
pcIn->piLightmapTexture = NULL;
|
pcIn->piLightmapTexture = nullptr;
|
||||||
}
|
}
|
||||||
pcIn->piEffect = NULL;
|
pcIn->piEffect = nullptr;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
void CMaterialManager::HMtoNMIfNecessary(
|
void CMaterialManager::HMtoNMIfNecessary(
|
||||||
|
@ -595,8 +595,8 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
IDirect3DTexture9** piTextureOut,
|
IDirect3DTexture9** piTextureOut,
|
||||||
bool bWasOriginallyHM)
|
bool bWasOriginallyHM)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != piTexture);
|
ai_assert(nullptr != piTexture);
|
||||||
ai_assert(NULL != piTextureOut);
|
ai_assert(nullptr != piTextureOut);
|
||||||
|
|
||||||
bool bMustConvert = false;
|
bool bMustConvert = false;
|
||||||
uintptr_t iElement = 3;
|
uintptr_t iElement = 3;
|
||||||
|
@ -617,7 +617,7 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
D3DLOCKED_RECT sRect;
|
D3DLOCKED_RECT sRect;
|
||||||
D3DSURFACE_DESC sDesc;
|
D3DSURFACE_DESC sDesc;
|
||||||
piTexture->GetLevelDesc(0,&sDesc);
|
piTexture->GetLevelDesc(0,&sDesc);
|
||||||
if (FAILED(piTexture->LockRect(0,&sRect,NULL,D3DLOCK_READONLY)))
|
if (FAILED(piTexture->LockRect(0,&sRect,nullptr,D3DLOCK_READONLY)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -627,7 +627,7 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct {unsigned char b,g,r,a;};
|
struct {unsigned char b,g,r,a;} data;
|
||||||
char _array[4];
|
char _array[4];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -646,7 +646,7 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
{
|
{
|
||||||
for (unsigned int x = 0; x < sDesc.Width;++x)
|
for (unsigned int x = 0; x < sDesc.Width;++x)
|
||||||
{
|
{
|
||||||
if (pcPointer->b != pcPointer->r || pcPointer->b != pcPointer->g)
|
if (pcPointer->data.b != pcPointer->data.r || pcPointer->data.b != pcPointer->data.g)
|
||||||
{
|
{
|
||||||
bIsEqual = false;
|
bIsEqual = false;
|
||||||
break;
|
break;
|
||||||
|
@ -705,9 +705,9 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
aiColor3D clrColorLine;
|
aiColor3D clrColorLine;
|
||||||
for (unsigned int x = 0; x < sDesc.Width;++x)
|
for (unsigned int x = 0; x < sDesc.Width;++x)
|
||||||
{
|
{
|
||||||
clrColorLine.r += pcPointer->r;
|
clrColorLine.r += pcPointer->data.r;
|
||||||
clrColorLine.g += pcPointer->g;
|
clrColorLine.g += pcPointer->data.g;
|
||||||
clrColorLine.b += pcPointer->b;
|
clrColorLine.b += pcPointer->data.b;
|
||||||
pcPointer++;
|
pcPointer++;
|
||||||
}
|
}
|
||||||
clrColor.r += clrColorLine.r /= (float)sDesc.Width;
|
clrColor.r += clrColorLine.r /= (float)sDesc.Width;
|
||||||
|
@ -739,17 +739,17 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
// need to convert it NOW
|
// need to convert it NOW
|
||||||
if (bMustConvert)
|
if (bMustConvert)
|
||||||
{
|
{
|
||||||
D3DSURFACE_DESC sDesc;
|
D3DSURFACE_DESC sDesc2;
|
||||||
piTexture->GetLevelDesc(0, &sDesc);
|
piTexture->GetLevelDesc(0, &sDesc2);
|
||||||
|
|
||||||
IDirect3DTexture9* piTempTexture;
|
IDirect3DTexture9* piTempTexture;
|
||||||
if(FAILED(g_piDevice->CreateTexture(
|
if(FAILED(g_piDevice->CreateTexture(
|
||||||
sDesc.Width,
|
sDesc2.Width,
|
||||||
sDesc.Height,
|
sDesc2.Height,
|
||||||
piTexture->GetLevelCount(),
|
piTexture->GetLevelCount(),
|
||||||
sDesc.Usage,
|
sDesc2.Usage,
|
||||||
sDesc.Format,
|
sDesc2.Format,
|
||||||
sDesc.Pool, &piTempTexture, NULL)))
|
sDesc2.Pool, &piTempTexture, nullptr)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry(
|
CLogDisplay::Instance().AddEntry(
|
||||||
"[ERROR] Unable to create normal map texture",
|
"[ERROR] Unable to create normal map texture",
|
||||||
|
@ -764,7 +764,7 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
else /*if (0 == iElement)*/dwFlags = D3DX_CHANNEL_BLUE;
|
else /*if (0 == iElement)*/dwFlags = D3DX_CHANNEL_BLUE;
|
||||||
|
|
||||||
if(FAILED(D3DXComputeNormalMap(piTempTexture,
|
if(FAILED(D3DXComputeNormalMap(piTempTexture,
|
||||||
piTexture,NULL,0,dwFlags,1.0f)))
|
piTexture,nullptr,0,dwFlags,1.0f)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry(
|
CLogDisplay::Instance().AddEntry(
|
||||||
"[ERROR] Unable to compute normal map from height map",
|
"[ERROR] Unable to compute normal map from height map",
|
||||||
|
@ -780,12 +780,12 @@ void CMaterialManager::HMtoNMIfNecessary(
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
bool CMaterialManager::HasAlphaPixels(IDirect3DTexture9* piTexture)
|
bool CMaterialManager::HasAlphaPixels(IDirect3DTexture9* piTexture)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != piTexture);
|
ai_assert(nullptr != piTexture);
|
||||||
|
|
||||||
D3DLOCKED_RECT sRect;
|
D3DLOCKED_RECT sRect;
|
||||||
D3DSURFACE_DESC sDesc;
|
D3DSURFACE_DESC sDesc;
|
||||||
piTexture->GetLevelDesc(0,&sDesc);
|
piTexture->GetLevelDesc(0,&sDesc);
|
||||||
if (FAILED(piTexture->LockRect(0,&sRect,NULL,D3DLOCK_READONLY)))
|
if (FAILED(piTexture->LockRect(0,&sRect,nullptr,D3DLOCK_READONLY)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -823,8 +823,8 @@ bool CMaterialManager::HasAlphaPixels(IDirect3DTexture9* piTexture)
|
||||||
int CMaterialManager::CreateMaterial(
|
int CMaterialManager::CreateMaterial(
|
||||||
AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource)
|
AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcMesh);
|
ai_assert(nullptr != pcMesh);
|
||||||
ai_assert(NULL != pcSource);
|
ai_assert(nullptr != pcSource);
|
||||||
|
|
||||||
ID3DXBuffer* piBuffer;
|
ID3DXBuffer* piBuffer;
|
||||||
|
|
||||||
|
@ -1060,29 +1060,29 @@ int CMaterialManager::CreateMaterial(
|
||||||
}
|
}
|
||||||
AssetHelper::MeshHelper* pc = g_pcAsset->apcMeshes[i];
|
AssetHelper::MeshHelper* pc = g_pcAsset->apcMeshes[i];
|
||||||
|
|
||||||
if ((pcMesh->piDiffuseTexture != NULL ? true : false) !=
|
if ((pcMesh->piDiffuseTexture != nullptr ? true : false) !=
|
||||||
(pc->piDiffuseTexture != NULL ? true : false))
|
(pc->piDiffuseTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piSpecularTexture != NULL ? true : false) !=
|
if ((pcMesh->piSpecularTexture != nullptr ? true : false) !=
|
||||||
(pc->piSpecularTexture != NULL ? true : false))
|
(pc->piSpecularTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piAmbientTexture != NULL ? true : false) !=
|
if ((pcMesh->piAmbientTexture != nullptr ? true : false) !=
|
||||||
(pc->piAmbientTexture != NULL ? true : false))
|
(pc->piAmbientTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piEmissiveTexture != NULL ? true : false) !=
|
if ((pcMesh->piEmissiveTexture != nullptr ? true : false) !=
|
||||||
(pc->piEmissiveTexture != NULL ? true : false))
|
(pc->piEmissiveTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piNormalTexture != NULL ? true : false) !=
|
if ((pcMesh->piNormalTexture != nullptr ? true : false) !=
|
||||||
(pc->piNormalTexture != NULL ? true : false))
|
(pc->piNormalTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piOpacityTexture != NULL ? true : false) !=
|
if ((pcMesh->piOpacityTexture != nullptr ? true : false) !=
|
||||||
(pc->piOpacityTexture != NULL ? true : false))
|
(pc->piOpacityTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piShininessTexture != NULL ? true : false) !=
|
if ((pcMesh->piShininessTexture != nullptr ? true : false) !=
|
||||||
(pc->piShininessTexture != NULL ? true : false))
|
(pc->piShininessTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->piLightmapTexture != NULL ? true : false) !=
|
if ((pcMesh->piLightmapTexture != nullptr ? true : false) !=
|
||||||
(pc->piLightmapTexture != NULL ? true : false))
|
(pc->piLightmapTexture != nullptr ? true : false))
|
||||||
continue;
|
continue;
|
||||||
if ((pcMesh->eShadingMode != aiShadingMode_Gouraud ? true : false) !=
|
if ((pcMesh->eShadingMode != aiShadingMode_Gouraud ? true : false) !=
|
||||||
(pc->eShadingMode != aiShadingMode_Gouraud ? true : false))
|
(pc->eShadingMode != aiShadingMode_Gouraud ? true : false))
|
||||||
|
@ -1239,13 +1239,13 @@ int CMaterialManager::CreateMaterial(
|
||||||
sMacro[iCurrent].Definition = "1";
|
sMacro[iCurrent].Definition = "1";
|
||||||
++iCurrent;
|
++iCurrent;
|
||||||
}
|
}
|
||||||
sMacro[iCurrent].Name = NULL;
|
sMacro[iCurrent].Name = nullptr;
|
||||||
sMacro[iCurrent].Definition = NULL;
|
sMacro[iCurrent].Definition = nullptr;
|
||||||
|
|
||||||
// compile the shader
|
// compile the shader
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szMaterialShader.c_str(),(UINT)g_szMaterialShader.length(),
|
g_szMaterialShader.c_str(),(UINT)g_szMaterialShader.length(),
|
||||||
(const D3DXMACRO*)sMacro,NULL,0,NULL,&pcMesh->piEffect,&piBuffer)))
|
(const D3DXMACRO*)sMacro,nullptr,0,nullptr,&pcMesh->piEffect,&piBuffer)))
|
||||||
{
|
{
|
||||||
// failed to compile the shader
|
// failed to compile the shader
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
|
@ -1333,7 +1333,7 @@ int CMaterialManager::SetupMaterial (
|
||||||
const aiMatrix4x4& pcCam,
|
const aiMatrix4x4& pcCam,
|
||||||
const aiVector3D& vPos)
|
const aiVector3D& vPos)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcMesh);
|
ai_assert(nullptr != pcMesh);
|
||||||
if (!pcMesh->piEffect)return 0;
|
if (!pcMesh->piEffect)return 0;
|
||||||
|
|
||||||
ID3DXEffect* piEnd = pcMesh->piEffect;
|
ID3DXEffect* piEnd = pcMesh->piEffect;
|
||||||
|
@ -1476,7 +1476,7 @@ int CMaterialManager::SetupMaterial (
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CMaterialManager::EndMaterial (AssetHelper::MeshHelper* pcMesh)
|
int CMaterialManager::EndMaterial (AssetHelper::MeshHelper* pcMesh)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcMesh);
|
ai_assert(nullptr != pcMesh);
|
||||||
if (!pcMesh->piEffect)return 0;
|
if (!pcMesh->piEffect)return 0;
|
||||||
|
|
||||||
// end the effect
|
// end the effect
|
||||||
|
|
|
@ -60,13 +60,13 @@ using namespace Assimp;
|
||||||
COLORREF g_aclCustomColors[16] = {0};
|
COLORREF g_aclCustomColors[16] = {0};
|
||||||
|
|
||||||
// Global registry key
|
// Global registry key
|
||||||
HKEY g_hRegistry = NULL;
|
HKEY g_hRegistry = nullptr;
|
||||||
|
|
||||||
// list of previous files (always 5)
|
// list of previous files (always 5)
|
||||||
std::vector<std::string> g_aPreviousFiles;
|
std::vector<std::string> g_aPreviousFiles;
|
||||||
|
|
||||||
// history menu item
|
// history menu item
|
||||||
HMENU g_hHistoryMenu = NULL;
|
HMENU g_hHistoryMenu = nullptr;
|
||||||
|
|
||||||
float g_fACMR = 3.0f;
|
float g_fACMR = 3.0f;
|
||||||
|
|
||||||
|
@ -89,10 +89,10 @@ void MakeFileAssociations() {
|
||||||
char szTemp2[MAX_PATH];
|
char szTemp2[MAX_PATH];
|
||||||
char szTemp[MAX_PATH + 10];
|
char szTemp[MAX_PATH + 10];
|
||||||
|
|
||||||
GetModuleFileName(NULL,szTemp2,MAX_PATH);
|
GetModuleFileName(nullptr,szTemp2,MAX_PATH);
|
||||||
sprintf(szTemp,"%s %%1",szTemp2);
|
sprintf(szTemp,"%s %%1",szTemp2);
|
||||||
|
|
||||||
HKEY hRegistry = NULL;
|
HKEY hRegistry = nullptr;
|
||||||
|
|
||||||
aiString list, tmp;
|
aiString list, tmp;
|
||||||
aiGetExtensionList(&list);
|
aiGetExtensionList(&list);
|
||||||
|
@ -104,15 +104,15 @@ void MakeFileAssociations() {
|
||||||
ai_assert(sz[0] == '*');
|
ai_assert(sz[0] == '*');
|
||||||
sprintf(buf,"Software\\Classes\\%s",sz+1);
|
sprintf(buf,"Software\\Classes\\%s",sz+1);
|
||||||
|
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,buf,0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
|
RegCreateKeyEx(HKEY_CURRENT_USER,buf,0,nullptr,0,KEY_ALL_ACCESS, nullptr, &hRegistry,nullptr);
|
||||||
RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1);
|
RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)"ASSIMPVIEW_CLASS",(DWORD)strlen("ASSIMPVIEW_CLASS")+1);
|
||||||
RegCloseKey(hRegistry);
|
RegCloseKey(hRegistry);
|
||||||
} while ((sz = strtok(NULL,";")));
|
} while ((sz = strtok(nullptr,";")) != nullptr);
|
||||||
|
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
|
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS",0,nullptr,0,KEY_ALL_ACCESS, nullptr, &hRegistry,nullptr);
|
||||||
RegCloseKey(hRegistry);
|
RegCloseKey(hRegistry);
|
||||||
|
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS\\shell\\open\\command",0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
|
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\Classes\\ASSIMPVIEW_CLASS\\shell\\open\\command",0,nullptr,0,KEY_ALL_ACCESS, nullptr, &hRegistry,nullptr);
|
||||||
RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)szTemp,(DWORD)strlen(szTemp)+1);
|
RegSetValueEx(hRegistry,"",0,REG_SZ,(const BYTE*)szTemp,(DWORD)strlen(szTemp)+1);
|
||||||
RegCloseKey(hRegistry);
|
RegCloseKey(hRegistry);
|
||||||
|
|
||||||
|
@ -157,9 +157,9 @@ void HandleCommandLine(char* p_szCommand) {
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
void LoadLightColors() {
|
void LoadLightColors() {
|
||||||
DWORD dwTemp = 4;
|
DWORD dwTemp = 4;
|
||||||
RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, (BYTE*)&g_avLightColors[0],&dwTemp);
|
RegQueryValueEx(g_hRegistry,"LightColor0",nullptr,nullptr, (BYTE*)&g_avLightColors[0],&dwTemp);
|
||||||
RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, (BYTE*)&g_avLightColors[1],&dwTemp);
|
RegQueryValueEx(g_hRegistry,"LightColor1",nullptr,nullptr, (BYTE*)&g_avLightColors[1],&dwTemp);
|
||||||
RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL, (BYTE*)&g_avLightColors[2],&dwTemp);
|
RegQueryValueEx(g_hRegistry,"LightColor2",nullptr,nullptr, (BYTE*)&g_avLightColors[2],&dwTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -190,10 +190,10 @@ void SaveCheckerPatternColors() {
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
void LoadCheckerPatternColors() {
|
void LoadCheckerPatternColors() {
|
||||||
DWORD dwTemp = sizeof(D3DXVECTOR3);
|
DWORD dwTemp = sizeof(D3DXVECTOR3);
|
||||||
RegQueryValueEx(g_hRegistry,"CheckerPattern0",NULL,NULL,
|
RegQueryValueEx(g_hRegistry,"CheckerPattern0",nullptr,nullptr,
|
||||||
(BYTE*) /* jep, this is evil */ CDisplay::Instance().GetFirstCheckerColor(),&dwTemp);
|
(BYTE*) /* jep, this is evil */ CDisplay::Instance().GetFirstCheckerColor(),&dwTemp);
|
||||||
|
|
||||||
RegQueryValueEx(g_hRegistry,"CheckerPattern1",NULL,NULL,
|
RegQueryValueEx(g_hRegistry,"CheckerPattern1",nullptr,nullptr,
|
||||||
(BYTE*) /* jep, this is evil */ CDisplay::Instance().GetSecondCheckerColor(),&dwTemp);
|
(BYTE*) /* jep, this is evil */ CDisplay::Instance().GetSecondCheckerColor(),&dwTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,13 +372,13 @@ void ToggleUIState() {
|
||||||
sRect2.top -= sRect.top;
|
sRect2.top -= sRect.top;
|
||||||
|
|
||||||
if (BST_UNCHECKED == IsDlgButtonChecked(g_hDlg,IDC_BLUBB)) {
|
if (BST_UNCHECKED == IsDlgButtonChecked(g_hDlg,IDC_BLUBB)) {
|
||||||
SetWindowPos(g_hDlg,NULL,0,0,sRect.right-214,sRect.bottom,
|
SetWindowPos(g_hDlg,nullptr,0,0,sRect.right-214,sRect.bottom,
|
||||||
SWP_NOMOVE | SWP_NOZORDER);
|
SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
SetWindowText(GetDlgItem(g_hDlg,IDC_BLUBB),">>");
|
SetWindowText(GetDlgItem(g_hDlg,IDC_BLUBB),">>");
|
||||||
storeRegKey(false, "MultiSampling");
|
storeRegKey(false, "MultiSampling");
|
||||||
} else {
|
} else {
|
||||||
SetWindowPos(g_hDlg,NULL,0,0,sRect.right+214,sRect.bottom,
|
SetWindowPos(g_hDlg,nullptr,0,0,sRect.right+214,sRect.bottom,
|
||||||
SWP_NOMOVE | SWP_NOZORDER);
|
SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
storeRegKey(true, "LastUIState");
|
storeRegKey(true, "LastUIState");
|
||||||
|
@ -394,7 +394,7 @@ void LoadBGTexture() {
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
|
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"TextureSrc",NULL,NULL, (BYTE*)szFileName,&dwTemp)) {
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"TextureSrc",nullptr,nullptr, (BYTE*)szFileName,&dwTemp)) {
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
strcpy(szFileName,"");
|
strcpy(szFileName,"");
|
||||||
} else {
|
} else {
|
||||||
|
@ -407,13 +407,13 @@ void LoadBGTexture() {
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"Textures\0*.png;*.dds;*.tga;*.bmp;*.tif;*.ppm;*.ppx;*.jpg;*.jpeg;*.exr\0*.*\0",
|
"Textures\0*.png;*.dds;*.tga;*.bmp;*.tif;*.ppm;*.ppx;*.jpg;*.jpeg;*.exr\0*.*\0",
|
||||||
NULL, 0, 1,
|
nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Open texture as background",
|
"Open texture as background",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".jpg", 0, NULL, NULL
|
0, 1, ".jpg", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetOpenFileName(&sFilename1) == 0) return;
|
if(GetOpenFileName(&sFilename1) == 0) return;
|
||||||
|
|
||||||
|
@ -448,8 +448,8 @@ void DisplayColorDialog(D3DCOLOR* pclrResult) {
|
||||||
clr.Flags = CC_RGBINIT | CC_FULLOPEN;
|
clr.Flags = CC_RGBINIT | CC_FULLOPEN;
|
||||||
clr.rgbResult = RGB((*pclrResult >> 16) & 0xff,(*pclrResult >> 8) & 0xff,*pclrResult & 0xff);
|
clr.rgbResult = RGB((*pclrResult >> 16) & 0xff,(*pclrResult >> 8) & 0xff,*pclrResult & 0xff);
|
||||||
clr.lpCustColors = g_aclCustomColors;
|
clr.lpCustColors = g_aclCustomColors;
|
||||||
clr.lpfnHook = NULL;
|
clr.lpfnHook = nullptr;
|
||||||
clr.lpTemplateName = NULL;
|
clr.lpTemplateName = nullptr;
|
||||||
clr.lCustData = 0;
|
clr.lCustData = 0;
|
||||||
|
|
||||||
ChooseColor(&clr);
|
ChooseColor(&clr);
|
||||||
|
@ -472,8 +472,8 @@ void DisplayColorDialog(D3DXVECTOR4* pclrResult) {
|
||||||
clamp<unsigned char>(pclrResult->y * 255.0f),
|
clamp<unsigned char>(pclrResult->y * 255.0f),
|
||||||
clamp<unsigned char>(pclrResult->z * 255.0f));
|
clamp<unsigned char>(pclrResult->z * 255.0f));
|
||||||
clr.lpCustColors = g_aclCustomColors;
|
clr.lpCustColors = g_aclCustomColors;
|
||||||
clr.lpfnHook = NULL;
|
clr.lpfnHook = nullptr;
|
||||||
clr.lpTemplateName = NULL;
|
clr.lpTemplateName = nullptr;
|
||||||
clr.lCustData = 0;
|
clr.lCustData = 0;
|
||||||
|
|
||||||
ChooseColor(&clr);
|
ChooseColor(&clr);
|
||||||
|
@ -504,7 +504,7 @@ void LoadSkybox() {
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
|
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"SkyBoxSrc",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"SkyBoxSrc",nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp))
|
(BYTE*)szFileName,&dwTemp))
|
||||||
{
|
{
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
|
@ -521,12 +521,12 @@ void LoadSkybox() {
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"Skyboxes\0*.dds\0*.*\0", NULL, 0, 1,
|
"Skyboxes\0*.dds\0*.*\0", nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Open skybox as background",
|
"Open skybox as background",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".dds", 0, NULL, NULL
|
0, 1, ".dds", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetOpenFileName(&sFilename1) == 0) return;
|
if(GetOpenFileName(&sFilename1) == 0) return;
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ void SaveScreenshot() {
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
|
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"ScreenShot",NULL,NULL, (BYTE*)szFileName,&dwTemp)) {
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"ScreenShot",nullptr,nullptr, (BYTE*)szFileName,&dwTemp)) {
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
strcpy(szFileName,"");
|
strcpy(szFileName,"");
|
||||||
} else {
|
} else {
|
||||||
|
@ -568,21 +568,21 @@ void SaveScreenshot() {
|
||||||
}
|
}
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
"PNG Images\0*.png", NULL, 0, 1,
|
"PNG Images\0*.png", nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Save Screenshot to file",
|
"Save Screenshot to file",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ".png", 0, NULL, NULL
|
0, 1, ".png", 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(GetSaveFileName(&sFilename1) == 0) return;
|
if(GetSaveFileName(&sFilename1) == 0) return;
|
||||||
|
|
||||||
// Now store the file in the registry
|
// Now store the file in the registry
|
||||||
RegSetValueExA(g_hRegistry,"ScreenShot",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH);
|
RegSetValueExA(g_hRegistry,"ScreenShot",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH);
|
||||||
|
|
||||||
IDirect3DSurface9* pi = NULL;
|
IDirect3DSurface9* pi = nullptr;
|
||||||
g_piDevice->GetRenderTarget(0,&pi);
|
g_piDevice->GetRenderTarget(0,&pi);
|
||||||
if(!pi || FAILED(D3DXSaveSurfaceToFile(szFileName,D3DXIFF_PNG,pi,NULL,NULL))) {
|
if(!pi || FAILED(D3DXSaveSurfaceToFile(szFileName,D3DXIFF_PNG,pi,nullptr,nullptr))) {
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to save screenshot",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to save screenshot",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
} else {
|
} else {
|
||||||
|
@ -751,7 +751,7 @@ void LoadHistory() {
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
|
|
||||||
szFileName[0] ='\0';
|
szFileName[0] ='\0';
|
||||||
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,szName,NULL,NULL,
|
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,szName,nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp)) {
|
(BYTE*)szFileName,&dwTemp)) {
|
||||||
g_aPreviousFiles[i] = std::string(szFileName);
|
g_aPreviousFiles[i] = std::string(szFileName);
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ void OpenAsset() {
|
||||||
char szFileName[MAX_PATH];
|
char szFileName[MAX_PATH];
|
||||||
|
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"CurrentApp",NULL,NULL, (BYTE*)szFileName,&dwTemp)) {
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"CurrentApp",nullptr,nullptr, (BYTE*)szFileName,&dwTemp)) {
|
||||||
// Key was not found. Use C:
|
// Key was not found. Use C:
|
||||||
strcpy(szFileName,"");
|
strcpy(szFileName,"");
|
||||||
} else {
|
} else {
|
||||||
|
@ -856,15 +856,15 @@ void OpenAsset() {
|
||||||
ZeroMemory(&sFilename1, sizeof(sFilename1));
|
ZeroMemory(&sFilename1, sizeof(sFilename1));
|
||||||
sFilename1.lStructSize = sizeof(sFilename1);
|
sFilename1.lStructSize = sizeof(sFilename1);
|
||||||
sFilename1.hwndOwner = g_hDlg;
|
sFilename1.hwndOwner = g_hDlg;
|
||||||
sFilename1.hInstance = GetModuleHandle(NULL);
|
sFilename1.hInstance = GetModuleHandle(nullptr);
|
||||||
sFilename1.lpstrFile = szFileName;
|
sFilename1.lpstrFile = szFileName;
|
||||||
sFilename1.lpstrFile[0] = '\0';
|
sFilename1.lpstrFile[0] = '\0';
|
||||||
sFilename1.nMaxFile = sizeof(szList);
|
sFilename1.nMaxFile = sizeof(szList);
|
||||||
sFilename1.lpstrFilter = szList;
|
sFilename1.lpstrFilter = szList;
|
||||||
sFilename1.nFilterIndex = 1;
|
sFilename1.nFilterIndex = 1;
|
||||||
sFilename1.lpstrFileTitle = NULL;
|
sFilename1.lpstrFileTitle = nullptr;
|
||||||
sFilename1.nMaxFileTitle = 0;
|
sFilename1.nMaxFileTitle = 0;
|
||||||
sFilename1.lpstrInitialDir = NULL;
|
sFilename1.lpstrInitialDir = nullptr;
|
||||||
sFilename1.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
|
sFilename1.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
|
||||||
if (GetOpenFileName(&sFilename1) == 0) {
|
if (GetOpenFileName(&sFilename1) == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -942,7 +942,7 @@ void DoExport(size_t formatId) {
|
||||||
|
|
||||||
char szFileName[MAX_PATH*2];
|
char szFileName[MAX_PATH*2];
|
||||||
DWORD dwTemp = sizeof(szFileName);
|
DWORD dwTemp = sizeof(szFileName);
|
||||||
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,"ModelExportDest",NULL,NULL,(BYTE*)szFileName, &dwTemp)) {
|
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,"ModelExportDest",nullptr,nullptr,(BYTE*)szFileName, &dwTemp)) {
|
||||||
ai_assert(strlen(szFileName) <= MAX_PATH);
|
ai_assert(strlen(szFileName) <= MAX_PATH);
|
||||||
|
|
||||||
// invent a nice default file name
|
// invent a nice default file name
|
||||||
|
@ -975,12 +975,12 @@ void DoExport(size_t formatId) {
|
||||||
const std::string ext = "."+std::string(e->fileExtension);
|
const std::string ext = "."+std::string(e->fileExtension);
|
||||||
OPENFILENAME sFilename1 = {
|
OPENFILENAME sFilename1 = {
|
||||||
sizeof(OPENFILENAME),
|
sizeof(OPENFILENAME),
|
||||||
g_hDlg,GetModuleHandle(NULL),
|
g_hDlg,GetModuleHandle(nullptr),
|
||||||
desc, NULL, 0, 1,
|
desc, nullptr, 0, 1,
|
||||||
szFileName, MAX_PATH, NULL, 0, NULL,
|
szFileName, MAX_PATH, nullptr, 0, nullptr,
|
||||||
"Export asset",
|
"Export asset",
|
||||||
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
|
||||||
0, 1, ext.c_str(), 0, NULL, NULL
|
0, 1, ext.c_str(), 0, nullptr, nullptr
|
||||||
};
|
};
|
||||||
if(::GetSaveFileName(&sFilename1) == 0) {
|
if(::GetSaveFileName(&sFilename1) == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -1036,9 +1036,9 @@ void InitUI() {
|
||||||
|
|
||||||
// store the key in a global variable for later use
|
// store the key in a global variable for later use
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ASSIMP\\Viewer",
|
RegCreateKeyEx(HKEY_CURRENT_USER,"Software\\ASSIMP\\Viewer",
|
||||||
0,NULL,0,KEY_ALL_ACCESS, NULL, &g_hRegistry,NULL);
|
0,nullptr,0,KEY_ALL_ACCESS, nullptr, &g_hRegistry,nullptr);
|
||||||
|
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LastUIState",NULL,NULL, (BYTE*)&dwValue,&dwTemp)) {
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LastUIState",nullptr,nullptr, (BYTE*)&dwValue,&dwTemp)) {
|
||||||
dwValue = 1;
|
dwValue = 1;
|
||||||
}
|
}
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
|
@ -1054,7 +1054,7 @@ void InitUI() {
|
||||||
sRect2.left -= sRect.left;
|
sRect2.left -= sRect.left;
|
||||||
sRect2.top -= sRect.top;
|
sRect2.top -= sRect.top;
|
||||||
|
|
||||||
SetWindowPos(g_hDlg,NULL,0,0,sRect.right-214,sRect.bottom,
|
SetWindowPos(g_hDlg,nullptr,0,0,sRect.right-214,sRect.bottom,
|
||||||
SWP_NOMOVE | SWP_NOZORDER);
|
SWP_NOMOVE | SWP_NOZORDER);
|
||||||
SetWindowText(GetDlgItem(g_hDlg,IDC_BLUBB),">>");
|
SetWindowText(GetDlgItem(g_hDlg,IDC_BLUBB),">>");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1062,7 +1062,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AutoRotate
|
// AutoRotate
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"AutoRotate",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"AutoRotate",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.bRotate = false;
|
g_sOptions.bRotate = false;
|
||||||
|
@ -1073,7 +1073,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MultipleLights
|
// MultipleLights
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"MultipleLights",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"MultipleLights",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.b3Lights = false;
|
g_sOptions.b3Lights = false;
|
||||||
|
@ -1084,7 +1084,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Light rotate
|
// Light rotate
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LightRotate",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LightRotate",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.bLightRotate = false;
|
g_sOptions.bLightRotate = false;
|
||||||
|
@ -1095,7 +1095,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NoSpecular
|
// NoSpecular
|
||||||
if (ERROR_SUCCESS != RegQueryValueEx(g_hRegistry, "NoSpecular", NULL, NULL, (BYTE*)&dwValue, &dwTemp)) {
|
if (ERROR_SUCCESS != RegQueryValueEx(g_hRegistry, "NoSpecular", nullptr, nullptr, (BYTE*)&dwValue, &dwTemp)) {
|
||||||
dwValue = 0;
|
dwValue = 0;
|
||||||
}
|
}
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
|
@ -1107,7 +1107,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// LowQuality
|
// LowQuality
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LowQuality",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"LowQuality",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.bLowQuality = false;
|
g_sOptions.bLowQuality = false;
|
||||||
|
@ -1118,7 +1118,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// LowQuality
|
// LowQuality
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"NoTransparency",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"NoTransparency",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.bNoAlphaBlending = false;
|
g_sOptions.bNoAlphaBlending = false;
|
||||||
|
@ -1129,7 +1129,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisplayNormals
|
// DisplayNormals
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"RenderNormals",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"RenderNormals",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_sOptions.bRenderNormals = false;
|
g_sOptions.bRenderNormals = false;
|
||||||
|
@ -1140,7 +1140,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NoMaterials
|
// NoMaterials
|
||||||
if (ERROR_SUCCESS != RegQueryValueEx(g_hRegistry, "RenderMats", NULL, NULL,
|
if (ERROR_SUCCESS != RegQueryValueEx(g_hRegistry, "RenderMats", nullptr, nullptr,
|
||||||
(BYTE*)&dwValue, &dwTemp)) {
|
(BYTE*)&dwValue, &dwTemp)) {
|
||||||
dwValue = 1;
|
dwValue = 1;
|
||||||
}
|
}
|
||||||
|
@ -1153,7 +1153,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MultiSampling
|
// MultiSampling
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"MultiSampling",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"MultiSampling",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 1;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 1;
|
||||||
if (0 == dwValue)
|
if (0 == dwValue)
|
||||||
{
|
{
|
||||||
|
@ -1165,7 +1165,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// FPS Mode
|
// FPS Mode
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"FPSView",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"FPSView",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue) {
|
if (0 == dwValue) {
|
||||||
g_bFPSView = false;
|
g_bFPSView = false;
|
||||||
|
@ -1176,7 +1176,7 @@ void InitUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// WireFrame
|
// WireFrame
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"Wireframe",NULL,NULL,
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"Wireframe",nullptr,nullptr,
|
||||||
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
(BYTE*)&dwValue,&dwTemp))dwValue = 0;
|
||||||
if (0 == dwValue)
|
if (0 == dwValue)
|
||||||
{
|
{
|
||||||
|
@ -1189,7 +1189,7 @@ void InitUI() {
|
||||||
CheckDlgButton(g_hDlg,IDC_TOGGLEWIRE,BST_CHECKED);
|
CheckDlgButton(g_hDlg,IDC_TOGGLEWIRE,BST_CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"PostProcessing",NULL,NULL,(BYTE*)&dwValue,&dwTemp))
|
if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"PostProcessing",nullptr,nullptr,(BYTE*)&dwValue,&dwTemp))
|
||||||
ppsteps = ppstepsdefault;
|
ppsteps = ppstepsdefault;
|
||||||
else ppsteps = dwValue;
|
else ppsteps = dwValue;
|
||||||
|
|
||||||
|
@ -1458,7 +1458,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
if (bDraw)
|
if (bDraw)
|
||||||
{
|
{
|
||||||
SetBkColor(pcStruct->hDC,RGB(0,0,0));
|
SetBkColor(pcStruct->hDC,RGB(0,0,0));
|
||||||
MoveToEx(pcStruct->hDC,0,0,NULL);
|
MoveToEx(pcStruct->hDC,0,0,nullptr);
|
||||||
LineTo(pcStruct->hDC,sRect.right-1,0);
|
LineTo(pcStruct->hDC,sRect.right-1,0);
|
||||||
LineTo(pcStruct->hDC,sRect.right-1,sRect.bottom-1);
|
LineTo(pcStruct->hDC,sRect.right-1,sRect.bottom-1);
|
||||||
LineTo(pcStruct->hDC,0,sRect.bottom-1);
|
LineTo(pcStruct->hDC,0,sRect.bottom-1);
|
||||||
|
@ -1534,7 +1534,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
g_eClick = EClickPos_Outside;
|
g_eClick = EClickPos_Outside;
|
||||||
if (xPos2 >= fHalfX && xPos2 < fHalfX + (int)sDesc.Width &&
|
if (xPos2 >= fHalfX && xPos2 < fHalfX + (int)sDesc.Width &&
|
||||||
yPos2 >= fHalfY && yPos2 < fHalfY + (int)sDesc.Height &&
|
yPos2 >= fHalfY && yPos2 < fHalfY + (int)sDesc.Height &&
|
||||||
NULL != g_szImageMask)
|
nullptr != g_szImageMask)
|
||||||
{
|
{
|
||||||
// inside the texture. Lookup the grayscale value from it
|
// inside the texture. Lookup the grayscale value from it
|
||||||
xPos2 -= fHalfX;
|
xPos2 -= fHalfX;
|
||||||
|
@ -1710,13 +1710,13 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
} else if (ID_TOOLS_LOGWINDOW == LOWORD(wParam)) {
|
} else if (ID_TOOLS_LOGWINDOW == LOWORD(wParam)) {
|
||||||
CLogWindow::Instance().Show();
|
CLogWindow::Instance().Show();
|
||||||
} else if (ID__WEBSITE == LOWORD(wParam)) {
|
} else if (ID__WEBSITE == LOWORD(wParam)) {
|
||||||
ShellExecute(NULL,"open","http://assimp.sourceforge.net","","",SW_SHOW);
|
ShellExecute(nullptr,"open","http://assimp.sourceforge.net","","",SW_SHOW);
|
||||||
} else if (ID__WEBSITESF == LOWORD(wParam)) {
|
} else if (ID__WEBSITESF == LOWORD(wParam)) {
|
||||||
ShellExecute(NULL,"open","https://sourceforge.net/projects/assimp","","",SW_SHOW);
|
ShellExecute(nullptr,"open","https://sourceforge.net/projects/assimp","","",SW_SHOW);
|
||||||
} else if (ID_REPORTBUG == LOWORD(wParam)) {
|
} else if (ID_REPORTBUG == LOWORD(wParam)) {
|
||||||
ShellExecute(NULL,"open","https://sourceforge.net/tracker/?func=add&group_id=226462&atid=1067632","","",SW_SHOW);
|
ShellExecute(nullptr,"open","https://sourceforge.net/tracker/?func=add&group_id=226462&atid=1067632","","",SW_SHOW);
|
||||||
} else if (ID_FR == LOWORD(wParam)) {
|
} else if (ID_FR == LOWORD(wParam)) {
|
||||||
ShellExecute(NULL,"open","https://sourceforge.net/forum/forum.php?forum_id=817653","","",SW_SHOW);
|
ShellExecute(nullptr,"open","https://sourceforge.net/forum/forum.php?forum_id=817653","","",SW_SHOW);
|
||||||
} else if (ID_TOOLS_CLEARLOG == LOWORD(wParam)) {
|
} else if (ID_TOOLS_CLEARLOG == LOWORD(wParam)) {
|
||||||
CLogWindow::Instance().Clear();
|
CLogWindow::Instance().Clear();
|
||||||
} else if (ID_TOOLS_SAVELOGTOFILE == LOWORD(wParam)) {
|
} else if (ID_TOOLS_SAVELOGTOFILE == LOWORD(wParam)) {
|
||||||
|
@ -1838,7 +1838,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
}
|
}
|
||||||
else if (ID_IMPORTSETTINGS_OPENPOST == LOWORD(wParam))
|
else if (ID_IMPORTSETTINGS_OPENPOST == LOWORD(wParam))
|
||||||
{
|
{
|
||||||
ShellExecute(NULL,"open","http://assimp.sourceforge.net/lib_html/ai_post_process_8h.html","","",SW_SHOW);
|
ShellExecute(nullptr,"open","http://assimp.sourceforge.net/lib_html/ai_post_process_8h.html","","",SW_SHOW);
|
||||||
}
|
}
|
||||||
else if (ID_TOOLS_ORIGINALNORMALS == LOWORD(wParam))
|
else if (ID_TOOLS_ORIGINALNORMALS == LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -1922,7 +1922,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
DisplayColorDialog(&g_avLightColors[0]);
|
DisplayColorDialog(&g_avLightColors[0]);
|
||||||
SaveLightColors();
|
SaveLightColors();
|
||||||
}
|
}
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
||||||
}
|
}
|
||||||
else if (IDC_LCOLOR2 == LOWORD(wParam))
|
else if (IDC_LCOLOR2 == LOWORD(wParam))
|
||||||
|
@ -1939,13 +1939,13 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
DisplayColorDialog(&g_avLightColors[1]);
|
DisplayColorDialog(&g_avLightColors[1]);
|
||||||
SaveLightColors();
|
SaveLightColors();
|
||||||
}
|
}
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
||||||
}
|
}
|
||||||
else if (IDC_LCOLOR3 == LOWORD(wParam))
|
else if (IDC_LCOLOR3 == LOWORD(wParam))
|
||||||
{
|
{
|
||||||
DisplayColorDialog(&g_avLightColors[2]);
|
DisplayColorDialog(&g_avLightColors[2]);
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR3));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR3));
|
||||||
SaveLightColors();
|
SaveLightColors();
|
||||||
}
|
}
|
||||||
|
@ -1966,11 +1966,11 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg, WPARAM wParam,LPARAM lParam
|
||||||
SaveLightColors();
|
SaveLightColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR1),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR1));
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR2),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR2));
|
||||||
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),NULL,TRUE);
|
InvalidateRect(GetDlgItem(g_hDlg,IDC_LCOLOR3),nullptr,TRUE);
|
||||||
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR3));
|
UpdateWindow(GetDlgItem(g_hDlg,IDC_LCOLOR3));
|
||||||
}
|
}
|
||||||
else if (IDC_NOSPECULAR == LOWORD(wParam))
|
else if (IDC_NOSPECULAR == LOWORD(wParam))
|
||||||
|
@ -2076,7 +2076,7 @@ INT_PTR CALLBACK ProgressMessageProc(HWND hwndDlg,UINT uMsg,
|
||||||
SendDlgItemMessage(hwndDlg,IDC_PROGRESS,PBM_SETRANGE,0,
|
SendDlgItemMessage(hwndDlg,IDC_PROGRESS,PBM_SETRANGE,0,
|
||||||
MAKELPARAM(0,500));
|
MAKELPARAM(0,500));
|
||||||
|
|
||||||
SetTimer(hwndDlg,0,40,NULL);
|
SetTimer(hwndDlg,0,40,nullptr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
@ -2090,7 +2090,7 @@ INT_PTR CALLBACK ProgressMessageProc(HWND hwndDlg,UINT uMsg,
|
||||||
#if 0
|
#if 0
|
||||||
g_bLoadingCanceled = true;
|
g_bLoadingCanceled = true;
|
||||||
TerminateThread(g_hThreadHandle,5);
|
TerminateThread(g_hThreadHandle,5);
|
||||||
g_pcAsset = NULL;
|
g_pcAsset = nullptr;
|
||||||
|
|
||||||
EndDialog(hwndDlg,0);
|
EndDialog(hwndDlg,0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2167,14 +2167,14 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
// initialize the IDirect3D9 interface
|
// initialize the IDirect3D9 interface
|
||||||
g_hInstance = hInstance;
|
g_hInstance = hInstance;
|
||||||
if (0 == InitD3D()) {
|
if (0 == InitD3D()) {
|
||||||
MessageBox(NULL,"Failed to initialize Direct3D 9",
|
MessageBox(nullptr,"Failed to initialize Direct3D 9",
|
||||||
"ASSIMP ModelViewer",MB_OK);
|
"ASSIMP ModelViewer",MB_OK);
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the main dialog
|
// create the main dialog
|
||||||
HWND hDlg = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOGMAIN),
|
HWND hDlg = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_DIALOGMAIN),
|
||||||
NULL,&MessageProc);
|
nullptr,&MessageProc);
|
||||||
|
|
||||||
// ensure we get high priority
|
// ensure we get high priority
|
||||||
::SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS);
|
::SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS);
|
||||||
|
@ -2187,8 +2187,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
Assimp::DefaultLogger::Debugging | Assimp::DefaultLogger::Info |
|
Assimp::DefaultLogger::Debugging | Assimp::DefaultLogger::Info |
|
||||||
Assimp::DefaultLogger::Err | Assimp::DefaultLogger::Warn);
|
Assimp::DefaultLogger::Err | Assimp::DefaultLogger::Warn);
|
||||||
|
|
||||||
if (NULL == hDlg) {
|
if (nullptr == hDlg) {
|
||||||
MessageBox(NULL,"Failed to create dialog from resource",
|
MessageBox(nullptr,"Failed to create dialog from resource",
|
||||||
"ASSIMP ModelViewer",MB_OK);
|
"ASSIMP ModelViewer",MB_OK);
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
@ -2202,7 +2202,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the D3D device object
|
// create the D3D device object
|
||||||
if (0 == CreateDevice(g_sOptions.bMultiSample,false,true)) {
|
if (0 == CreateDevice(g_sOptions.bMultiSample,false,true)) {
|
||||||
MessageBox(NULL,"Failed to initialize Direct3D 9 (2)",
|
MessageBox(nullptr,"Failed to initialize Direct3D 9 (2)",
|
||||||
"ASSIMP ModelViewer",MB_OK);
|
"ASSIMP ModelViewer",MB_OK);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
@ -2222,18 +2222,18 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
};
|
};
|
||||||
DWORD dwTemp = MAX_PATH;
|
DWORD dwTemp = MAX_PATH;
|
||||||
RegCreateKeyEx(HKEY_CURRENT_USER,
|
RegCreateKeyEx(HKEY_CURRENT_USER,
|
||||||
"Software\\ASSIMP\\Viewer",0,NULL,0,KEY_ALL_ACCESS, NULL, &hRegistry,NULL);
|
"Software\\ASSIMP\\Viewer",0,nullptr,0,KEY_ALL_ACCESS, nullptr, &hRegistry,nullptr);
|
||||||
if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"LastSkyBoxSrc",NULL,NULL,
|
if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"LastSkyBoxSrc",nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0])
|
(BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0])
|
||||||
{
|
{
|
||||||
CBackgroundPainter::Instance().SetCubeMapBG(szFileName);
|
CBackgroundPainter::Instance().SetCubeMapBG(szFileName);
|
||||||
}
|
}
|
||||||
else if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"LastTextureSrc",NULL,NULL,
|
else if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"LastTextureSrc",nullptr,nullptr,
|
||||||
(BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0])
|
(BYTE*)szFileName,&dwTemp) && '\0' != szFileName[0])
|
||||||
{
|
{
|
||||||
CBackgroundPainter::Instance().SetTextureBG(szFileName);
|
CBackgroundPainter::Instance().SetTextureBG(szFileName);
|
||||||
}
|
}
|
||||||
else if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"Color",NULL,NULL,
|
else if(ERROR_SUCCESS == RegQueryValueEx(hRegistry,"Color",nullptr,nullptr,
|
||||||
(BYTE*)&clrColor,&dwTemp))
|
(BYTE*)&clrColor,&dwTemp))
|
||||||
{
|
{
|
||||||
CBackgroundPainter::Instance().SetColor(clrColor);
|
CBackgroundPainter::Instance().SetColor(clrColor);
|
||||||
|
@ -2251,7 +2251,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
double g_dLastTime = 0;
|
double g_dLastTime = 0;
|
||||||
while( uMsg.message != WM_QUIT )
|
while( uMsg.message != WM_QUIT )
|
||||||
{
|
{
|
||||||
if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) )
|
if( PeekMessage( &uMsg, nullptr, 0, 0, PM_REMOVE ) )
|
||||||
{
|
{
|
||||||
TranslateMessage( &uMsg );
|
TranslateMessage( &uMsg );
|
||||||
DispatchMessage( &uMsg );
|
DispatchMessage( &uMsg );
|
||||||
|
|
|
@ -61,17 +61,17 @@ extern std::string g_szDefaultShader;
|
||||||
extern std::string g_szPassThroughShader;
|
extern std::string g_szPassThroughShader;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
HINSTANCE g_hInstance = NULL;
|
HINSTANCE g_hInstance = nullptr;
|
||||||
HWND g_hDlg = NULL;
|
HWND g_hDlg = nullptr;
|
||||||
IDirect3D9* g_piD3D = NULL;
|
IDirect3D9* g_piD3D = nullptr;
|
||||||
IDirect3DDevice9* g_piDevice = NULL;
|
IDirect3DDevice9* g_piDevice = nullptr;
|
||||||
IDirect3DVertexDeclaration9* gDefaultVertexDecl = NULL;
|
IDirect3DVertexDeclaration9* gDefaultVertexDecl = nullptr;
|
||||||
double g_fFPS = 0.0f;
|
double g_fFPS = 0.0f;
|
||||||
char g_szFileName[MAX_PATH];
|
char g_szFileName[MAX_PATH];
|
||||||
ID3DXEffect* g_piDefaultEffect = NULL;
|
ID3DXEffect* g_piDefaultEffect = nullptr;
|
||||||
ID3DXEffect* g_piNormalsEffect = NULL;
|
ID3DXEffect* g_piNormalsEffect = nullptr;
|
||||||
ID3DXEffect* g_piPassThroughEffect = NULL;
|
ID3DXEffect* g_piPassThroughEffect = nullptr;
|
||||||
ID3DXEffect* g_piPatternEffect = NULL;
|
ID3DXEffect* g_piPatternEffect = nullptr;
|
||||||
bool g_bMousePressed = false;
|
bool g_bMousePressed = false;
|
||||||
bool g_bMousePressedR = false;
|
bool g_bMousePressedR = false;
|
||||||
bool g_bMousePressedM = false;
|
bool g_bMousePressedM = false;
|
||||||
|
@ -79,10 +79,10 @@ bool g_bMousePressedBoth = false;
|
||||||
float g_fElpasedTime = 0.0f;
|
float g_fElpasedTime = 0.0f;
|
||||||
D3DCAPS9 g_sCaps;
|
D3DCAPS9 g_sCaps;
|
||||||
bool g_bLoadingFinished = false;
|
bool g_bLoadingFinished = false;
|
||||||
HANDLE g_hThreadHandle = NULL;
|
HANDLE g_hThreadHandle = nullptr;
|
||||||
float g_fWheelPos = -10.0f;
|
float g_fWheelPos = -10.0f;
|
||||||
bool g_bLoadingCanceled = false;
|
bool g_bLoadingCanceled = false;
|
||||||
IDirect3DTexture9* g_pcTexture = NULL;
|
IDirect3DTexture9* g_pcTexture = nullptr;
|
||||||
bool g_bPlay = false;
|
bool g_bPlay = false;
|
||||||
double g_dCurrent = 0.;
|
double g_dCurrent = 0.;
|
||||||
|
|
||||||
|
@ -135,13 +135,13 @@ float g_fLightColor = 1.0f;
|
||||||
|
|
||||||
RenderOptions g_sOptions;
|
RenderOptions g_sOptions;
|
||||||
Camera g_sCamera;
|
Camera g_sCamera;
|
||||||
AssetHelper *g_pcAsset = NULL;
|
AssetHelper *g_pcAsset = nullptr;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Contains the mask image for the HUD
|
// Contains the mask image for the HUD
|
||||||
// (used to determine the position of a click)
|
// (used to determine the position of a click)
|
||||||
//
|
//
|
||||||
unsigned char* g_szImageMask = NULL;
|
unsigned char* g_szImageMask = nullptr;
|
||||||
|
|
||||||
float g_fLoadTime = 0.0f;
|
float g_fLoadTime = 0.0f;
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ DWORD WINAPI LoadThreadProc(LPVOID lpParameter)
|
||||||
aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space
|
aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space
|
||||||
aiProcess_SortByPType | // make 'clean' meshes which consist of a single typ of primitives
|
aiProcess_SortByPType | // make 'clean' meshes which consist of a single typ of primitives
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
props);
|
props);
|
||||||
|
|
||||||
aiReleasePropertyStore(props);
|
aiReleasePropertyStore(props);
|
||||||
|
@ -186,7 +186,7 @@ DWORD WINAPI LoadThreadProc(LPVOID lpParameter)
|
||||||
g_bLoadingFinished = true;
|
g_bLoadingFinished = true;
|
||||||
|
|
||||||
// check whether the loading process has failed ...
|
// check whether the loading process has failed ...
|
||||||
if (NULL == g_pcAsset->pcScene)
|
if (nullptr == g_pcAsset->pcScene)
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load this asset:",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load this asset:",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
|
@ -223,7 +223,7 @@ int LoadAsset()
|
||||||
DWORD dwID;
|
DWORD dwID;
|
||||||
g_bLoadingCanceled = false;
|
g_bLoadingCanceled = false;
|
||||||
g_pcAsset = new AssetHelper();
|
g_pcAsset = new AssetHelper();
|
||||||
g_hThreadHandle = CreateThread(NULL,0,&LoadThreadProc,NULL,0,&dwID);
|
g_hThreadHandle = CreateThread(nullptr,0,&LoadThreadProc,nullptr,0,&dwID);
|
||||||
|
|
||||||
if (!g_hThreadHandle)
|
if (!g_hThreadHandle)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +248,7 @@ int LoadAsset()
|
||||||
if (g_pcAsset)
|
if (g_pcAsset)
|
||||||
{
|
{
|
||||||
delete g_pcAsset;
|
delete g_pcAsset;
|
||||||
g_pcAsset = NULL;
|
g_pcAsset = nullptr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ int DeleteAsset(void) {
|
||||||
delete[] g_pcAsset->apcMeshes;
|
delete[] g_pcAsset->apcMeshes;
|
||||||
delete g_pcAsset->mAnimator;
|
delete g_pcAsset->mAnimator;
|
||||||
delete g_pcAsset;
|
delete g_pcAsset;
|
||||||
g_pcAsset = NULL;
|
g_pcAsset = nullptr;
|
||||||
|
|
||||||
// reset the caption of the viewer window
|
// reset the caption of the viewer window
|
||||||
SetWindowText(g_hDlg,AI_VIEW_CAPTION_BASE);
|
SetWindowText(g_hDlg,AI_VIEW_CAPTION_BASE);
|
||||||
|
@ -351,8 +351,8 @@ int DeleteAsset(void) {
|
||||||
// piMatrix Transformation matrix of the graph at this position
|
// piMatrix Transformation matrix of the graph at this position
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int CalculateBounds(aiNode* piNode, aiVector3D* p_avOut, const aiMatrix4x4& piMatrix) {
|
int CalculateBounds(aiNode* piNode, aiVector3D* p_avOut, const aiMatrix4x4& piMatrix) {
|
||||||
ai_assert(NULL != piNode);
|
ai_assert(nullptr != piNode);
|
||||||
ai_assert(NULL != p_avOut);
|
ai_assert(nullptr != p_avOut);
|
||||||
|
|
||||||
aiMatrix4x4 mTemp = piNode->mTransformation;
|
aiMatrix4x4 mTemp = piNode->mTransformation;
|
||||||
mTemp.Transpose();
|
mTemp.Transpose();
|
||||||
|
@ -424,8 +424,8 @@ int ScaleAsset(void)
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int GenerateNormalsAsLineList(AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource)
|
int GenerateNormalsAsLineList(AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSource)
|
||||||
{
|
{
|
||||||
ai_assert(NULL != pcMesh);
|
ai_assert(nullptr != pcMesh);
|
||||||
ai_assert(NULL != pcSource);
|
ai_assert(nullptr != pcSource);
|
||||||
|
|
||||||
if (!pcSource->mNormals)return 0;
|
if (!pcSource->mNormals)return 0;
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ int GenerateNormalsAsLineList(AssetHelper::MeshHelper* pcMesh,const aiMesh* pcSo
|
||||||
pcSource->mNumVertices * 2,
|
pcSource->mNumVertices * 2,
|
||||||
D3DUSAGE_WRITEONLY,
|
D3DUSAGE_WRITEONLY,
|
||||||
AssetHelper::LineVertex::GetFVF(),
|
AssetHelper::LineVertex::GetFVF(),
|
||||||
D3DPOOL_DEFAULT, &pcMesh->piVBNormals,NULL)))
|
D3DPOOL_DEFAULT, &pcMesh->piVBNormals,nullptr)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("Failed to create vertex buffer for the normal list",
|
CLogDisplay::Instance().AddEntry("Failed to create vertex buffer for the normal list",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
|
@ -495,7 +495,7 @@ int CreateAssetData()
|
||||||
mesh->mNumVertices,
|
mesh->mNumVertices,
|
||||||
D3DUSAGE_WRITEONLY,
|
D3DUSAGE_WRITEONLY,
|
||||||
0,
|
0,
|
||||||
D3DPOOL_DEFAULT, &g_pcAsset->apcMeshes[i]->piVB,NULL))) {
|
D3DPOOL_DEFAULT, &g_pcAsset->apcMeshes[i]->piVB,nullptr))) {
|
||||||
MessageBox(g_hDlg,"Failed to create vertex buffer",
|
MessageBox(g_hDlg,"Failed to create vertex buffer",
|
||||||
"ASSIMP Viewer Utility",MB_OK);
|
"ASSIMP Viewer Utility",MB_OK);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -505,7 +505,7 @@ int CreateAssetData()
|
||||||
if (g_pcAsset->apcMeshes[i]->piOpacityTexture || 1.0f != g_pcAsset->apcMeshes[i]->fOpacity)
|
if (g_pcAsset->apcMeshes[i]->piOpacityTexture || 1.0f != g_pcAsset->apcMeshes[i]->fOpacity)
|
||||||
dwUsage |= D3DUSAGE_DYNAMIC;
|
dwUsage |= D3DUSAGE_DYNAMIC;
|
||||||
|
|
||||||
unsigned int nidx;
|
unsigned int nidx = 0;
|
||||||
switch (mesh->mPrimitiveTypes) {
|
switch (mesh->mPrimitiveTypes) {
|
||||||
case aiPrimitiveType_POINT:
|
case aiPrimitiveType_POINT:
|
||||||
nidx = 1;
|
nidx = 1;
|
||||||
|
@ -534,7 +534,7 @@ int CreateAssetData()
|
||||||
D3DFMT_INDEX32,
|
D3DFMT_INDEX32,
|
||||||
D3DPOOL_DEFAULT,
|
D3DPOOL_DEFAULT,
|
||||||
&g_pcAsset->apcMeshes[i]->piIB,
|
&g_pcAsset->apcMeshes[i]->piIB,
|
||||||
NULL)))
|
nullptr)))
|
||||||
{
|
{
|
||||||
MessageBox(g_hDlg,"Failed to create 32 Bit index buffer",
|
MessageBox(g_hDlg,"Failed to create 32 Bit index buffer",
|
||||||
"ASSIMP Viewer Utility",MB_OK);
|
"ASSIMP Viewer Utility",MB_OK);
|
||||||
|
@ -560,7 +560,7 @@ int CreateAssetData()
|
||||||
D3DFMT_INDEX16,
|
D3DFMT_INDEX16,
|
||||||
D3DPOOL_DEFAULT,
|
D3DPOOL_DEFAULT,
|
||||||
&g_pcAsset->apcMeshes[i]->piIB,
|
&g_pcAsset->apcMeshes[i]->piIB,
|
||||||
NULL)))
|
nullptr)))
|
||||||
{
|
{
|
||||||
MessageBox(g_hDlg,"Failed to create 16 Bit index buffer",
|
MessageBox(g_hDlg,"Failed to create 16 Bit index buffer",
|
||||||
"ASSIMP Viewer Utility",MB_OK);
|
"ASSIMP Viewer Utility",MB_OK);
|
||||||
|
@ -595,11 +595,11 @@ int CreateAssetData()
|
||||||
{
|
{
|
||||||
pbData2->vPosition = mesh->mVertices[x];
|
pbData2->vPosition = mesh->mVertices[x];
|
||||||
|
|
||||||
if (NULL == mesh->mNormals)
|
if (nullptr == mesh->mNormals)
|
||||||
pbData2->vNormal = aiVector3D(0.0f,0.0f,0.0f);
|
pbData2->vNormal = aiVector3D(0.0f,0.0f,0.0f);
|
||||||
else pbData2->vNormal = mesh->mNormals[x];
|
else pbData2->vNormal = mesh->mNormals[x];
|
||||||
|
|
||||||
if (NULL == mesh->mTangents) {
|
if (nullptr == mesh->mTangents) {
|
||||||
pbData2->vTangent = aiVector3D(0.0f,0.0f,0.0f);
|
pbData2->vTangent = aiVector3D(0.0f,0.0f,0.0f);
|
||||||
pbData2->vBitangent = aiVector3D(0.0f,0.0f,0.0f);
|
pbData2->vBitangent = aiVector3D(0.0f,0.0f,0.0f);
|
||||||
}
|
}
|
||||||
|
@ -639,7 +639,7 @@ int CreateAssetData()
|
||||||
ai_assert( weightsPerVertex[x].size() <= 4);
|
ai_assert( weightsPerVertex[x].size() <= 4);
|
||||||
for( unsigned int a = 0; a < weightsPerVertex[x].size(); a++)
|
for( unsigned int a = 0; a < weightsPerVertex[x].size(); a++)
|
||||||
{
|
{
|
||||||
boneIndices[a] = weightsPerVertex[x][a].mVertexId;
|
boneIndices[a] = static_cast<unsigned char>(weightsPerVertex[x][a].mVertexId);
|
||||||
boneWeights[a] = (unsigned char) (weightsPerVertex[x][a].mWeight * 255.0f);
|
boneWeights[a] = (unsigned char) (weightsPerVertex[x][a].mWeight * 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,17 +677,17 @@ int DeleteAssetData(bool bNoMaterials)
|
||||||
if(g_pcAsset->apcMeshes[i]->piVB)
|
if(g_pcAsset->apcMeshes[i]->piVB)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piVB->Release();
|
g_pcAsset->apcMeshes[i]->piVB->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piVB = NULL;
|
g_pcAsset->apcMeshes[i]->piVB = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piVBNormals)
|
if(g_pcAsset->apcMeshes[i]->piVBNormals)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piVBNormals->Release();
|
g_pcAsset->apcMeshes[i]->piVBNormals->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piVBNormals = NULL;
|
g_pcAsset->apcMeshes[i]->piVBNormals = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piIB)
|
if(g_pcAsset->apcMeshes[i]->piIB)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piIB->Release();
|
g_pcAsset->apcMeshes[i]->piIB->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piIB = NULL;
|
g_pcAsset->apcMeshes[i]->piIB = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ... unfixed memory leak
|
// TODO ... unfixed memory leak
|
||||||
|
@ -703,42 +703,42 @@ int DeleteAssetData(bool bNoMaterials)
|
||||||
if(g_pcAsset->apcMeshes[i]->piEffect)
|
if(g_pcAsset->apcMeshes[i]->piEffect)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piEffect->Release();
|
g_pcAsset->apcMeshes[i]->piEffect->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piEffect = NULL;
|
g_pcAsset->apcMeshes[i]->piEffect = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piDiffuseTexture)
|
if(g_pcAsset->apcMeshes[i]->piDiffuseTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piDiffuseTexture->Release();
|
g_pcAsset->apcMeshes[i]->piDiffuseTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piDiffuseTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piDiffuseTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piNormalTexture)
|
if(g_pcAsset->apcMeshes[i]->piNormalTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piNormalTexture->Release();
|
g_pcAsset->apcMeshes[i]->piNormalTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piNormalTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piNormalTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piSpecularTexture)
|
if(g_pcAsset->apcMeshes[i]->piSpecularTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piSpecularTexture->Release();
|
g_pcAsset->apcMeshes[i]->piSpecularTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piSpecularTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piSpecularTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piAmbientTexture)
|
if(g_pcAsset->apcMeshes[i]->piAmbientTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piAmbientTexture->Release();
|
g_pcAsset->apcMeshes[i]->piAmbientTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piAmbientTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piAmbientTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piEmissiveTexture)
|
if(g_pcAsset->apcMeshes[i]->piEmissiveTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piEmissiveTexture->Release();
|
g_pcAsset->apcMeshes[i]->piEmissiveTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piEmissiveTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piEmissiveTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piOpacityTexture)
|
if(g_pcAsset->apcMeshes[i]->piOpacityTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piOpacityTexture->Release();
|
g_pcAsset->apcMeshes[i]->piOpacityTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piOpacityTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piOpacityTexture = nullptr;
|
||||||
}
|
}
|
||||||
if(g_pcAsset->apcMeshes[i]->piShininessTexture)
|
if(g_pcAsset->apcMeshes[i]->piShininessTexture)
|
||||||
{
|
{
|
||||||
g_pcAsset->apcMeshes[i]->piShininessTexture->Release();
|
g_pcAsset->apcMeshes[i]->piShininessTexture->Release();
|
||||||
g_pcAsset->apcMeshes[i]->piShininessTexture = NULL;
|
g_pcAsset->apcMeshes[i]->piShininessTexture = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -776,10 +776,10 @@ int SetupFPSView()
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
int InitD3D(void)
|
int InitD3D(void)
|
||||||
{
|
{
|
||||||
if (NULL == g_piD3D)
|
if (nullptr == g_piD3D)
|
||||||
{
|
{
|
||||||
g_piD3D = Direct3DCreate9(D3D_SDK_VERSION);
|
g_piD3D = Direct3DCreate9(D3D_SDK_VERSION);
|
||||||
if (NULL == g_piD3D)return 0;
|
if (nullptr == g_piD3D)return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -792,20 +792,20 @@ int InitD3D(void)
|
||||||
int ShutdownD3D(void)
|
int ShutdownD3D(void)
|
||||||
{
|
{
|
||||||
ShutdownDevice();
|
ShutdownDevice();
|
||||||
if (NULL != g_piD3D)
|
if (nullptr != g_piD3D)
|
||||||
{
|
{
|
||||||
g_piD3D->Release();
|
g_piD3D->Release();
|
||||||
g_piD3D = NULL;
|
g_piD3D = nullptr;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class TComPtr>
|
template<class TComPtr>
|
||||||
inline
|
inline
|
||||||
void SafeRelease(TComPtr *ptr) {
|
void SafeRelease(TComPtr *&ptr) {
|
||||||
if (nullptr != g_piPassThroughEffect) {
|
if (nullptr != ptr) {
|
||||||
g_piPassThroughEffect->Release();
|
ptr->Release();
|
||||||
g_piPassThroughEffect = nullptr;
|
ptr = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,12 +843,12 @@ int ShutdownDevice(void)
|
||||||
int CreateHUDTexture()
|
int CreateHUDTexture()
|
||||||
{
|
{
|
||||||
// lock the memory resource ourselves
|
// lock the memory resource ourselves
|
||||||
HRSRC res = FindResource(NULL,MAKEINTRESOURCE(IDR_HUD),RT_RCDATA);
|
HRSRC res = FindResource(nullptr,MAKEINTRESOURCE(IDR_HUD),RT_RCDATA);
|
||||||
HGLOBAL hg = LoadResource(NULL,res);
|
HGLOBAL hg = LoadResource(nullptr,res);
|
||||||
void* pData = LockResource(hg);
|
void* pData = LockResource(hg);
|
||||||
|
|
||||||
if(FAILED(D3DXCreateTextureFromFileInMemoryEx(g_piDevice,
|
if(FAILED(D3DXCreateTextureFromFileInMemoryEx(g_piDevice,
|
||||||
pData,SizeofResource(NULL,res),
|
pData,SizeofResource(nullptr,res),
|
||||||
D3DX_DEFAULT_NONPOW2,
|
D3DX_DEFAULT_NONPOW2,
|
||||||
D3DX_DEFAULT_NONPOW2,
|
D3DX_DEFAULT_NONPOW2,
|
||||||
1,
|
1,
|
||||||
|
@ -858,15 +858,15 @@ int CreateHUDTexture()
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&g_pcTexture)))
|
&g_pcTexture)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load HUD texture",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load HUD texture",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
|
|
||||||
g_pcTexture = NULL;
|
g_pcTexture = nullptr;
|
||||||
g_szImageMask = NULL;
|
g_szImageMask = nullptr;
|
||||||
|
|
||||||
FreeResource(hg);
|
FreeResource(hg);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -879,13 +879,13 @@ int CreateHUDTexture()
|
||||||
|
|
||||||
|
|
||||||
// lock the memory resource ourselves
|
// lock the memory resource ourselves
|
||||||
res = FindResource(NULL,MAKEINTRESOURCE(IDR_HUDMASK),RT_RCDATA);
|
res = FindResource(nullptr,MAKEINTRESOURCE(IDR_HUDMASK),RT_RCDATA);
|
||||||
hg = LoadResource(NULL,res);
|
hg = LoadResource(nullptr,res);
|
||||||
pData = LockResource(hg);
|
pData = LockResource(hg);
|
||||||
|
|
||||||
IDirect3DTexture9* pcTex;
|
IDirect3DTexture9* pcTex;
|
||||||
if(FAILED(D3DXCreateTextureFromFileInMemoryEx(g_piDevice,
|
if(FAILED(D3DXCreateTextureFromFileInMemoryEx(g_piDevice,
|
||||||
pData,SizeofResource(NULL,res),
|
pData,SizeofResource(nullptr,res),
|
||||||
sDesc.Width,
|
sDesc.Width,
|
||||||
sDesc.Height,
|
sDesc.Height,
|
||||||
1,
|
1,
|
||||||
|
@ -895,13 +895,13 @@ int CreateHUDTexture()
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT,
|
||||||
0,
|
0,
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
&pcTex)))
|
&pcTex)))
|
||||||
{
|
{
|
||||||
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load HUD mask texture",
|
CLogDisplay::Instance().AddEntry("[ERROR] Unable to load HUD mask texture",
|
||||||
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
D3DCOLOR_ARGB(0xFF,0xFF,0,0));
|
||||||
g_szImageMask = NULL;
|
g_szImageMask = nullptr;
|
||||||
|
|
||||||
FreeResource(hg);
|
FreeResource(hg);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -911,7 +911,7 @@ int CreateHUDTexture()
|
||||||
|
|
||||||
// lock the texture and copy it to get a pointer
|
// lock the texture and copy it to get a pointer
|
||||||
D3DLOCKED_RECT sRect;
|
D3DLOCKED_RECT sRect;
|
||||||
pcTex->LockRect(0,&sRect,NULL,D3DLOCK_READONLY);
|
pcTex->LockRect(0,&sRect,nullptr,D3DLOCK_READONLY);
|
||||||
|
|
||||||
unsigned char* szOut = new unsigned char[sDesc.Width * sDesc.Height];
|
unsigned char* szOut = new unsigned char[sDesc.Width * sDesc.Height];
|
||||||
unsigned char* _szOut = szOut;
|
unsigned char* _szOut = szOut;
|
||||||
|
@ -1023,14 +1023,14 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
// compile the default material shader (gray gouraud/phong)
|
// compile the default material shader (gray gouraud/phong)
|
||||||
ID3DXBuffer* piBuffer = NULL;
|
ID3DXBuffer* piBuffer = nullptr;
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szDefaultShader.c_str(),
|
g_szDefaultShader.c_str(),
|
||||||
(UINT)g_szDefaultShader.length(),
|
(UINT)g_szDefaultShader.length(),
|
||||||
NULL,
|
nullptr,
|
||||||
NULL,
|
nullptr,
|
||||||
AI_SHADER_COMPILE_FLAGS,
|
AI_SHADER_COMPILE_FLAGS,
|
||||||
NULL,
|
nullptr,
|
||||||
&g_piDefaultEffect,&piBuffer)))
|
&g_piDefaultEffect,&piBuffer)))
|
||||||
{
|
{
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
|
@ -1043,7 +1043,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
piBuffer->Release();
|
piBuffer->Release();
|
||||||
piBuffer = NULL;
|
piBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use Fixed Function effect when working with shaderless cards
|
// use Fixed Function effect when working with shaderless cards
|
||||||
|
@ -1053,7 +1053,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
// create the shader used to draw the HUD
|
// create the shader used to draw the HUD
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szPassThroughShader.c_str(),(UINT)g_szPassThroughShader.length(),
|
g_szPassThroughShader.c_str(),(UINT)g_szPassThroughShader.length(),
|
||||||
NULL,NULL,AI_SHADER_COMPILE_FLAGS,NULL,&g_piPassThroughEffect,&piBuffer)))
|
nullptr,nullptr,AI_SHADER_COMPILE_FLAGS,nullptr,&g_piPassThroughEffect,&piBuffer)))
|
||||||
{
|
{
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
|
@ -1065,7 +1065,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
piBuffer->Release();
|
piBuffer->Release();
|
||||||
piBuffer = NULL;
|
piBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use Fixed Function effect when working with shaderless cards
|
// use Fixed Function effect when working with shaderless cards
|
||||||
|
@ -1075,7 +1075,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
// create the shader used to visualize normal vectors
|
// create the shader used to visualize normal vectors
|
||||||
if(FAILED( D3DXCreateEffect(g_piDevice,
|
if(FAILED( D3DXCreateEffect(g_piDevice,
|
||||||
g_szNormalsShader.c_str(),(UINT)g_szNormalsShader.length(),
|
g_szNormalsShader.c_str(),(UINT)g_szNormalsShader.length(),
|
||||||
NULL,NULL,AI_SHADER_COMPILE_FLAGS,NULL,&g_piNormalsEffect, &piBuffer)))
|
nullptr,nullptr,AI_SHADER_COMPILE_FLAGS,nullptr,&g_piNormalsEffect, &piBuffer)))
|
||||||
{
|
{
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
|
@ -1087,7 +1087,7 @@ int CreateDevice (bool p_bMultiSample,bool p_bSuperSample,bool bHW /*= true*/)
|
||||||
if( piBuffer)
|
if( piBuffer)
|
||||||
{
|
{
|
||||||
piBuffer->Release();
|
piBuffer->Release();
|
||||||
piBuffer = NULL;
|
piBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//MessageBox( g_hDlg, "Failed to create vertex declaration", "Init", MB_OK);
|
//MessageBox( g_hDlg, "Failed to create vertex declaration", "Init", MB_OK);
|
||||||
|
|
Loading…
Reference in New Issue