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
0.8.3:deftypes [2021/06/15 14:34] – [Meshes] admin0.8.3:deftypes [2022/04/08 08:59] (current) – [Changelog] admin
Line 11: Line 11:
 <file> <file>
 -TModelDef -TModelDef
-        // holds a list of TMeshDef instances+  // holds a list of TMeshDef instances
   -List::Meshes   -List::Meshes
-  -TMeshDef +  -TMeshDef|TVertexGroupDef 
-                        // a reference to the owner model+  // a reference to the owner model
   -@Model::TModelDef   -@Model::TModelDef
-  -/TMeshDef+  -/TMeshDef|TVertexGroupDef
   -/List::Meshes   -/List::Meshes
  
Line 22: Line 22:
         -List::Materials         -List::Materials
   -TMaterialDef   -TMaterialDef
-                        // a reference to the owner model+  // a reference to the owner model
   -@Model::TModelDef   -@Model::TModelDef
  
-                        // holds a list of textures+  // holds a list of textures
   -List::Textures   -List::Textures
   -TTextureDef   -TTextureDef
Line 31: Line 31:
   -/List::Textures   -/List::Textures
  
-                        // holds a list of shader codes+  // holds a list of shader codes
   -List::Shaders   -List::Shaders
   -TShaderDef   -TShaderDef
Line 37: Line 37:
   -/List::Shaders   -/List::Shaders
  
-                        // holds a list of sub materials for layered material sources+  // holds a list of sub materials for layered material sources
   -List::Materials   -List::Materials
   -TMaterialDef   -TMaterialDef
-                                 [...]+  [...]
   -/TMaterialDef   -/TMaterialDef
   -/List::Materials   -/List::Materials
   -/TMaterialDef   -/TMaterialDef
         -/List::Materials         -/List::Materials
 +
 +        -List::Lights
 +          -TLightDef
 +        -/List::Lights
 +
 +        -List::Cameras
 +          -TCameraDef
 +        -/List::Cameras
  
   // holds a list of THumanoidDef instances   // holds a list of THumanoidDef instances
   -List::Humanoids   -List::Humanoids
   -THumanoidDef   -THumanoidDef
-                        // a reference to the owner model+  // a reference to the owner model
   -@Model::TModelDef   -@Model::TModelDef
   // holds a list of TControllerDef references   // holds a list of TControllerDef references
Line 72: Line 80:
   -List::Controllers   -List::Controllers
   -TControllerDef   -TControllerDef
-                        // a reference to the mesh, the controller handles+  // a reference to the mesh, the controller handles
   -@Mesh::TMeshDef   -@Mesh::TMeshDef
  
Line 78: Line 86:
   -Skin::TSkinDef   -Skin::TSkinDef
   -TSkinDef   -TSkinDef
-                                        // the owner controller of the skin definition+  // the owner controller of the skin definition
   -@Controller::TControllerDef   -@Controller::TControllerDef
  
Line 92: Line 100:
   -/List::LinkedJoints   -/List::LinkedJoints
  
-  // contains the root joint of the skeleton +  // contains one or more joints as skeleton roots 
-  -@Skeleton::TJointRefDef+   -List::Skeletons 
 +  -TJointRefDef 
 +  -TJointRefDef 
 +  [...] 
 +  -/List::Skeletons
   -/TSkinDef   -/TSkinDef
   -/Skin::TSkinDef   -/Skin::TSkinDef
Line 105: Line 117:
   -List::Animations   -List::Animations
   -TAnimationDef   -TAnimationDef
-                        // reference to the owner model+  // reference to the owner model
   -@Model::TModelDef   -@Model::TModelDef
  
Line 188: Line 200:
 ===== TModelDef ===== ===== TModelDef =====
  
-The TModelDef structure is representing a scene consisting of meshes, materials, lights and animations.+The TModelDef structure is representing a scene consisting of meshes, materials, lights, cameras and animations.
 It does not contain mesh information itself. Instead sub meshes are attached which hold those kind of information. It does not contain mesh information itself. Instead sub meshes are attached which hold those kind of information.
  
Line 321: Line 333:
 In some cases this helps to improve memory usage. While declaring vertex data in a parent mesh, those virtual meshes can reuse the same vertices for their triangle rendering, In some cases this helps to improve memory usage. While declaring vertex data in a parent mesh, those virtual meshes can reuse the same vertices for their triangle rendering,
 instead of duplicating them. instead of duplicating them.
