speedtree win64

This commit is contained in:
David Rose 2010-10-14 16:57:00 +00:00
parent f85ccdf0f3
commit 593393dd64
11 changed files with 59 additions and 23 deletions

View File

@ -5,10 +5,8 @@
// platform, when ppremake has been compiled using Cygwin. It
// inherits most of its parameters from Config.Win32.pp.
//
// *** UNCOMMENT ONE OF THE TWO OPTIONS BELOW FOR 32 OR 64 BIT BUILDS
// 32-bit
// Note: if you are building for 64-bit Windows, you should configure
// ppremake with the "Cygwin64" platform name instead of "Cygwin".
#include $[THISDIRPREFIX]Config.Win32.pp
// 64-bit
// #include $[THISDIRPREFIX]Config.Win64.pp

10
dtool/Config.Cygwin64.pp Executable file
View File

@ -0,0 +1,10 @@
//
// Config.Cygwin64.pp
//
// This file defines some custom config variables for the Windows
// platform, when ppremake has been compiled using Cygwin. It
// inherits most of its parameters from Config.Win64.pp.
//
// 32-bit
#include $[THISDIRPREFIX]Config.Win64.pp

View File

@ -755,8 +755,11 @@
#define DX9_LIBS d3d9.lib d3dx9.lib dxerr9.lib
#defer HAVE_DX9 $[libtest $[DX9_LPATH],$[DX9_LIBS]]
// Set this nonempty to use <dxerr.h> instead of <dxerr9.h>.
#define USE_GENERIC_DXERR_LIBRARY
// Set this nonempty to use <dxerr.h> instead of <dxerr9.h>. The
// choice between the two is largely based on which version of the
// DirectX SDK(s) you might have installed. The generic library is
// the default for 64-bit windows.
#defer USE_GENERIC_DXERR_LIBRARY $[WIN64_PLATFORM]
// Is OpenCV installed, and where?
#define OPENCV_IPATH /usr/local/include/opencv
@ -951,12 +954,13 @@
#defer SPEEDTREE_BIN_DIR $[SPEEDTREE_SDK_DIR]/Bin
#defer SPEEDTREE_IPATH $[SPEEDTREE_SDK_DIR]/Include
#defer SPEEDTREE_LPATH $[SPEEDTREE_SDK_DIR]/Lib/Windows/VC9
#defer SPEEDTREE_LPATH $[SPEEDTREE_SDK_DIR]/Lib/Windows/VC9$[if $[WIN64_PLATFORM],.x64]
#defer SPEEDTREE_DEBUG $[if $[< $[OPTIMIZE], 3],_d]
#defer SPEEDTREE_64 $[if $[WIN64_PLATFORM],64]
// These names are used to build up the names of the SpeedTree libraries.
#defer SPEEDTREE_VERSION 5.1
#defer SPEEDTREE_LIB_SUFFIX _v$[SPEEDTREE_VERSION]_VC90MT_Static$[SPEEDTREE_DEBUG].lib
#defer SPEEDTREE_LIB_SUFFIX _v$[SPEEDTREE_VERSION]_VC90MT$[SPEEDTREE_64]_Static$[SPEEDTREE_DEBUG].lib
#if $[WINDOWS_PLATFORM]
#defer SPEEDTREE_LIBS SpeedTreeCore$[SPEEDTREE_LIB_SUFFIX] SpeedTreeForest$[SPEEDTREE_LIB_SUFFIX] SpeedTree$[SPEEDTREE_API]Renderer$[SPEEDTREE_LIB_SUFFIX] SpeedTreeRenderInterface$[SPEEDTREE_LIB_SUFFIX] $[if $[eq $[SPEEDTREE_API],OpenGL],glew32.lib]
#else

View File

@ -389,10 +389,9 @@ $[cdefine HAVE_DX8]
/* Define if we have DirectX installed and want to build for DX. */
$[cdefine HAVE_DX9]
/* If we're building 64-bit, we want to use generic DirectX error libraries. */
#if $[eq $[USE_COMPILER],MSVC9x64]
$[cdefine USE_GENERIC_DXERR_LIBRARY]
#endif
/* The choice of generic vs. the specific dxerr library largely
depends on which SDK you have installed. */
$[cdefine USE_GENERIC_DXERR_LIBRARY]
/* Define if we want to build tinydisplay. */
$[cdefine HAVE_TINYDISPLAY]

View File

@ -74,8 +74,14 @@
// PLATFORM variable, and help it to control the effects of functions
// like $[os] and $[isfullpath].
// True if we are specifically 32-bit Windows.
#define WIN32_PLATFORM $[or $[eq $[PLATFORM],Win32],$[eq $[PLATFORM],Cygwin]]
// True if we are 64-bit windows.
#define WIN64_PLATFORM $[or $[eq $[PLATFORM],Win64],$[eq $[PLATFORM],Cygwin64]]
// True if we are building on some flavor of Windows.
#define WINDOWS_PLATFORM $[or $[eq $[PLATFORM],Win32],$[eq $[PLATFORM],Cygwin]]
#define WINDOWS_PLATFORM $[or $[WIN32_PLATFORM],$[WIN64_PLATFORM]]
// True if we are building on some flavor of OS X.
#define OSX_PLATFORM $[eq $[PLATFORM],OSX]

