Logo Khaganat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:shape [2016/12/11 15:49] – Added .shape file documentation (V1) Sit Melaien:shape [2021/12/03 18:19] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Shape ======+====== Shape specifications ======
  
 ===== A Shape in the code ===== ===== A Shape in the code =====
Line 5: Line 5:
 <WRAP center round important 60%> <WRAP center round important 60%>
 Following notes are only a draft and work in progress! Following notes are only a draft and work in progress!
- --- //[[wiki:user:siela1915|Sit Melai]] 2016/12/05 19:37//+ --- //[[user:siela1915|Sit Melai]] 2016/12/05 19:37//
 </WRAP> </WRAP>
  
Line 163: Line 163:
 ==== The .shape format ==== ==== The .shape format ====
  
-You want to make your own importer/exporter for .shape files? Take a look at the structure of the .shape format:+You want to make your own importer/exporter for .shape files? Take a look at the structure of the .shape format.
 <WRAP center round important 60%> <WRAP center round important 60%>
 Not finished yet, missing some parts that can be parsed as PolyPtr! WIP! Not finished yet, missing some parts that can be parsed as PolyPtr! WIP!
- --- //[[wiki:user:siela1915|Sit Melai]] 2016/12/11 16:48//+ 
 + --- //[[user:siela1915|Sit Melai]] 2016/12/11 16:48//
 </WRAP> </WRAP>
  
-<hidden><code> +Check [[en:nel_files|Nel Files Documentation]] for how to serialize each class:
-Version +
-   - 1 byte number, ver +
-     if ver = 0xFF +
-     - 4 bytes number, ver+
  
-Double 
-   - 8 bytes number 
  
-Float +Base class for start is **CShapeStream**. 
-   - 4 bytes number+You need all classes that are called from this class, and following classes (or child classes) for PolyPtr:
  
-Bool +  * **ITexture** 
-   - 1 byte number+  * **IMeshVertexProgram** (CMeshVPWindTree, CMeshVPPerPixelLight) 
 +  * **IShape** (CMesh, CMeshBase, CMeshMRM, CMeshMRMSkinned, CMeshMultiLod)
  
