Skip to content

Commit 473dae7

Browse files
author
aramis_acg
committed
+ add Delphi Units to access the C DLL interface to /port. Thansk to Ed Diana for the patch. This relates to tracker id [3212646] (https://sourceforge.net/tracker/?func=detail&aid=3212646&group_id=226462&atid=1067634)
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@945 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
1 parent 2c83543 commit 473dae7

14 files changed

+508
-2
lines changed

CREDITS

+5-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,14 @@ Contributed a fix for the Normalize method in aiQuaternion.
104104
- dbburgess
105105
Contributes a Android-specific build issue: log the hardware architecture for ARM.
106106

107-
- alfiereinre7
107+
- alfiereinre7
108108
Contributes a obj-fileparser fix: missing tokens in the obj-token list.
109109

110110
- Roman Kharitonov
111111
Contributes a fix for the configure script environment.
112112

113-
-rdb
113+
- Ed Diana
114+
Contributed AssimpDelphi (/port/AssimpDelphi).
115+
116+
- rdb
114117
Contributes a bundle of fixes and improvments for the bsp-importer.

port/AssimpDelphi/Readme.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This is a set of Delphi units for using the Assimp C DLL. This was created for use with Delphi 7, but should be usable as-is or with minimal modifications with later Delphi versions.
2+
3+
This set of headers is enough to load and display a model with external textures. Since I'm not familiar with animated models and some of the other functionality of the assimp library, I did not convert the headers for those features.
4+
5+
See http://sourceforge.net/tracker/?func=detail&aid=3212646&group_id=226462&atid=1067634 for the original patch
6+

port/AssimpDelphi/aiColor4D.pas

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
unit aiColor4D;
2+
3+
interface
4+
5+
const AI_MAX_NUMBER_OF_COLOR_SETS = $04;
6+
7+
type TaiColor4D = packed record
8+
r, g, b, a: single;
9+
end;
10+
type PaiColor4D = ^TaiColor4D;
11+
12+
type TaiColor4DArray = array[0..0] of TaiColor4D;
13+
type PTaiColor4DArray = ^TaiColor4DArray;
14+
15+
implementation
16+
17+
end.

port/AssimpDelphi/aiMaterial.pas

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
unit aiMaterial;
2+
3+
interface
4+
5+
uses aiTypes, aiVector2D, aiVector3D;
6+
7+
{This following directive causes enums to be stored as double words (32bit), to be compatible with
8+
the assimp C Dll}
9+
{$Z4}
10+
11+
type TaiTextureOp = (
12+
aiTextureOp_Multiply = $0,
13+
aiTextureOp_Add = $1,
14+
aiTextureOp_Subtract = $2,
15+
aiTextureOp_Divide = $3,
16+
aiTextureOp_SmoothAdd = $4,
17+
aiTextureOp_SignedAdd = $5
18+
//_aiTextureOp_Force32Bit = 0x9fffffff
19+
);
20+
21+
type TaiTextureMapMode = (
22+
aiTextureMapMode_Wrap = $0,
23+
aiTextureMapMode_Clamp = $1,
24+
aiTextureMapMode_Decal = $3,
25+
aiTextureMapMode_Mirror = $2
26+
//_aiTextureMapMode_Force32Bit = 0x9fffffff
27+
);
28+
29+
type TaiTextureMapping = (
30+
aiTextureMapping_UV = $0,
31+
aiTextureMapping_SPHERE = $1,
32+
aiTextureMapping_CYLINDER = $2,
33+
aiTextureMapping_BOX = $3,
34+
aiTextureMapping_PLANE = $4,
35+
aiTextureMapping_OTHER = $5
36+
//_aiTextureMapping_Force32Bit = 0x9fffffff
37+
);
38+
39+
type TaiTextureType = (
40+
aiTextureType_NONE = $0,
41+
aiTextureType_DIFFUSE = $1,
42+
aiTextureType_SPECULAR = $2,
43+
aiTextureType_AMBIENT = $3,
44+
aiTextureType_EMISSIVE = $4,
45+
aiTextureType_HEIGHT = $5,
46+
aiTextureType_NORMALS = $6,
47+
aiTextureType_SHININESS = $7,
48+
aiTextureType_OPACITY = $8,
49+
aiTextureType_DISPLACEMENT = $9,
50+
aiTextureType_LIGHTMAP = $A,
51+
aiTextureType_REFLECTION = $B,
52+
aiTextureType_UNKNOWN = $C
53+
//_aiTextureType_Force32Bit = 0x9fffffff
54+
);
55+
56+
const AI_TEXTURE_TYPE_MAX = aiTextureType_UNKNOWN;
57+
58+
type TaiShadingMode = (
59+
aiShadingMode_Flat = $1,
60+
aiShadingMode_Gouraud = $2,
61+
aiShadingMode_Phong = $3,
62+
aiShadingMode_Blinn = $4,
63+
aiShadingMode_Toon = $5,
64+
aiShadingMode_OrenNayar = $6,
65+
aiShadingMode_Minnaert = $7,
66+
aiShadingMode_CookTorrance = $8,
67+
aiShadingMode_NoShading = $9,
68+
aiShadingMode_Fresnel = $A
69+
//_aiShadingMode_Force32Bit = 0x9fffffff
70+
);
71+
72+
73+
type TaiTextureFlags = (
74+
aiTextureFlags_Invert = $1,
75+
aiTextureFlags_UseAlpha = $2,
76+
aiTextureFlags_IgnoreAlpha = $4
77+
//_aiTextureFlags_Force32Bit = 0x9fffffff
78+
);
79+
80+
type TaiBlendMode = (
81+
aiBlendMode_Default = $0,
82+
aiBlendMode_Additive = $1
83+
//_aiBlendMode_Force32Bit = 0x9fffffff
84+
);
85+
86+
type TaiUVTransform = packed record
87+
mTranslation: TaiVector2D;
88+
mScaling: TaiVector2D;
89+
mRotation: single;
90+
end;
91+
92+
type TaiPropertyTypeInfo = (
93+
aiPTI_Float = $1,
94+
aiPTI_String = $3,
95+
aiPTI_Integer = $4,
96+
aiPTI_Buffer = $5
97+
// _aiPTI_Force32Bit = 0x9fffffff
98+
);
99+
100+
type TaiMaterialProperty = packed record
101+
mKey: aiString;
102+
mSemantic: Cardinal;
103+
mIndex: Cardinal;
104+
mDataLength: Cardinal;
105+
mType: TaiPropertyTypeInfo;
106+
mData: PChar;
107+
end;
108+
type PaiMaterialProperty = ^TaiMaterialProperty;
109+
110+
type TaiMaterial = packed record
111+
mProperties: pointer;
112+
mNumProperties: Cardinal;
113+
mNumAllocated: Cardinal;
114+
end;
115+
type PaiMaterial = ^TaiMaterial;
116+
type PaiMaterialArray = array[0..0] of PaiMaterial;
117+
type PPaiMaterialArray = ^PaiMaterialArray;
118+
119+
const AI_MATKEY_NAME = '?mat.name';
120+
const AI_MATKEY_TWOSIDED = '$mat.twosided';
121+
const AI_MATKEY_SHADING_MODEL = '$mat.shadingm';
122+
const AI_MATKEY_ENABLE_WIREFRAME = '$mat.wireframe';
123+
const AI_MATKEY_BLEND_FUNC = '$mat.blend';
124+
const AI_MATKEY_OPACITY = '$mat.opacity';
125+
const AI_MATKEY_BUMPSCALING = '$mat.bumpscaling';
126+
const AI_MATKEY_SHININESS = '$mat.shininess';
127+
const AI_MATKEY_REFLECTIVITY = '$mat.reflectivity';
128+
const AI_MATKEY_SHININESS_STRENGTH = '$mat.shinpercent';
129+
const AI_MATKEY_REFRACTI = '$mat.refracti';
130+
const AI_MATKEY_COLOR_DIFFUSE = '$clr.diffuse';
131+
const AI_MATKEY_COLOR_AMBIENT = '$clr.ambient';
132+
const AI_MATKEY_COLOR_SPECULAR = '$clr.specular';
133+
const AI_MATKEY_COLOR_EMISSIVE = '$clr.emissive';
134+
const AI_MATKEY_COLOR_TRANSPARENT = '$clr.transparent';
135+
const AI_MATKEY_COLOR_REFLECTIVE = '$clr.reflective';
136+
const AI_MATKEY_GLOBAL_BACKGROUND_IMAGE = '?bg.global';
137+
138+
const _AI_MATKEY_TEXTURE_BASE = '$tex.file';
139+
const _AI_MATKEY_UVWSRC_BASE = '$tex.uvwsrc';
140+
const _AI_MATKEY_TEXOP_BASE = '$tex.op';
141+
const _AI_MATKEY_MAPPING_BASE = '$tex.mapping';
142+
const _AI_MATKEY_TEXBLEND_BASE = '$tex.blend';
143+
const _AI_MATKEY_MAPPINGMODE_U_BASE = '$tex.mapmodeu';
144+
const _AI_MATKEY_MAPPINGMODE_V_BASE = '$tex.mapmodev';
145+
const _AI_MATKEY_TEXMAP_AXIS_BASE = '$tex.mapaxis';
146+
const _AI_MATKEY_UVTRANSFORM_BASE = '$tex.uvtrafo';
147+
const _AI_MATKEY_TEXFLAGS_BASE = '$tex.flags';
148+
149+
150+
151+
implementation
152+
153+
end.

port/AssimpDelphi/aiMatrix3x3.pas

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
unit aiMatrix3x3;
2+
3+
interface
4+
5+
type TaiMatrix3x3 = packed record
6+
a1, a2, a3, a4: single;
7+
b1, b2, b3, b4: single;
8+
c1, c2, c3, c4: single;
9+
end;
10+
PaiMatrix3x3 = ^TaiMatrix3x3;
11+
12+
13+
14+
implementation
15+
16+
end.

port/AssimpDelphi/aiMatrix4x4.pas

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
unit aiMatrix4x4;
2+
3+
interface
4+
5+
type TaiMatrix4x4 = packed record
6+
a1, a2, a3, a4: single;
7+
b1, b2, b3, b4: single;
8+
c1, c2, c3, c4: single;
9+
d1, d2, d3, d4: single;
10+
end;
11+
PaiMatrix4x4 = ^TaiMatrix4x4;
12+
13+
14+
implementation
15+
16+
end.

port/AssimpDelphi/aiMesh.pas

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
unit aiMesh;
2+
3+
interface
4+
5+
uses aiTypes, aiMatrix4x4, aiVector3D, aiColor4D;
6+
7+
const
8+
AI_MAX_NUMBER_OF_COLOR_SETS = $4;
9+
AI_MAX_NUMBER_OF_TEXTURECOORDS = $4;
10+
11+
type TaiFace = packed record
12+
mNumIndicies: cardinal;
13+
mIndices: PCardinalArray;
14+
end;
15+
type PaiFace = ^TaiFace;
16+
type PaiFaceArray = array [0..0] of PaiFace;
17+
18+
type TaiFaceArray = array [0..0] of TaiFace;
19+
type PTaiFaceArray = ^TaiFaceArray;
20+
21+
type TaiVertexWeight = packed record
22+
mVertexId: cardinal;
23+
mWeight: single;
24+
end;
25+
26+
type TaiBone = packed record
27+
mName: aiString;
28+
mNumWeights: cardinal;
29+
mWeights: Pointer;
30+
mOffsetMatrix: TaiMatrix4x4;
31+
end;
32+
type PaiBone = ^TaiBone;
33+
34+
type TaiPrimitiveType =
35+
(
36+
aiPrimitiveType_POINT = $1,
37+
aiPrimitiveType_LINE = $2,
38+
aiPrimitiveType_TRIANGLE = $4,
39+
aiPrimitiveType_POLYGON = $8
40+
//,_aiPrimitiveType_Force32Bit = $9fffffff
41+
);
42+
43+
type TaiMesh = packed record
44+
mPrimitiveTypes: cardinal;
45+
mNumVertices: cardinal;
46+
mNumFaces: cardinal;
47+
mVertices: PTaiVector3DArray;
48+
mNormals: PTaiVector3DArray;
49+
mTangents: PaiVector3DArray;
50+
mBitangents: PaiVector3DArray;
51+
mColors: array[0..3] of PTaiColor4Darray; //array [0..3] of PaiColor4DArray; //array of 4
52+
mTextureCoords: array [0..3] of PTaiVector3DArray; //array of 4
53+
mNumUVComponents: array[0..AI_MAX_NUMBER_OF_TEXTURECOORDS -1] of cardinal;
54+
mFaces: PTaiFaceArray;
55+
mNumBones: cardinal;
56+
mBones: PaiBone;
57+
mMaterialIndex: cardinal;
58+
mName: aiString;
59+
mNumAniMeshes: cardinal;
60+
mAniMeshes: pointer;
61+
end;
62+
type PaiMesh = ^TaiMesh;
63+
type PPaiMesh = ^PaiMesh;
64+
type PaiMeshArray = array [0..0] of PaiMesh;
65+
type PPaiMeshArray = ^PaiMeshArray;
66+
67+
68+
69+
implementation
70+
71+
end.

port/AssimpDelphi/aiQuaternion.pas

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
unit aiQuaternion;
2+
3+
interface
4+
5+
type TaiQuaternion = packed record
6+
w, x, y, z: single;
7+
end;
8+
type PaiQuaternion = ^TaiQuaternion;
9+
10+
implementation
11+
12+
end.

port/AssimpDelphi/aiScene.pas

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
unit aiScene;
2+
3+
interface
4+
5+
uses aiTypes, aiMatrix4x4, aiMesh, aiMaterial, aiTexture;
6+
7+
8+
type
9+
PaiNode = ^TaiNode;
10+
PPaiNode = ^PaiNode;
11+
PaiNodeArray = array[0..0] of PaiNode;
12+
PPaiNodeArray = ^PaiNodeArray;
13+
14+
TaiNode = packed record
15+
mName: aiString;
16+
mTransformation: TaiMatrix4x4;
17+
mParent: PPaiNode;
18+
mNumChildren: cardinal;
19+
mChildren: PPaiNodeArray;
20+
mNumMeshes: cardinal;
21+
mMeshes: PCardinalArray;
22+
end;
23+
24+
25+
26+
type TaiScene = packed record
27+
mFlags: cardinal;
28+
mRootNode: PaiNode;
29+
mNumMeshes: Cardinal;
30+
mMeshes: PPaiMeshArray; //?
31+
mNumMaterials: Cardinal;
32+
mMaterials: PPaiMaterialArray;
33+
mNumAnimations: Cardinal;
34+
mAnimations: Pointer;
35+
mNumTextures: Cardinal;
36+
mTextures: PPaiTextureArray;
37+
mNumLights: Cardinal;
38+
mLights: Pointer;
39+
mNumCameras: Cardinal;
40+
mCameras: Pointer;
41+
end;
42+
type PaiScene = ^TaiScene;
43+
44+
implementation
45+
46+
end.

port/AssimpDelphi/aiTexture.pas

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
unit aiTexture;
2+
3+
interface
4+
5+
type TaiTexel = packed record
6+
b, g, r, a: byte;
7+
end;
8+
PaiTexel = ^TaiTexel;
9+
TaiTexelArray = array[0..0] of TaiTexel;
10+
PaiTexelArray = ^TaiTexelArray;
11+
12+
type TaiTexture = packed record
13+
mWidth: Cardinal; //width in pixels, OR total embedded file size if texture is a jpg/png/etc
14+
mHeight: Cardinal; //0 if texture is an embedded file
15+
achFormatHint: array[0..3] of byte;
16+
pcData: PaiTexelArray;
17+
end;
18+
PaiTexture = ^TaiTexture;
19+
PaiTextureArray = array [0..0] of PaiTexture;
20+
PPaiTextureArray = ^PaiTextureArray;
21+
22+
23+
24+
implementation
25+
26+
end.

0 commit comments

Comments
 (0)