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
Last revisionBoth sides next revision
models [2020/05/01 23:44] – [Loading a model from file into an existing TGorillaModel instance] adminmodels [2020/11/04 14:49] – [Loading a model from file into an existing TGorillaModel instance] admin
Line 14: Line 14:
 ===== Supported file formats ===== ===== Supported file formats =====
  
-Currently it is allowed to use the following file-formats: G3D, DAE, OBJ, STL, FBX, X3D, glTF (modified: 2020-05-01)+Currently it is allowed to use the following file-formats: G3D, DAE, OBJ, STL, FBX, X3D, glTF (modified: 2020-10-02)
  
 ^ Format      ^ MeshData       ^ Materials          ^ Animations  ^ Export ^ ^ Format      ^ MeshData       ^ Materials          ^ Animations  ^ Export ^
-| G3D             <color #00FF00></color>                         <color #00FF00></color>                         <color #00FF00></color>                      <color #00FF00></color>           | +| G3D             | ✔                        | ✔                        | ✔                    | ✔           | 
-| DAE             <color #00FF00></color>                         | <color #00FF00></color>                         <color #00FF00></color>                      <color #FF0000></color>           | +| DAE             | ✔                         | ✔                        | ✔                      | ✘           | 
-| OBJ             <color #00FF00></color>                          <color #00FF00></color>                        <color #FF0000></color>                      <color #FF0000></color>           | +| OBJ              | ✔                          | ✔                        | ✘                      | ✘           | 
-| STL              | <color #00FF00></color>                          <color #FF0000></color>                        <color #FF0000></color>                      <color #00FF00></color>           +| STL              | ✔                          |✘                        | ✘                      | ✔          
-| FBX             <color #00FF00></color>                          <color #00FF00></color>                        <color #FF0000></color>                      <color #FF0000></color>           | +| FBX             | ✔                          | ✔                        | ✘                     | ✘           | 
-| X3D             <color #00FF00></color>                          <color #00FF00></color>                        <color #00FF00></color>                      <color #FF0000></color>           | +| X3D             | ✔                          | ✔                        | ✔                      | ✘           | 
-| glTF             <color #00FF00></color>                          <color #00FF00></color>                        <color #FF0000></color>                      <color #FF0000></color>           |+| glTF             |✔                          |✔                       | ✘                      | ✘          | 
 +| Babylon             | ✔                          |✔                        | ✘                      | ✘           
 +| Sketchfab             | ✔                          | ✔                       | ✘                      | ✘          |
 ===== Loading a new model from file at runtime ===== ===== Loading a new model from file at runtime =====
  
Line 37: Line 39:
   Gorilla.FBX.Loader,   Gorilla.FBX.Loader,
   Gorilla.GLTF.Loader,   Gorilla.GLTF.Loader,
 +  Gorilla.Babylon.Loader,
   Gorilla.Model;   Gorilla.Model;
  
Line 68: Line 71:
   Gorilla.FBX.Loader,   Gorilla.FBX.Loader,
   Gorilla.GLTF.Loader,   Gorilla.GLTF.Loader,
 +  Gorilla.Babylon.Loader,
   Gorilla.Model;   Gorilla.Model;
  
Line 90: Line 94:
   * Gorilla.FBX.Loader   * Gorilla.FBX.Loader
   * Gorilla.GLTF.Loader   * Gorilla.GLTF.Loader
 +  * Gorilla.Babylon.Loader
 +  * Gorilla.Sketchfab.Loader (uses glTF format)
   * Gorilla.X3D.Loader   * Gorilla.X3D.Loader
   * Gorilla.X3DZ.Loader   * Gorilla.X3DZ.Loader
Line 95: Line 101:
  
 Only then the format loader is able to load the specific file.  Only then the format loader is able to load the specific file. 
 +
 +===== Plugins =====
 +
 +==== Sketchfab Plugin ====
 +
 +Since 0.8.2.1675 we provide a Sketchfab plugin directly by using our loading mechanism.
 +Before implementation you'll need to ensure you've got a valid Sketchfab account with username and password.
 +
 +https://sketchfab.com/
 +
 +**Remarks:** You'll also need a new clientid and clientsecret for your application.
 +To request those credentials contact support at https://sketchfab.com/developers/oauth#registering-your-app
 +
 +The usage of the plugin is simular to other file formats in Gorilla3D. But instead of using the simple method headers,
 +you'll have to use the extended method call with a TGorillaLoadOptions parameter.
 +
 +<file pascal>
 +    // setup loading options to connect to sketchfab
 +    LOpts := TGorillaLoadOptions.Create(FUID, '.sketchfab', FPackage);
 +    LOpts.FileInfo.OpenFormat := TGorillaFileOpenFormat.fofDownload;
 +
 +    LOpts.FileInfo.URL := Gorilla.Sketchfab.Loader.GORILLA_SKETCHFAB_URL;
 +    LOpts.FileInfo.ClientId := <YOUR_CLIENT_ID>;
 +    LOpts.FileInfo.ClientSecret := <YOUR_CLIENT_SECRET>;
 +    LOpts.FileInfo.Username := <YOUR_USERNAME>;
 +    LOpts.FileInfo.Password := <YOUR_PASSWORD>;
 +    
 +    // set an individual download folder, where data is written to
 +    // leave empty to use system temporary folders
 +    LOpts.ExtractDirectory := '';
 +
 +    try
 +      // try loading sketchfab model
 +      FModel := TGorillaModel.LoadNewModelFromFile(GorillaViewport1, LOpts);
 +      if Assigned(FModel) then
 +        FModel.Parent := GorillaViewport1;
 +    except
 +      on E:Exception do
 +        ShowMessage('Failed to load Sketchfab model: ' + E.Message);
 +    end;
 +</file>
 +
 +The plugin will automatically download a zip-archive with a glTF file to your preferred folder ("ExtractDirectory"). On successful download it extracts this data
 +and tries to load the contained model.
 +Before requesting Sketchfab, the loader checks the ExtractDirectory for an already existing download of UID.
 +If a zip and gltf file already exists it will directly load it, instead of downloading again.
 +
 +You have to take care yourself in case a previous download is invalid or decprecated.
  
 ===== Exporting a model ===== ===== Exporting a model =====
Line 141: Line 195:
 end; end;
 </file> </file>
 +
  
 ==== STL Export ==== ==== STL Export ====