-String (Length encoded) 
-   - 4 bytes number, len 
-   - len bytes string 
- 
-RGBA 
-   - 1 byte number r (0 - 255) 
-   - 1 byte number g (0 - 255) 
-   - 1 byte nubmer b (0 - 255) 
-   - 1 byte number a (0 - 255) 
- 
-2DVector 
-   - Float x 
-   - Float y 
- 
-3DVector 
-   - Float x 
-   - Float y 
-   - Float z 
- 
-4DVector 
-   - Float a 
-   - Float b 
-   - Float c 
-   - Float d 
- 
-PolyPtr 
-   - 8 bytes number, an id 
-   - if id not in file yet 
-      - String, classname 
-      - classname 
- 
-Shape 
-   - 4 bytes that are "SHAP" 
-   - PolyPtr 
- 
-CMesh 
-   - Version 
-   - CMeshBase 
-   - CMeshGeom 
- 
-CMeshBase 
-   - Version, ver 
-   - ver greater/equal to 2 
-      - 4 bytes number, Number Animated Morphs 
-      0 to Number Animated Morphs 
-         - String, Material Name 
-   - ver bigger than 1 
-      - Version 
-      - 3DVector, Default Position 
-      - Version 
-      - 3DVector, Default Pivot 
-      - Version 
-      - 3DVector, Default Rotation Euler 
-      - Version 
-      - 4DVector, Default Rotation Quat 
-      - Version 
-      - 3DVector, Default Scale 
-      - 4 bytes number, Number Materials 
-         0 to Number Materials 
-      - CMaterial 
-      - 4 bytes number, Number Elements 
-      0 to Number Elements 
-      - 4 bytes number, key 
-      - CMaterialBase, value 
-      - map key to value 
-      - ver bigger/equal to 8 // Map m maps light name to map p 
-                              // Map p maps index to matnumber and stage number 
-      - 4 bytes number, Number Lights 
-         0 to Number Lights 
-     - CLightMapInfoList 
-      - ver smaller than 8 // Map m maps light name to map p 
-                           // Map p maps index to matnumber and stage number 
-         - 4 bytes number, Number Lights 
- 0 to Number Lights 
-     - String, key 
-     - 4 bytes number, num 
-     0 to num, i 
-        - 1 byte number, value[i]["MatNumber"] 
-        - 1 byte number, value[i]["StageNumber"] 
-      - ver bigger/equal to 3 
-         - Bool, Lightable 
-      - ver bigger/equal to 4 
-         - Bool, Use Lighting Local Attenuation 
-      - ver bigger/equal to 5 
-         - Bool, Auto Anim 
-      - ver bigger/equal to 6 
-         - Float, Max Distance 
-      - ver bigger/equal to 7 
-         - 8 bytes number, id 
- - if id not read yet 
-     - CLodCharacterTexture 
-      - ver bigger/equal to 9 
-         - 4 bytes number, index 
-     index value 
-     - case 0 
-        - Auto Camera Collision 
-     - case 1 
-        - No Camera Collision 
-     - case 2 
-        - Force Camera Collision 
- 
-CMeshGeom 
-   - Version, ver 
-   - ver bigger/equal to 4 
-      - 4 bytes number, Number Bone Names 
-         0 to Number Bone Names 
- - String, Bone Name 
-   - ver bigger/equal to 3 
-      - PolyPtr, Mesh Vertex Program 
-   - ver bigger/equal to 1 
-      - CMeshMorpher, Mesh Morpher 
-   - CVertexBuffer, VBuffer 
-   - 4 bytes number, Number Matrix Blocks 
-      0 to Number Matrix Blocks 
-      - CMatrixBlock 
-   - CAABBox, BBox 
-   - Bool, Skinned 
- 
-CMaterial 
-   - Version 
-   - 4 bytes number, index 
-      index in Shaders: 
-         "Normal", "Bump", "UserColor", "LightMap", "Specular", "Caustics", "PerPixelLighting", "PerPixelLightingNoSpec", "Cloud", "Water" 
-   - 4 bytes number, flags 
-   - 4 bytes number, index 
-      index in Source Blenders 
-      "one", "zero", "srcalpha", "invsrcalpha", "srccolor", "invsrccolor", "blendConstantColor", "blendConstantInvColor", "blendConstantAlpha", "blendConstantInvAlpha" 
-   - 4 bytes number, index 
-      index in Destination Blenders 
-      "one", "zero", "srcalpha", "invsrcalpha", "srccolor", "invsrccolor", "blendConstantColor", "blendConstantInvColor", "blendConstantAlpha", "blendConstantInvAlpha" 
-   - 4 bytes number, index 
-      index in ZFunctions 
-      "always", "never", "equal", "notequal", "less", "lessequal", "greater", "greaterequal" 
-   - Float, ZBias 
-   - RGBA, Color 
-   - RGBA, Emissive 
-   - RGBA, Ambient 
-   - RGBA, Diffuse 
-   - RGBA, Specular 
-   - ver greater/equal to 2 
-      - Float, Shininess 
-   - ver greater/equal to 5 
-      - Float, AlphaTestThreshold 
-   - ver greater/equal to 8 
-      - 2 bytes number, Texture Coordinate Generation Mode 
-   0 to IDRV_MAT_MAXTEXTURES (0 to 4) 
-      - PolyPtr, Texture 
-      - ver greater/equal to 1 
-         - TexEnv (ver greater/equal 9) 
-   - ver greater/equal to 3 
-      - ver greater/equal to 7 
-         - 4 bytes number, Number of Light Maps 
-            0 to Number of Light Maps 
-            - CLightMap_2 
-         - Bool 
-      - ver smaller 7 
-         - 4 bytes number, Number of Light Maps 
-     0 to Number of Light Maps 
-     - CLightMap 
-   - ver greater/equal to 4 
-      - flags greater 0 
-         0 to Max Textures (4) 
- - 1 byte number, Texture Address Mode 
-   - ver greater/equal to 6 
-      0 to Max Textures (4), i 
-      - flags greater 0 
-        - i smaller than 3 
-    - CMatrix, Texture User Mat 
- 
-CMaterialBase 
-   - Version, ver 
-   - String, Name 
-   - Version 
-   - RGBA, Default Ambient 
-   - Version 
-   - RGBA, Default Diffuse 
-   - Version 
-   - RGBA, Default Specular 
-   - Version 
-   - Float, Shininess 
-   - Version 
-   - RGBA, Default Emissive 
-   - Version 
-   - Float, Default Opacity 
-   - Version 
-   - 4 bytes number, Default Texture 
-   - 4 bytes number, Number Elements 
-   0 to Number Elements 
-      - 4 bytes number, key 
-      - CAnimatedTexture, mat 
-      - map key to mat 
-   - ver greater 0 
-      0 to Max Textures (4) 
-         - CTexAnimTracks 
- 
-CLightMapInfoList 
-   - Version 
-   - 4 bytes number, Light Group 
-   - String, Animated Light 
-   - 4 bytes number, Number Mat Stages 
-   0 to Number Mat Stages 
-      - Version 
-      - 1 byte number, Material Id 
-      - 1 byte number, Stage Id 
- 
-CLodCharacterTexture 
-   - Version 
-   - 4 bytes number, Width 
-   - 4 bytes number, Height 
-   - 4 bytes number, Number Points 
-   0 to Number Points 
-      - 1 byte number, T 
-      - 1 byte number, U 
-      - 1 byte number, V 
-      - 1 byte number, Q 
- 
-CMeshMorpher 
-   - Version 
-   - 4 bytes number, Number Blend Shapes 
-   0 to Number Blend Shapes 
-      - CBlendShape 
- 
-CVertexBuffer 
-   - Version, ver 
-   - ver smaller 2 
-      - 4 bytes number, Flags 
-         bit 1 = XYZ 
- bit 2 = Weight0, WeightCount = 1 // if multiple, highest WeightCount 
- bit 3 = Weight1, WeightCount = 2 
- bit 4 = Weight2, WeightCount = 3 
- bit 5 = Weight3, WeightCount = 4 
- bit 6 = Normal 
- bit 7 = PrimaryColor 
- bit 8 = SecondaryColor 
- bit 9 = TexCoord0 
-    bit 10 = TexCoord1 
- bit 11 = TexCoord2 
- bit 12 = TexCoord3 
- bit 13 = TexCoord4 
- bit 14 = TexCoord5 
- bit 15 = TexCoord6 
- bit 16 = TexCoord7 
- bits 17 & 2 & 3 & 4 & 5 = PaletteSkin 
-      - 4 bytes number, Number Vertices 
-      0 to Number Vertices 
-         - XYZ_Flag 
-     - 3DVector, XYZ 
- - Normal_Flag 
-     - 3DVector, Normal 
- 0 to MaxStage (8), i 
-     - UVi_Flag 
-        - CUV 
- - PrimaryColor_Flag 
-     - RGBA, Color 
- - SecondaryColor_Flag 
-     - RGBA, Specular 
- 0 to WeightCount 
-     - Float, Weight 
-         - PaletteSkin_Flag 
-     - CPaletteSkin 
-   - ver greater/equal to 2 
-      - Version, hver 
-      - hver smaller 1 
-         - 4 bytes number, Flags 
-            bit 1 = XYZ 
-     bit 2 = Weight0, WeightCount = 1 // if multiple, highest WeightCount 
-     bit 3 = Weight1, WeightCount = 2 
-     bit 4 = Weight2, WeightCount = 3 
-     bit 5 = Weight3, WeightCount = 4 
-     bit 6 = Normal 
-     bit 7 = PrimaryColor 
-     bit 8 = SecondaryColor 
-     bit 9 = TexCoord0 
-     bit 10 = TexCoord1 
-     bit 11 = TexCoord2 
-     bit 12 = TexCoord3 
-     bit 13 = TexCoord4 
-     bit 14 = TexCoord5 
-     bit 15 = TexCoord6 
-     bit 16 = TexCoord7 
-     bits 17 & 2 & 3 & 4 & 5 = PaletteSkin 
-      - hver greater/equal to 1 
-         - 2 bytes number, Flags 
-     bit 1 = Position 
-     bit 2 = Normal 
-     bit 3 = TexCoord0 
-     bit 4 = TexCoord1 
-     bit 5 = TexCoord2 
-     bit 6 = TexCoord3 
-     bit 7 = TexCoord4 
-     bit 8 = TexCoord5 
-     bit 9 = TexCoord6 
-     bit 10 = TexCoord7 
-     bit 11 = PrimaryColor (Color?) 
-     bit 12 = SecondaryColor (Specular?) 
-     bit 13 = Weight 
-     bit 14 = PaletteSkin 
-     bit 15 = Fog 
-     bit 16 = Empty 
- 0 to NumValue (16), i 
-     - 1 byte number, Type[i] 
-      - 4 bytes number, Number Vertices 
-      - hver greater/equal to 2 
-         - 1 byte number, Vertex Color Format 
-      - hver greater/equal to 3 
-         - 4 bytes number, index 
-            index in PreferredMemory: 
-               "RAMPreferred", // A block of driver RAM memory is allocated for this buffer. The buffer is read/write. 
-        "AGPPreferred", // A block of driver AGP memory is allocated for this buffer. The buffer is writeonly. 
-        "StaticPreferred", // The buffer will not be modified. A block of driver AGP or VRAM memory is allocated for this buffer. The buffer is writeonly. 
-        "RAMVolatile", // A block of temporary driver RAM memory will be returned by lock(). The buffer must be entirely filled after each swapBuffers(). The buffer is writeonly. 
-        "AGPVolatile" // A block of temporary driver AGP memory will be returned by lock(). The buffer must be entirely filled after each swapBuffers(). The buffer is writeonly. 
-         - String, Name 
-      - Version, sver 
-      0 to Number Vertices 
-         0 to NumValue (16), i 
-     - Flags bit i set 
-        - Type[i] equal 0 
-           - Double 
-        - Type[i] equal 1 
-           - Float 
-        - Type[i] equal 2 
-           - 2 bytes number 
-        - Type[i] equal 3 
-           - Double 
-   - Double 
-        - Type[i] equal 4 
-           - Float 
-   - Float 
-        - Type[i] equal 5 
-           - 2 bytes number 
-   - 2 bytes number 
-        - Type[i] equal 6 
-           - Double 
-   - Double 
-   - Double 
-        - Type[i] equal 7 
-           - Float 
-   - Float 
-   - Float 
-        - Type[i] equal 8 
-           - 2 bytes number 
-   - 2 bytes number 
-   - 2 bytes number 
-        - Type[i] equal 9 
-           - Double 
-   - Double 
-   - Double 
-   - Double 
-        - Type[i] equal 10 
-           - Float 
-   - Float 
-   - Float 
-   - Float 
-        - Type[i] equal 11 
-           - 2 bytes number 
-   - 2 bytes number 
-   - 2 bytes number 
-   - 2 bytes number 
-        - Type[i] equal 12 
-           - 1 byte number 
-   - 1 byte number 
-           - 1 byte number 
-   - 1 byte number 
-      - sver greater/equal to 2 
-         - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- - 1 byte number, UVRouting 
- 
-CMatrixBlock 
-   - Version 
-   0 to 16 
-      - 4 bytes number, Matrix Id 
-   - 4 bytes number, Number Matrix 
-   - 4 bytes number, num 
-   0 to num 
-      - CRdrPass 
- 
-CAABBox 
-   - Version 
-   - 3DVector, Center 
-   - 3DVector, Half Size 
- 
-TexEnv (ver) 
-   - 1 byte number, Color Operand 
-   - 1 byte number, Color Argument 0 
-   - 1 byte number, Color Operand 0 
-   - 1 byte number, Color Argument 1 
-   - 1 byte number, Color Operand 1 
-   - ver greater 0 
-      - 1 byte number, Color Argument 2 
-      - 1 byte number, Color Operand 2 
-   - 1 byte number, Alpha Operand 
-   - 1 byte number, Alpha Argument 0 
-   - 1 byte number, Alpha Operand 0 
-   - 1 byte number, Alpha Argument 1 
-   - 1 byte number, Alpha Operand 1 
-   - ver greater 0 
-      - 1 byte number, Alpha Argument 2 
-      - 1 byte number, Alpha Operand 2 
-   - RGBA, Constant Color 
- 
-CLightMap_2 
-   - Version, ver 
-   - RGBA, Factor 
-   - RGBA, LMCDiffuse 
-   - ver greater/equal to 1 
-      - RGBA, LMCAmbient 
-   - PolyPtr, Texture 
- 
-CLightMap 
-   - RGBA, Factor 
-   - PolyPtr, Texture 
- 
-CMatrix 
-   - Version, ver 
-   - 4 bytes number, StateBit 
-   - Float, Scale 33 
-   - StateBit bit for value 2, 4 or 8 set 
-      - Float, Matrix [0][0] 
-      - Float, Matrix [0][1] 
-      - Float, Matrix [0][2] 
-      - Float, Matrix [1][0] 
-      - Float, Matrix [1][1] 
-      - Float, Matrix [1][2] 
-      - Float, Matrix [2][0] 
-      - Float, Matrix [2][1] 
-      - Float, Matrix [2][2] 
-   - StateBit bit for value 1 set 
-      - Float, Matrix [0][3] 
-      - Float, Matrix [1][3] 
-      - Float, Matrix [2][3] 
-   - StateBit bit for value 16 set 
-      - Float, Matrix [3][0] 
-      - Float, Matrix [3][1] 
-      - Float, Matrix [3][2] 
-      - Float, Matrix [3][3] 
- 
-CAnimatedTexture 
-   - PolyPtr, Texture 
- 
-CTexAnimTracks 
-   - Version, ver 
-   - Float, Default U Translation 
-   - Float, Default V Translation 
-   - Float, Default U Scale 
-   - Float, Default V Scale 
- 
-CBlendShape 
-   - Version, ver 
-   - String, Name 
-   - 4 bytes number, Number deltaPos 
-   0 to Number deltaPos 
-      - 3DVector 
-   - 4 bytes number, Number deltaNorm 
-   0 to Number deltaNorm 
-      - 3DVector 
-   - 4 bytes number, Number deltaUV 
-   0 to Number deltaUV 
-      - CUV 
-   - 4 bytes number, Number deltaCol 
-   0 to Number deltaCol 
-      - CRGBAF 
-   - ver greater/equal to 1 
-      - 4 bytes number, Number deltaTgSpace 
-      0 to Number deltaTgSpace 
-         - 3DVector 
-   - 4 bytes number, Number Vertex References 
-   0 to Number Vertex References 
-      - 4 bytes number, Vertex Reference 
- 
-CUV 
-   - Float, u 
-   - Float, v 
- 
-CPaletteSkin 
-   - 1 byte number, MatrixId 0 
-   - 1 byte number, MatrixId 1 
-   - 1 byte number, MatrixId 2 
-   - 1 byte number, MatrixId 3 
- 
-CRdrPass 
-   - Version 
-   - 4 bytes number, MaterialId 
-   - CIndexBuffer 
- 
-CRGBAF 
-   - Float, R (0 - 1) 
-   - Float, G (0 - 1) 
-   - Float, B (0 - 1) 
-   - Float, A (0 - 1) 
- 
-CIndexBuffer 
-   - Version, ver 
-   - ver smaller 1 // Primitive block 
-      - 4 bytes number, Number 
-      - 4 bytes number, Capacity 
-      - 4 bytes number, Number Indexes 
-      0 to Number Indexes 
-         - 4 bytes number, Index 
-      - 4 bytes number, Number 
-      - 4 bytes number, Capacity 
-      - 4 bytes number, Number nonResidentIndexes 
-      0 to Number nonResidentIndexes 
-         - 4 bytes number, nonResidentIndex 
-      - 4 bytes number, Number 
-      - 4 bytes number, Capacity 
-      - 4 bytes number, Number Indexes 
-      0 to Number Indexes 
-         - 4 bytes number, Index 
-   - ver greater/equal 1 // Index buffer 
-      - 4 bytes number, Number Indexes 
-      - 4 bytes number, Capacity 
-      - 4 bytes number, Number nonResidentIndexes 
-      0 to Number nonResidentIndexes 
-         - 4 bytes number, nonResidentIndex 
-      - 4 bytes number, index 
-            index in PreferredMemory: 
-               "RAMPreferred", // A block of driver RAM memory is allocated for this buffer. The buffer is read/write. 
-        "AGPPreferred", // A block of driver AGP memory is allocated for this buffer. The buffer is writeonly. 
-        "StaticPreferred", // The buffer will not be modified. A block of driver AGP or VRAM memory is allocated for this buffer. The buffer is writeonly. 
-        "RAMVolatile", // A block of temporary driver RAM memory will be returned by lock(). The buffer must be entirely filled after each swapBuffers(). The buffer is writeonly. 
-        "AGPVolatile" // A block of temporary driver AGP memory will be returned by lock(). The buffer must be entirely filled after each swapBuffers(). The buffer is writeonly. 
-      - ver equal to 1 
-         0 to PreferredCount (5) 
-     - Bool, old Format Memory Preference 
-</code></hidden> 
  
  
 {{tag>Tag_a_ajouter}} {{tag>Tag_a_ajouter}}
CC Attribution-Share Alike 4.0 International Driven by DokuWiki
en/shape.1481471365.txt.gz · Last modified: (external edit)

Licences Mentions légales Accueil du site Contact Inclusion