layout: restructure into src/ tests/ android/ scripts/ tools/

- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
  (+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
  perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten

No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-29 19:08:19 +09:00
co-authored by Claude Opus 5.5
parent 70710477cf
commit a46093104c
2817 changed files with 13728 additions and 13744 deletions
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/compile.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <compile.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/errcode.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <errcode.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/eval.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <eval.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/frameobject.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <frameobject.h>
@@ -0,0 +1,14 @@
#pragma once
// Shim for 40250's <Python-2.7/grammar.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <grammar.h>
// CPython's bitset.h (pulled in by grammar.h) does `#define BYTE char`; the copy under 40250's
// extern/include/Python-2.7 has that line removed, so BYTE stays the Win32 unsigned char in every
// file that includes ScriptLib/StdAfx.h. bitset.h's own macros only use sizeof(BYTE), which is 1
// either way.
#undef BYTE
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/longintrepr.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <longintrepr.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/marshal.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <marshal.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/node.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <node.h>
@@ -0,0 +1,13 @@
#pragma once
// Shim for 40250's <Python-2.7/parsetok.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
// parsetok.h names `node` and `grammar` without including their headers; 40250's StdAfx includes
// node.h and grammar.h before it, in this order.
#include <node.h>
#include <grammar.h>
#include <parsetok.h>
@@ -0,0 +1,7 @@
#pragma once
// Shim for 40250's <Python-2.7/python.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>.
#include <Python.h>
@@ -0,0 +1,16 @@
#pragma once
// Shim for 40250's <Python-2.7/symtable.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
// CPython's Include/symtable.h is not self-contained: it names mod_ty, which only Python-ast.h
// declares — and that header also defines one-word macros (Module, Delete, Set, Print, Num, ...)
// that collide with 40250 identifiers such as CPool::Delete. 40250's own extern/include copy
// comments the one declaration that needs mod_ty (PySymtable_Build) out; repeating Python-ast.h's
// typedef keeps the upstream header intact and the macros out.
struct _mod;
typedef struct _mod *mod_ty;
#include <symtable.h>
@@ -0,0 +1,9 @@
#pragma once
// Shim for 40250's <Python-2.7/token.h>: the client includes the CPython headers under a
// Python-2.7/ prefix (its extern/include layout). The vendored interpreter
// (third_party/cpython-2.7.18, target mtpython) installs them flat, so each header
// here forwards to the real one. <Python-2.7/python.h> comes first in 40250's StdAfx, exactly
// as CPython requires of <Python.h>; this shim includes it first so the header also stands
// alone under the port header gate.
#include <Python.h>
#include <token.h>
+465
View File
@@ -0,0 +1,465 @@
// Shim for IDV SpeedTreeRT 1.6.0 <SpeedTreeRT.h> (40250 extern/include): the public section below is
// the SDK header verbatim. SpeedTreeRT.lib is closed Windows COFF, so the private section is replaced
// by one opaque pointer and the members SpeedTreeLib calls are implemented in
// platform/SpeedTreeLib/SpeedTreeRT.cpp. <cstddef> stands in for the size_t the SDK got from <windows.h>.
#include <cstddef>
///////////////////////////////////////////////////////////////////////
// Name: SpeedTreeRT.h
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// Copyright (c) 2001-2003 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may not
// be copied or disclosed except in accordance with the terms of that
// agreement.
//
// Release version 1.6.0 (December 19, 2003)
#pragma once
// define static or dynamic library build
#ifdef SPEEDTREERT_DYNAMIC_LIB
#ifdef IDV_SPEEDTREERT_EXPORTS
#define BUILD_SPEED_TREE_RT_SET __declspec(dllexport)
#else
#define BUILD_SPEED_TREE_RT_SET __declspec(dllimport)
#endif
#else
#define BUILD_SPEED_TREE_RT_SET
#endif
// big or little endian system
#ifdef __ppc__
#define ST_BIG_ENDIAN
#else
#define ST_LITTLE_ENDIAN
#endif
// Macintosh-specific
#ifdef __ppc__
#pragma export on
#endif
// forward refernces
class CIndexedGeometry;
class CTreeEngine;
class CLeafGeometry;
class CLightingEngine;
class CWindEngine;
class CTreeFileAccess;
class CSimpleBillboard;
class CFrondEngine;
struct STreeInstanceData;
struct SInstanceList;
struct SEmbeddedTexCoords;
struct SCollisionObjects;
class CProjectedShadow;
///////////////////////////////////////////////////////////////////////
// class SpeedTreeRT
//
// In an effort to make the SpeedTreeRT.h header file dependency free
// and easy to include into almost any project, a number of steps have
// been taken:
//
// 1. No external header files need to be included by SpeedTreeRT.h
// or by the application before including it.
//
// 2. Most of the implementation of the class is hidden by pointers
// to the major sections of the library (the internal classes
// can then just be forward-referenced)
//
// 3. Where possible, basic C++ datatypes are used to define the
// member functions' parameters.
//
// Because almost all of the implementation details are hidden, none of
// the functions for CSpeedTreeRT are inlined. However, inlined functions
// were copiously used within the library.
class BUILD_SPEED_TREE_RT_SET CSpeedTreeRT
{
public:
///////////////////////////////////////////////////////////////////////
// Enumerations
enum EWindMethod
{
WIND_GPU, WIND_CPU, WIND_NONE
};
enum ELodMethod
{
LOD_POP, LOD_SMOOTH, LOD_NONE = 3
};
enum ELightingMethod
{
LIGHT_DYNAMIC, LIGHT_STATIC
};
enum EStaticLightingStyle
{
SLS_BASIC, SLS_USE_LIGHT_SOURCES, SLS_SIMULATE_SHADOWS
};
enum ECollisionObjectType
{
CO_SPHERE, CO_CYLINDER, CO_BOX
};
///////////////////////////////////////////////////////////////////////
// SGeometry bit vectors
//
// Passed into GetGeometry() in order to mask out unneeded geometric elements
#define SpeedTree_BranchGeometry (1 << 0)
#define SpeedTree_FrondGeometry (1 << 1)
#define SpeedTree_LeafGeometry (1 << 2)
#define SpeedTree_BillboardGeometry (1 << 3)
#define SpeedTree_SimpleBillboardOverride (1 << 4)
#define SpeedTree_AllGeometry SpeedTree_BranchGeometry + SpeedTree_FrondGeometry + SpeedTree_LeafGeometry + SpeedTree_BillboardGeometry
///////////////////////////////////////////////////////////////////////
// struct SGeometry declaration
struct BUILD_SPEED_TREE_RT_SET SGeometry
{
SGeometry( );
~SGeometry( );
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SIndexed declaration
struct BUILD_SPEED_TREE_RT_SET SIndexed
{
SIndexed( );
~SIndexed( );
// these values change depending on the active discrete LOD level
int m_nDiscreteLodLevel; // range: [0, GetNumBranch/FrondLodLevels( ) - 1], -1 if inactive
unsigned short m_usNumStrips; // total number of strips in current LOD
const unsigned short* m_pStripLengths; // lengths of strips in current LOD (m_usNumStrips in length)
const unsigned short** m_pStrips; // triangle strip indices (m_usNumStrips in length)
// these values are shared across all discete LOD levels
unsigned short m_usVertexCount; // total vertex count in tables, referenced by all LOD levels
const unsigned long* m_pColors; // RGBA values for each leaf - static lighting only (m_usVertexCount in length)
const float* m_pNormals; // normals for each vertex (3 * m_usVertexCount in length)
const float* m_pBinormals; // binormals (bump mapping) for each vertex (3 * m_usVertexCount in length)
const float* m_pTangents; // tangents (bump mapping) for each vertex (3 * m_usVertexCount in length)
const float* m_pCoords; // coordinates for each vertex (3 * m_usVertexCount in length)
const float* m_pTexCoords0; // 1st layer (s,t) texcoords for each vertex (2 * m_usVertexCount in length)
const float* m_pTexCoords1; // 2nd layer (s,t) texcoords for each vertex (2 * m_usVertexCount in length)
const float* m_pWindWeights; // values from from 0.0 for rigid to 1.0 for flexible (m_usVertexCount in length)
const unsigned char* m_pWindMatrixIndices; // table of wind matrix indices (m_usVertexCount in length)
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SLeaf declaration
struct BUILD_SPEED_TREE_RT_SET SLeaf
{
SLeaf( );
~SLeaf( );
// active LOD level data
bool m_bIsActive; // flag indicating visibility
float m_fAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
int m_nDiscreteLodLevel; // range: [0, GetNumLeafLodLevels( ) - 1]
unsigned short m_usLeafCount; // number of leaves stored in this structure
// tables for referencing the leaf cluster table
const unsigned char* m_pLeafMapIndices; // references which leaf texture map used for each leaf (m_usLeafCount in length)
const unsigned char* m_pLeafClusterIndices; // references which leaf cluster used for each leaf (m_usLeafCount in length)
const float* m_pCenterCoords; // (x,y,z) values for the centers of leaf clusters (3 * m_usLeafCount in length)
const float** m_pLeafMapTexCoords; // table of unique leaf cluster texcoords (m_usLeafCount in length) - each entry
// points to 4 pairs of (s,t) texcoords stored in one contiguous array
const float** m_pLeafMapCoords; // table of unique leaf cluster coordinates (m_usLeafCount in length) - each entry
// points to 4 sets of (x,y,z,0) coordinates stored in one contiguous array
// remaining vertex attributes
const unsigned long* m_pColors; // RGBA values for each leaf (m_usLeafCount in length)
const float* m_pNormals; // normals for each leaf (3 * m_usLeafCount in length)
const float* m_pBinormals; // binormals (bump mapping) for each leaf (3 * m_usLeafCount in length)
const float* m_pTangents; // tangents (bump mapping) for each leaf (3 * m_usLeafCount in length)
const float* m_pWindWeights; // values from from 0.0 for rigid to 1.0 for flexible (m_usLeafCount in length)
const unsigned char* m_pWindMatrixIndices; // table of wind matrix indices (m_usLeafCount in length)
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::SBillboard declaration
struct BUILD_SPEED_TREE_RT_SET SBillboard
{
SBillboard( );
~SBillboard( );
bool m_bIsActive; // flag indicating visibility
const float* m_pTexCoords; // 4 pairs of (s,t) texcoords stored in one contiguous array
const float* m_pCoords; // 4 sets of (x,y,z) coordindates stored in one contiguous array
float m_fAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
};
///////////////////////////////////////////////////////////////////////
// branch geometry
SIndexed m_sBranches; // holds the branch vertices and index buffers for all
// of the discrete LOD levels
float m_fBranchAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
///////////////////////////////////////////////////////////////////////
// frond geometry
SIndexed m_sFronds; // holds the frond vertices and index buffers for all
// of the discrete LOD levels
float m_fFrondAlphaTestValue; // 0.0 to 255.0 alpha testing value, used for fading
///////////////////////////////////////////////////////////////////////
// leaf geometry
SLeaf m_sLeaves0; // holds the primary leaf geometry, alpha fades into
SLeaf m_sLeaves1; // m_sLeaves1 during LOD transitions
///////////////////////////////////////////////////////////////////////
// billboard geometry
SBillboard m_sBillboard0; // holds the main simple billboard geometry, alpha fades
SBillboard m_sBillboard1; // into m_sBillboard1 in 360 degree mode
SBillboard m_sHorizontalBillboard; // optional horizontal billboard used for aerial views
};
///////////////////////////////////////////////////////////////////////
// struct SGeometry::STextures declaration
struct BUILD_SPEED_TREE_RT_SET STextures
{
STextures( );
~STextures( );
// branches
const char* m_pBranchTextureFilename; // null-terminated string
// leaves
unsigned int m_uiLeafTextureCount; // the number of char* elements in m_pLeafTextureFilenames
const char** m_pLeafTextureFilenames; // array of null-terminated strings m_uiLeafTextureCount in size
// fronds
unsigned int m_uiFrondTextureCount; // the number of char* elements in m_pFrondTextureFilenames
const char** m_pFrondTextureFilenames; // array of null-terminated strings m_uiFrondTextureCount in size
// composite
const char* m_pCompositeFilename; // null-terminated string
// self-shadow
const char* m_pSelfShadowFilename; // null-terminated string
};
///////////////////////////////////////////////////////////////////////
// Constructor/Destructor
CSpeedTreeRT( );
~CSpeedTreeRT( );
///////////////////////////////////////////////////////////////////////
// Memory allocation
static void* operator new(size_t nSize);
static void* operator new[](size_t nSize);
static void operator delete(void* pRawMemory);
static void operator delete[](void* pRawMemory);
///////////////////////////////////////////////////////////////////////
// Specifying a tree model
bool Compute(const float* pTransform = 0, unsigned int nSeed = 1, bool bCompositeStrips = true);
CSpeedTreeRT* Clone(float x = 0.0f, float y = 0.0f, float z = 0.0f, unsigned int nSeed = 0) const;
const CSpeedTreeRT* InstanceOf(void) const;
CSpeedTreeRT* MakeInstance(void);
void DeleteTransientData(void);
bool LoadTree(const char* pFilename);
bool LoadTree(const unsigned char* pBlock, unsigned int nNumBytes);
// PORT: supply the pack path when LoadTree receives only a memory block.
void SetSourceName(const char* pFilename);
unsigned char* SaveTree(unsigned int& nNumBytes, bool bSaveLeaves = false) const;
void GetTreeSize(float& fSize, float& fVariance) const;
void SetTreeSize(float fNewSize, float fNewVariance = 0.0f);
unsigned int GetSeed( ) const;
const float* GetTreePosition(void) const;
void SetTreePosition(float x, float y, float z);
void SetLeafTargetAlphaMask(unsigned char ucMask = 0x54);
///////////////////////////////////////////////////////////////////////
// Lighting
// lighting style
ELightingMethod GetBranchLightingMethod(void) const;
void SetBranchLightingMethod(ELightingMethod eMethod);
ELightingMethod GetLeafLightingMethod(void) const;
void SetLeafLightingMethod(ELightingMethod eMethod);
ELightingMethod GetFrondLightingMethod(void) const;
void SetFrondLightingMethod(ELightingMethod eMethod);
EStaticLightingStyle GetStaticLightingStyle(void) const;
void SetStaticLightingStyle(EStaticLightingStyle eStyle);
float GetLeafLightingAdjustment( ) const;
void SetLeafLightingAdjustment(float fScalar);
// global lighting state
static bool GetLightState(unsigned int nLightIndex);
static void SetLightState(unsigned int nLightIndex, bool bLightOn);
static const float* GetLightAttributes(unsigned int nLightIndex);
static void SetLightAttributes(unsigned int nLightIndex, const float* pLightAttributes);
// branch material
const float* GetBranchMaterial(void) const;
void SetBranchMaterial(const float* pMaterial);
// leaf material
const float* GetLeafMaterial(void) const;
void SetLeafMaterial(const float* pMaterial);
// frond material
const float* GetFrondMaterial(void) const;
void SetFrondMaterial(const float* pMaterial);
///////////////////////////////////////////////////////////////////////
// Camera
static void GetCamera(float* pPosition, float* pDirection);
static void SetCamera(const float* pPosition, const float* pDirection);
///////////////////////////////////////////////////////////////////////
// Wind
static void SetTime(float fTime);
void ComputeWindEffects(bool bBranches, bool bLeaves, bool bFronds = true);
void ResetLeafWindState(void);
bool GetLeafRockingState(void) const;
void SetLeafRockingState(bool bFlag);
void SetNumLeafRockingGroups(unsigned int nRockingGroups);
EWindMethod GetLeafWindMethod(void) const;
void SetLeafWindMethod(EWindMethod eMethod);
EWindMethod GetBranchWindMethod(void) const;
void SetBranchWindMethod(EWindMethod eMethod);
EWindMethod GetFrondWindMethod(void) const;
void SetFrondWindMethod(EWindMethod eMethod);
float GetWindStrength(void) const;
float SetWindStrength(float fNewStrength, float fOldStrength = -1.0f, float fFrequencyTimeOffset = -1.0f);
static void SetNumWindMatrices(unsigned int nNumMatrices);
static void SetWindMatrix(unsigned int nMatrixIndex, const float* pMatrix);
void GetLocalMatrices(unsigned int& nStartingIndex, unsigned int& nMatrixSpan);
void SetLocalMatrices(unsigned int nStartingMatrix, unsigned int nMatrixSpan);
///////////////////////////////////////////////////////////////////////
// LOD
void ComputeLodLevel(void);
float GetLodLevel(void) const;
void SetLodLevel(float fLodLevel);
static void SetDropToBillboard(bool bFlag);
void GetLodLimits(float& fNear, float& fFar) const;
void SetLodLimits(float fNear, float fFar);
short GetDiscreteBranchLodLevel(float fLodLevel = -1.0f) const;
unsigned short GetDiscreteLeafLodLevel(float fLodLevel = -1.0f) const;
short GetDiscreteFrondLodLevel(float fLodLevel = -1.0f) const;
unsigned short GetNumBranchLodLevels(void) const;
unsigned short GetNumLeafLodLevels(void) const;
unsigned short GetNumFrondLodLevels(void) const;
///////////////////////////////////////////////////////////////////////
// Geometry
void DeleteBranchGeometry(void);
void DeleteFrondGeometry(void);
unsigned char* GetFrondGeometryMapIndexes(int nLodLevel) const;
const float* GetLeafBillboardTable(unsigned int& nEntryCount) const;
const float* GetLeafLodSizeAdjustments(void);
void GetGeometry(SGeometry& sGeometry, unsigned long ulBitVector = SpeedTree_AllGeometry, short sOverrideBranchLodValue = -1, short sOverrideFrondLodValue = -1, short sOverrideLeafLodValue = -1);
///////////////////////////////////////////////////////////////////////
// Textures
void GetTextures(STextures& sTextures) const;
void SetLeafTextureCoords(unsigned int nLeafMapIndex, const float* pTexCoords);
void SetFrondTextureCoords(unsigned int nFrondMapIndex, const float* pTexCoords);
static bool GetTextureFlip(void);
static void SetTextureFlip(bool bFlag);
void SetBranchTextureFilename(const char* pFilename);
void SetLeafTextureFilename(unsigned int nLeafMapIndex, const char* pFilename);
void SetFrondTextureFilename(unsigned int nFrondMapIndex, const char* pFilename);
///////////////////////////////////////////////////////////////////////
// Statistics & information
static void Authorize(const char* pKey);
static bool IsAuthorized(void);
static const char* GetCurrentError(void);
static void ResetError(void);
void GetBoundingBox(float* pBounds) const;
unsigned int GetLeafTriangleCount(float fLodLevel = -1.0f) const;
unsigned int GetBranchTriangleCount(float fLodLevel = -1.0f) const;
unsigned int GetFrondTriangleCount(float fLodLevel = -1.0f) const;
///////////////////////////////////////////////////////////////////////
// Collision objects
unsigned int GetCollisionObjectCount(void);
void GetCollisionObject(unsigned int nIndex, ECollisionObjectType& eType, float* pPosition, float* pDimensions);
///////////////////////////////////////////////////////////////////////
// User Data
const char* GetUserData(void) const;
private:
// PORT: the SDK's private engine members (m_pEngine .. m_afHorizontalCoords) are opaque here.
struct SImpl;
SImpl* m_pImpl;
CSpeedTreeRT(const CSpeedTreeRT&) = delete;
CSpeedTreeRT& operator=(const CSpeedTreeRT&) = delete;
};
// Macintosh-specific
#ifdef __ppc__
#pragma export off
#endif
@@ -0,0 +1,3 @@
#pragma once
// Shim for 40250's <cryptopp/cryptoppLibLink.h>, which only holds MSVC `#pragma comment(lib, ...)` auto-link
// lines; the vendored Crypto++ (mt3p::cryptopp) is linked by CMake.
+5
View File
@@ -0,0 +1,5 @@
#pragma once
// Shim for <d3d8.h>: the D3D8 value types 40250 logic uses as data. Rendering goes through
// platform/, never through these declarations. The real header pulls in <string.h> (objbase.h).
#include <string.h>
#include "../../D3DXMath.h"
+3
View File
@@ -0,0 +1,3 @@
#pragma once
// Shim for <d3d8types.h>; see d3d8.h.
#include "d3d8.h"
+43
View File
@@ -0,0 +1,43 @@
#pragma once
// Shim for <d3dx8.h>: platform-independent D3DX8 math (common/D3DXMath.h); D3DX objects are
// opaque, owned by platform/.
#include "d3d8.h"
// d3dx8core.h ID3DXBuffer / D3DXAssembleShader. There is no D3D8 shader assembler here:
// D3DXAssembleShader fails with no code and no error buffer.
struct ID3DXBuffer
{
virtual ~ID3DXBuffer() = default;
virtual ULONG Release() = 0;
virtual void* GetBufferPointer() = 0;
virtual DWORD GetBufferSize() = 0;
};
typedef ID3DXBuffer* LPD3DXBUFFER;
inline HRESULT D3DXAssembleShader(const void*, UINT, DWORD, LPD3DXBUFFER* ppConstants, LPD3DXBUFFER* ppCompiledShader, LPD3DXBUFFER* ppCompilationErrors)
{
if (ppConstants)
*ppConstants = nullptr;
if (ppCompiledShader)
*ppCompiledShader = nullptr;
if (ppCompilationErrors)
*ppCompilationErrors = nullptr;
return E_FAIL;
}
struct ID3DXMesh;
typedef ID3DXMesh* LPD3DXMESH;
struct ID3DXMatrixStack;
typedef ID3DXMatrixStack* LPD3DXMATRIXSTACK;
// d3dx8tex.h filter flags
#define D3DX_DEFAULT ((UINT)-1)
#define D3DX_FILTER_NONE (1 << 0)
#define D3DX_FILTER_POINT (2 << 0)
#define D3DX_FILTER_LINEAR (3 << 0)
#define D3DX_FILTER_TRIANGLE (4 << 0)
#define D3DX_FILTER_BOX (5 << 0)
#define D3DX_FILTER_MIRROR_U (1 << 16)
#define D3DX_FILTER_MIRROR_V (2 << 16)
#define D3DX_FILTER_MIRROR_W (4 << 16)
#define D3DX_FILTER_MIRROR (7 << 16)
#define D3DX_FILTER_DITHER (8 << 16)
+424
View File
@@ -0,0 +1,424 @@
#pragma once
// Shim for RAD Granny 2.11 <granny.h> (40250 extern/include): the scalar types, the public data structs
// EterGrnLib reads (SDK field names and order) and the functions it calls. The file-data structs are
// built from libgr2 and the runtime objects (file, model instance, control, pose, binding, deformer)
// stay opaque; both live in platform/EterGrnLib/GrannyRuntime.cpp.
#include <stdint.h>
typedef uint32_t granny_uint32;
typedef int32_t granny_int32;
typedef uint16_t granny_uint16;
typedef int16_t granny_int16;
typedef uint8_t granny_uint8;
typedef int8_t granny_int8;
typedef float granny_real32;
typedef double granny_real64x;
typedef granny_uint32 granny_bool32;
typedef granny_int32 granny_int32x;
typedef granny_uint32 granny_uint32x;
typedef uintptr_t granny_uintaddrx;
typedef granny_real32 granny_triple[3];
typedef granny_real32 granny_quad[4];
typedef granny_real32 granny_matrix_4x4[4][4];
typedef enum granny_member_type
{
GrannyEndMember,
GrannyInlineMember,
GrannyReferenceMember,
GrannyReferenceToArrayMember,
GrannyArrayOfReferencesMember,
GrannyVariantReferenceMember,
GrannyUnsupportedMemberType_Remove,
GrannyReferenceToVariantArrayMember,
GrannyStringMember,
GrannyTransformMember,
GrannyReal32Member,
GrannyInt8Member,
GrannyUInt8Member,
GrannyBinormalInt8Member,
GrannyNormalUInt8Member,
GrannyInt16Member,
GrannyUInt16Member,
GrannyBinormalInt16Member,
GrannyNormalUInt16Member,
GrannyInt32Member,
GrannyUInt32Member,
GrannyReal16Member,
GrannyEmptyReferenceMember,
GrannyOnePastLastMemberType,
GrannyBool32Member = GrannyInt32Member,
Grannymember_type_forceint = 0x7fffffff
} granny_member_type;
typedef enum granny_material_texture_type
{
GrannyUnknownTextureType,
GrannyAmbientColorTexture,
GrannyDiffuseColorTexture,
GrannySpecularColorTexture,
GrannySelfIlluminationTexture,
GrannyOpacityTexture,
GrannyBumpHeightTexture,
GrannyReflectionTexture,
GrannyRefractionTexture,
GrannyDisplacementTexture,
GrannyOnePastLastMaterialTextureType,
Grannymaterial_texture_type_forceint = 0x7fffffff
} granny_material_texture_type;
typedef enum granny_deformation_type
{
GrannyDeformPosition = 1,
GrannyDeformPositionNormal,
GrannyDeformPositionNormalTangent,
GrannyDeformPositionNormalTangentBinormal,
Grannydeformation_type_forceint = 0x7fffffff
} granny_deformation_type;
typedef enum granny_deformer_tail_flags
{
GrannyDontAllowUncopiedTail,
GrannyAllowUncopiedTail,
GrannyAllowUninitializedDestTail,
Grannydeformer_tail_flags_forceint = 0x7fffffff
} granny_deformer_tail_flags;
typedef enum granny_standard_section_index
{
GrannyStandardMainSection = 0,
GrannyStandardRigidVertexSection = 1,
GrannyStandardRigidIndexSection = 2,
GrannyStandardDeformableVertexSection = 3,
GrannyStandardDeformableIndexSection = 4,
GrannyStandardTextureSection = 5,
GrannyStandardDiscardableSection = 6,
GrannyStandardUnloadedSection = 7,
GrannyStandardSectionCount = 8,
Grannystandard_section_index_forceint = 0x7fffffff
} granny_standard_section_index;
typedef enum granny_log_message_type
{
GrannyIgnoredLogMessage,
GrannyNoteLogMessage,
GrannyWarningLogMessage,
GrannyErrorLogMessage,
GrannyOnePastLastMessageType,
Grannylog_message_type_forceint = 0x7fffffff
} granny_log_message_type;
typedef granny_int32 granny_log_message_origin;
#define GrannyVertexPositionName "Position"
#define GrannyVertexNormalName "Normal"
#define GrannyVertexTangentName "Tangent"
#define GrannyVertexBinormalName "Binormal"
#define GrannyVertexTangentBinormalCrossName "TangentBinormalCross"
#define GrannyVertexBoneWeightsName "BoneWeights"
#define GrannyVertexBoneIndicesName "BoneIndices"
#define GrannyVertexDiffuseColorName "DiffuseColor"
#define GrannyVertexSpecularColorName "SpecularColor"
#define GrannyVertexTextureCoordinatesName "TextureCoordinates"
#define GrannyVertexMorphCurvePrefix "VertexMorphCurve"
struct granny_data_type_definition
{
granny_member_type Type;
char const* Name;
granny_data_type_definition* ReferenceType;
granny_int32 ArrayWidth;
granny_int32 Extra[3];
granny_uintaddrx Ignored_Ignored;
};
struct granny_animation;
struct granny_bone;
struct granny_control;
struct granny_file;
struct granny_local_pose;
struct granny_material;
struct granny_mesh;
struct granny_mesh_binding;
struct granny_mesh_deformer;
struct granny_model;
struct granny_model_instance;
struct granny_skeleton;
struct granny_texture;
struct granny_world_pose;
struct granny_conversion_handler;
struct granny_variant
{
granny_data_type_definition* Type;
void* Object;
};
struct granny_transform
{
granny_uint32 Flags;
granny_triple Position;
granny_quad Orientation;
granny_triple ScaleShear[3];
};
struct granny_texture
{
char const* FromFileName;
granny_int32 TextureType;
granny_int32 Width;
granny_int32 Height;
granny_int32 Encoding;
granny_int32 SubFormat;
granny_variant ExtendedData;
};
struct granny_material_map
{
char const* Usage;
granny_material* Material;
};
struct granny_material
{
char const* Name;
granny_int32 MapCount;
granny_material_map* Maps;
granny_texture* Texture;
granny_variant ExtendedData;
};
struct granny_bone
{
char const* Name;
granny_int32 ParentIndex;
granny_transform LocalTransform;
granny_matrix_4x4 InverseWorld4x4;
granny_real32 LODError;
granny_variant ExtendedData;
};
struct granny_skeleton
{
char const* Name;
granny_int32 BoneCount;
granny_bone* Bones;
granny_int32 LODType;
granny_variant ExtendedData;
};
struct granny_vertex_data
{
granny_data_type_definition* VertexType;
granny_int32 VertexCount;
granny_uint8* Vertices;
granny_int32 VertexComponentNameCount;
char const** VertexComponentNames;
};
struct granny_tri_material_group
{
granny_int32 MaterialIndex;
granny_int32 TriFirst;
granny_int32 TriCount;
};
struct granny_tri_topology
{
granny_int32 GroupCount;
granny_tri_material_group* Groups;
granny_int32 IndexCount;
granny_int32* Indices;
granny_int32 Index16Count;
granny_uint16* Indices16;
};
struct granny_material_binding
{
granny_material* Material;
};
struct granny_bone_binding
{
char const* BoneName;
granny_triple OBBMin;
granny_triple OBBMax;
granny_int32 TriangleCount;
granny_int32* TriangleIndices;
};
struct granny_mesh
{
char const* Name;
granny_vertex_data* PrimaryVertexData;
granny_int32 MorphTargetCount;
void* MorphTargets;
granny_tri_topology* PrimaryTopology;
granny_int32 MaterialBindingCount;
granny_material_binding* MaterialBindings;
granny_int32 BoneBindingCount;
granny_bone_binding* BoneBindings;
granny_variant ExtendedData;
};
struct granny_model_mesh_binding
{
granny_mesh* Mesh;
};
struct granny_model
{
char const* Name;
granny_skeleton* Skeleton;
granny_transform InitialPlacement;
granny_int32 MeshBindingCount;
granny_model_mesh_binding* MeshBindings;
granny_variant ExtendedData;
};
struct granny_text_track_entry
{
granny_real32 TimeStamp;
char const* Text;
};
struct granny_text_track
{
char const* Name;
granny_int32 EntryCount;
granny_text_track_entry* Entries;
};
struct granny_track_group
{
char const* Name;
granny_int32 TextTrackCount;
granny_text_track* TextTracks;
granny_transform InitialPlacement;
granny_int32 Flags;
granny_variant ExtendedData;
};
struct granny_animation
{
char const* Name;
granny_real32 Duration;
granny_real32 TimeStep;
granny_real32 Oversampling;
granny_int32 TrackGroupCount;
granny_track_group** TrackGroups;
granny_int32 DefaultLoopCount;
granny_int32 Flags;
granny_variant ExtendedData;
};
struct granny_file_info
{
char const* FromFileName;
granny_int32 TextureCount;
granny_texture** Textures;
granny_int32 MaterialCount;
granny_material** Materials;
granny_int32 SkeletonCount;
granny_skeleton** Skeletons;
granny_int32 MeshCount;
granny_mesh** Meshes;
granny_int32 ModelCount;
granny_model** Models;
granny_int32 AnimationCount;
granny_animation** Animations;
granny_variant ExtendedData;
};
struct granny_system_clock
{
granny_uint32 Data[4];
};
typedef void granny_log_function(granny_log_message_type Type, granny_log_message_origin Origin,
char const* File, granny_int32x Line, char const* Message, void* UserData);
struct granny_log_callback
{
granny_log_function* Function;
void* UserData;
};
extern granny_data_type_definition* GrannyPNT332VertexType;
// Files
granny_file* GrannyReadEntireFileFromMemory(granny_int32x MemorySize, void const* Memory);
granny_file_info* GrannyGetFileInfo(granny_file* File);
void GrannyFreeFile(granny_file* File);
void GrannyFreeFileSection(granny_file* File, granny_int32x SectionIndex);
void GrannySetLogCallback(granny_log_callback const* LogCallback);
// Data types
granny_int32x GrannyGetTotalTypeSize(granny_data_type_definition const* TypeDefinition);
bool GrannyFindMatchingMember(granny_data_type_definition const* SourceType, void const* SourceObject,
char const* DestMemberName, granny_variant* Result);
void GrannyConvertSingleObject(granny_data_type_definition const* SourceType, void const* SourceObject,
granny_data_type_definition const* DestType, void* DestObject,
granny_conversion_handler* OverrideHandler);
// Materials, skeletons, meshes
granny_texture* GrannyGetMaterialTextureByType(granny_material const* Material, granny_material_texture_type Type);
bool GrannyFindBoneByName(granny_skeleton const* Skeleton, char const* BoneName, granny_int32x* BoneIndex);
bool GrannyMeshIsRigid(granny_mesh const* Mesh);
granny_int32x GrannyGetMeshVertexCount(granny_mesh const* Mesh);
granny_data_type_definition* GrannyGetMeshVertexType(granny_mesh const* Mesh);
void* GrannyGetMeshVertices(granny_mesh const* Mesh);
void GrannyCopyMeshVertices(granny_mesh const* Mesh, granny_data_type_definition const* VertexType, void* DestVertices);
granny_int32x GrannyGetMeshIndexCount(granny_mesh const* Mesh);
void GrannyCopyMeshIndices(granny_mesh const* Mesh, granny_int32x BytesPerIndex, void* DestIndices);
granny_int32x GrannyGetMeshTriangleGroupCount(granny_mesh const* Mesh);
granny_tri_material_group* GrannyGetMeshTriangleGroups(granny_mesh const* Mesh);
// Mesh binding and deformation
granny_mesh_binding* GrannyNewMeshBinding(granny_mesh const* Mesh, granny_skeleton const* FromSkeleton, granny_skeleton const* ToSkeleton);
void GrannyFreeMeshBinding(granny_mesh_binding* Binding);
granny_int32x const* GrannyGetMeshBindingToBoneIndices(granny_mesh_binding const* Binding);
granny_mesh_deformer* GrannyNewMeshDeformer(granny_data_type_definition const* InputVertexLayout,
granny_data_type_definition const* OutputVertexLayout,
granny_deformation_type DeformationType, granny_deformer_tail_flags TailFlag);
void GrannyFreeMeshDeformer(granny_mesh_deformer* Deformer);
void GrannyDeformVertices(granny_mesh_deformer const* Deformer, granny_int32x const* MatrixIndices,
granny_real32 const* MatrixBuffer4x4, granny_int32x VertexCount,
void const* SourceVertices, void* DestVertices);
// Model instances and controls
granny_model_instance* GrannyInstantiateModel(granny_model const* Model);
void GrannyFreeModelInstance(granny_model_instance* ModelInstance);
granny_skeleton* GrannyGetSourceSkeleton(granny_model_instance const* Model);
void GrannySetModelClock(granny_model_instance const* ModelInstance, granny_real32 NewClock);
void GrannyFreeCompletedModelControls(granny_model_instance const* ModelInstance);
void GrannyUpdateModelMatrix(granny_model_instance const* ModelInstance, granny_real32 SecondsElapsed,
granny_real32 const* ModelMatrix4x4, granny_real32* DestMatrix4x4, bool Inverse);
granny_control* GrannyPlayControlledAnimation(granny_real32 StartTime, granny_animation const* Animation, granny_model_instance* Model);
void GrannyFreeControl(granny_control* Control);
void GrannyFreeControlOnceUnused(granny_control* Control);
bool GrannyFreeControlIfComplete(granny_control* Control);
bool GrannyControlIsComplete(granny_control const* Control);
void GrannyCompleteControlAt(granny_control* Control, granny_real32 AtSeconds);
void GrannySetControlSpeed(granny_control* Control, granny_real32 Speed);
granny_real32 GrannyGetControlSpeed(granny_control const* Control);
void GrannySetControlLoopCount(granny_control* Control, granny_int32x LoopCount);
granny_int32x GrannyGetControlLoopCount(granny_control const* Control);
void GrannySetControlRawLocalClock(granny_control* Control, granny_real32 LocalClock);
granny_real32 GrannyGetControlRawLocalClock(granny_control* Control);
granny_real32 GrannyGetControlLocalDuration(granny_control const* Control);
void GrannySetControlEaseIn(granny_control* Control, bool EaseIn);
void GrannySetControlEaseOut(granny_control* Control, bool EaseOut);
void GrannySetControlEaseInCurve(granny_control* Control, granny_real32 StartSeconds, granny_real32 EndSeconds,
granny_real32 StartValue, granny_real32 StartTangent, granny_real32 EndTangent, granny_real32 EndValue);
void GrannySetControlEaseOutCurve(granny_control* Control, granny_real32 StartSeconds, granny_real32 EndSeconds,
granny_real32 StartValue, granny_real32 StartTangent, granny_real32 EndTangent, granny_real32 EndValue);
// Poses
granny_local_pose* GrannyNewLocalPose(granny_int32x BoneCount);
void GrannyFreeLocalPose(granny_local_pose* LocalPose);
granny_world_pose* GrannyNewWorldPose(granny_int32x BoneCount);
void GrannyFreeWorldPose(granny_world_pose* WorldPose);
void GrannySampleModelAnimationsAccelerated(granny_model_instance const* ModelInstance, granny_int32x BoneCount,
granny_real32 const* Offset4x4, granny_local_pose* Scratch, granny_world_pose* Result);
granny_real32* GrannyGetWorldPose4x4(granny_world_pose const* WorldPose, granny_int32x BoneIndex);
granny_real32* GrannyGetWorldPoseComposite4x4(granny_world_pose const* WorldPose, granny_int32x BoneIndex);
granny_matrix_4x4* GrannyGetWorldPoseComposite4x4Array(granny_world_pose const* WorldPose);
+53
View File
@@ -0,0 +1,53 @@
#pragma once
// DevIL interface needed by 40250 app.GetImageInfo / MarkImage / GuildMarkUploader.
typedef unsigned int ILenum;
typedef unsigned char ILboolean;
typedef unsigned int ILbitfield;
typedef char ILbyte;
typedef short ILshort;
typedef int ILint;
typedef int ILsizei;
typedef unsigned char ILubyte;
typedef unsigned short ILushort;
typedef unsigned int ILuint;
typedef float ILfloat;
typedef double ILdouble;
typedef void ILvoid;
typedef const char* ILstring;
#define IL_FALSE 0
#define IL_TRUE 1
#define IL_RGB 0x1907
#define IL_RGBA 0x1908
#define IL_BGRA 0x80E1
#define IL_BYTE 0x1400
#define IL_UNSIGNED_BYTE 0x1401
#define IL_TYPE_UNKNOWN 0x0000
#define IL_TGA 0x042D
#define IL_ORIGIN_SET 0x0600
#define IL_ORIGIN_UPPER_LEFT 0x0602
#define IL_FILE_OVERWRITE 0x0DE3
#define IL_IMAGE_WIDTH 0x0DE4
#define IL_IMAGE_HEIGHT 0x0DE5
void ilInit();
void ilShutDown();
void ilEnable(ILenum mode);
void ilDisable(ILenum mode);
void ilOriginFunc(ILenum mode);
void ilGenImages(ILsizei count, ILuint* images);
void ilBindImage(ILuint image);
void ilDeleteImages(ILsizei count, const ILuint* images);
bool ilLoad(ILenum type, const ILstring filename);
bool ilSave(ILenum type, const ILstring filename);
int ilGetInteger(ILenum mode);
bool ilConvertImage(ILenum destFormat, ILenum destType);
bool ilTexImage(ILuint width, ILuint height, ILuint depth, ILubyte bpp, ILenum format, ILenum type, void* data);
ILuint ilCopyPixels(ILuint xOff, ILuint yOff, ILuint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data);
void ilSetPixels(ILint xOff, ILint yOff, ILint zOff, ILuint width, ILuint height, ILuint depth, ILenum format, ILenum type, void* data);
@@ -0,0 +1,3 @@
#pragma once
// Shim for 40250's <lzo/lzoLibLink.h>, which only holds MSVC `#pragma comment(lib, ...)` auto-link lines;
// the vendored minilzo (mt3p::minilzo) is linked by CMake.
+26
View File
@@ -0,0 +1,26 @@
#pragma once
// Shim for Miles Sound System <mss.h>: the scalar types and opaque handles 40250's MilesLib
// headers name. Playback goes through platform/, never through these declarations.
#include "../../Win32Types.h"
typedef int32_t S32;
typedef uint32_t U32;
typedef float F32;
typedef int16_t S16;
typedef uint16_t U16;
typedef int8_t S8;
typedef uint8_t U8;
#define AILCALLBACK
#define AILEXPORT
struct _SAMPLE;
struct _STREAM;
struct _DIG_DRIVER;
struct _H3DSAMPLE;
typedef _SAMPLE* HSAMPLE;
typedef _STREAM* HSTREAM;
typedef _DIG_DRIVER* HDIGDRIVER;
typedef void* H3DPOBJECT;
typedef H3DPOBJECT H3DSAMPLE;
typedef U32 HPROVIDER;