View File

@ -458,10 +458,18 @@ if (COMPILER=="MSVC"):
# We need to be able to find NxCharacter.dll when importing code library libpandaphysx
AddToPathEnv("PATH", SDK["PHYSX"]+"/../Bin/win32/")
if (PkgSkip("SPEEDTREE")==0):
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC9/"
win64 = (sys.platform.startswith("win") and platform.architecture()[0] == "64bit")
if win64:
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC9.x64/"
p64ext = '64'
else:
libdir = SDK["SPEEDTREE"] + "/Lib/Windows/VC9/"
p64ext = ''
debugext = ''
if (GetOptimize() <= 2 and sys.platform.startswith("win")): debugext = "_d"
libsuffix = "_v%s_VC90MT_Static%s.lib" % (SDK["SPEEDTREEVERSION"], debugext)
libsuffix = "_v%s_VC90MT%s_Static%s.lib" % (
SDK["SPEEDTREEVERSION"], p64ext, debugext)
LibName("SPEEDTREE", "%sSpeedTreeCore%s" % (libdir, libsuffix))
LibName("SPEEDTREE", "%sSpeedTreeForest%s" % (libdir, libsuffix))
LibName("SPEEDTREE", "%sSpeedTree%sRenderer%s" % (libdir, SDK["SPEEDTREEAPI"], libsuffix))

View File

@ -231,6 +231,14 @@ ConfigVariableDouble speedtree_cull_cell_size
"while increasing the number of trees that are rendered "
"per call."));
ConfigVariableDouble speedtree_area_scale
("speedtree-area-scale", 3280.839895013,
PRC_DESC("This is the factor by which the \"area\" value in a SpeedTree "
"terrain.txt file is scaled (after taking its square root) "
"when loading a new terrain. The default is about 3281, which "
"scales from kilometers to feet. You should set a different "
"scale if you use units other than feet."));
ConfigVariableBool speedtree_5_2_stf
("speedtree-5-2-stf",
#if SPEEDTREE_VERSION_MAJOR > 5 || (SPEEDTREE_VERSION_MAJOR == 5 && SPEEDTREE_VERSION_MINOR >= 2)

View File

@ -69,6 +69,7 @@ extern ConfigVariableBool speedtree_show_overlays;
extern ConfigVariableInt speedtree_max_num_visible_cells;
extern ConfigVariableDouble speedtree_cull_cell_size;
extern ConfigVariableDouble speedtree_area_scale;
extern ConfigVariableBool speedtree_5_2_stf;
extern EXPCL_PANDASPEEDTREE void init_libspeedtree();

View File

@ -106,7 +106,7 @@ SpeedTreeNode(const string &name) :
_os_shaders_dir = shaders_dir.to_os_specific();
// Ensure the path ends with a terminal slash; SpeedTree requires this.
#ifdef WIN32
#if defined(WIN32) || defined(WIN64)
if (!_os_shaders_dir.empty() && _os_shaders_dir[_os_shaders_dir.length() - 1] != '\\') {
_os_shaders_dir += "\\";
}
@ -1604,7 +1604,7 @@ setup_for_render(GraphicsStateGuardian *gsg) {
if (!speedtree_textures_dir.empty()) {
os_textures_dir = speedtree_textures_dir.get_value().to_os_specific();
// Ensure the path ends with a terminal slash; SpeedTree requires this.
#ifdef WIN32
#if defined(WIN32) || defined(WIN64)
if (!os_textures_dir.empty() && os_textures_dir[os_textures_dir.length() - 1] != '\\') {
os_textures_dir += "\\";
}

View File

@ -45,8 +45,10 @@ class Loader;
// SpeedTree objects, especially trees, within the
// Panda3D scene graph.
//
// SpeedTree also includes some support for simple
// terrain and grass systems.
// SpeedTree also includes some support for a simple
// terrain system, which is available here as well.
// SpeedTree's rather lame grass system is not presently
// exposed.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDASPEEDTREE SpeedTreeNode : public PandaNode {
private:

View File

@ -159,11 +159,11 @@ setup_terrain(istream &in, const Filename &pathname) {
in >> keyword;
while (in && !in.eof()) {
if (keyword == "area") {
// area defines the size of the terrain in square kilometers.
static const float feet_per_km = 3280.839895013f;
// "area" defines the size of the terrain in square kilometers.
// We apply speedtree_area_scale to convert that to local units.
float area;
in >> area;
_size = csqrt(area) * feet_per_km;
_size = csqrt(area) * speedtree_area_scale;
} else if (keyword == "height_scale") {
in >> _height_scale;