- 
-__Caution:__ This functionality is not implemented completely yet! 
 ==== Materials ==== ==== Materials ====
  
Line 378: Line 388:
 // Self = TModelDef // Self = TModelDef
 LLightDef := TLightDef.Create(Self); LLightDef := TLightDef.Create(Self);
 +LLightDef.LightType := TLightType.Spot;
 +LLightDef.Direction := Point3D(0, 1, 0);
 LLightDef.Diffuse := TAlphaColorF.Create(1, 0, 0, 1); LLightDef.Diffuse := TAlphaColorF.Create(1, 0, 0, 1);
 LLightDef.Ambient := TAlphaColorF.Create(0.5, 0.5, 0.5, 1); LLightDef.Ambient := TAlphaColorF.Create(0.5, 0.5, 0.5, 1);
 +LLightDef.Specular := TAlphaColorF.Create(0.15, 0.15, 0.15, 1);
 +LLightDef.Intensity := 1;
 +// attenuation values are configurable but have no effect on rendering yet, due to FMX limitations
 +LLightDef.ConstantAttenuation := 1.0;
 +LLightDef.LinearAttenuation := 0;
 +LLightDef.QuadraticAttenuation := 0;
 +LLightDef.SpotCutOff := 180;
 +LLightDef.SpotExponent := 0;
 LLightDef.Transform := TMatrix3D.CreateTranslation(TPoint3D.Create(0, -50, -50)); LLightDef.Transform := TMatrix3D.CreateTranslation(TPoint3D.Create(0, -50, -50));
 </file> </file>
  
 +==== Cameras ====
 +
 +Gorilla3D is also able to manage logical instances for cameras. It is very common for 3D file formats to export camera information.
 +
 +<file pascal>
 +// Self = TModelDef
 +LCamDef := TCameraDef.Create(Self);
 +LCamDef._Type := TCameraType.PerspectiveCamera; // TCameraType.OrthographicCamera
 +LCamDef.Target := 'Mesh1';
 +LCamDef.FOV := 45;
 +LCamDef.AspectRatio := 16 / 9;
 +// near and far plane are configurable, but have no effect on rendering
 +// due to hardcoded constant values in FMX framework
 +LCamDef.NearPlane := 1;
 +LCamDef.FarPlane := 1000;
 +LCamDef.Transform := TMatrix3D.CreateTranslation(TPoint3D.Create(0, -5, -10));
 +</file>
 ==== Shaders ==== ==== Shaders ====
  
Line 513: Line 550:
 === AnimationStage === === AnimationStage ===
  
-An animation stage is directly referred to a specific objec (mesh or joint) inside the parent model structure. It is the container which holds all modifiers / interpolators.+An animation stage is directly referred to a specific object (mesh or joint) inside the parent model structure. It is the container which holds all modifiers / interpolators.
  
 <file pascal> <file pascal>
Line 667: Line 704:
  
 ===== TODO ===== ===== TODO =====
-  * Import/Export of camera definitions 
   * TSamplerDef integration   * TSamplerDef integration
   * TImageDef integration   * TImageDef integration
Line 677: Line 713:
       * first format introduction with undocumented modification during development process       * first format introduction with undocumented modification during development process
   * Version = 2   * Version = 2
-      Introduction of TVertexGroupDef +    Gorilla.DefTypes.TVertexGroupDef introduced to render an owner-mesh partially 
-      Introduction of "Type" property in each TCustomDef node, containing the qualified Delphi classname, f.e"Gorilla.DefTypes.TMeshDef"+    * Gorilla.DefTypes.TCameraDef introduced 
 +    * Gorilla.DefTypes.TLightDef extended 
 +    * "Type" in every node exporting the qualified delphi class name 
 +    * TMaterialDefKind.mkVertexColor introduced for separation between Color and VertexColor rendering 
 +    * TMaterialDefKind.mkCustom introduced with new properties: ShadingModel, UseTexturing, UseTexture0, UseLighting, UseVertexColor, UseSpecular 
 +    * late resolving of humanoid controllers, because controllers were not registered before creating humanoids (circular reference) 
 +    * on loading g3d files, the loader now adds the path of the g3d to texture paths, if they are relative 
 +    * multiple skeletons per skindef allowed
  
 Next step: [[transparency|Transparency]] Next step: [[transparency|Transparency]]