Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
firststeps [2019/03/08 10:25] – created adminfirststeps [2020/11/06 09:23] – [First Steps] admin
Line 1: Line 1:
 ====== First Steps ====== ====== First Steps ======
  
-The framework usage is quite the same as using Delphi Firemonkey 3D.  +Handling Gorilla3D is quite the same as using Firemonkey 3D. 
-At first we need a viewport to display all 3D content.+The main difference is the usage of TGorillaViewport as the main component for display
 +**You can no longer use a TViewport3D or TForm3D as basis for showing 3D content.**
  
 +The reason for that is, that Gorilla3D extends functionality a lot and needs special treatment, which the default viewport do not provide (f.e. Render-Passes, Lighting-Information, Shadow-Computation, ...).
  
-It is possible to use default firemonkey components like ButtonsLabels and also 3D components inside the Gorilla3D viewport.  +Butlet' start and have quick look at the basic features of Gorilla3D and how they are going to be used.
- +
- +
-===== Creating a Gorilla3D Viewport at design-time ===== +
- +
-You can find the viewport at designtime in the toolbar under:  +
- +
- +
-Gorilla3D > TGorillaViewport. +
- +
- +
-Simply drag it onto your form or create it at runtime by the following method.  +
- +
-**__CAUTION:__ Gorilla3D is not compatible with TForm3D and TViewport3D!** +
- +
- +
-===== Creating a viewport at runtime ===== +
- +
-If you need to create the Gorilla3D viewport at runtime, you can do it the following way:  +
- +
- +
-<file pascal Form1.pas> +
-uses +
-  FMX.UITypes, +
-  Gorilla.Viewport; +
- +
-// in our form (TForm1) we added a field named "FGorilla" +
-procedure TForm1.FormCreate(Sender: TObject); +
-begin +
-  FGorilla := TGorillaViewport.Create(Self); +
-  FGorilla.Parent := Form1; +
-  FGorilla.Color  := TAlphaColorRec.Black; +
-end; +
-</file> +
-  +
- +
-===== Loading a new model from file at runtime ===== +
- +
-The main core component is TGorillaModel to load a model from file. Currently it allows the following formats: G3D, DAE, OBJ, STL, FBX, X3D.  +
- +
-<file pascal Form1.pas> +
-uses +
-  Gorilla.G3D.Loader, +
-  Gorilla.DAE.Loader, +
-  Gorilla.OBJ.Loader, +
-  Gorilla.STL.Loader, +
-  Gorilla.FBX.Loader, +
-  Gorilla.Model; +
- +
-// in our form (TForm1) we added a field named "FModel" +
-procedure TForm1.FormCreate(Sender: TObject); +
-var LPath : String; +
-    LAssetPckg : TGorillaAssetPackage; +
-begin +
-  LPath := 'c:\my3dfile.dae'; +
-  LAssetPckg := nil; +
-  FModel := TGorillaModel.LoadNewModelFromFile(FGorilla, LAssetPckg, +
-      OpenDialog1.FileName, GORILLA_ANIMATION_CACHING_DEFAULT); +
-  FModel.Parent := FGorilla; +
-end; +
-</file> +
-             +
- +
-===== Loading a model from file into an existing TGorillaModel instance ===== +
- +
-<file pascal Form1.pas> +
-uses +
-  Gorilla.G3D.Loader, +
-  Gorilla.DAE.Loader, +
-  Gorilla.OBJ.Loader, +
-  Gorilla.STL.Loader, +
-  Gorilla.FBX.Loader, +
-  Gorilla.Model; +
- +
-// in our form (TForm1) we added a field named "FModel" +
-procedure TForm1.FormCreate(Sender: TObject); +
-var LPath : String; +
-    LAssetPckg : TGorillaAssetPackage; +
-begin +
-  LPath := 'c:\my3dfile.dae'; +
-  LAssetPckg := nil; +
-  GorillaModel1.LoadFromFile(LAssetPckg, +
-      OpenDialog1.FileName, GORILLA_ANIMATION_CACHING_DEFAULT); +
-end; +
-</file> +
-        +
-             +
-To load a specific file format you need to include the specific format file: Gorilla.G3D.Loader, Gorilla.DAE.Loader, Gorilla.OBJ.Loader, Gorilla.STL.Loader, Gorilla.FBX.Loader,... Only then the format loader is able to load the specific file+
  
 +    * [[viewport|Viewport]]
 +    * [[models|Models]]
 +    * [[animations|Animations]]
 +    * [[materials|Materials]]
 +      * [[default-material|DefaultMaterial]]
 +      * [[runtime-material|RuntimeMaterial]]
 +      * [[water|Water]]
 +    * [[primitives|Primitives]]
 +    * [[terrain|Terrain]]
 +    * [[skybox|SkyBox]]
 +    * [[particles|Particles]]
 +    * [[physics|Physics]]
 +    * [[fmodaudio|FMOD Audio]]
 +    * [[assetsmanager|Assets Manager]]
 +    * [[billboard|Billboard]]
 +    * [[inventory|Inventory]]
 +    * [[dialogues|Dialogues]]
 +    * [[skillsystem|Skillsystem]]
 +    * [[inputpolling|Input Polling]]
 +    * [[pathfinding|Pathfinding]]
 +    * [[renderpass|Render Pass]]
 +    * [[shadows|Shadows]]
 +    * [[water|Water]]
 +    * [[bokeh|Bokeh]]
 +    * [[deftypes|Internal Model Definition]]
 +    * [[transparency|Transparency]]
 +    * [[layer3d|2D FMX components]]
 +    * [[scripting|Scripting]]
 +    * [[interaction|Interaction]]
 +    * [[charactercontrolling|CharacterControlling]]
 +    * [[android|Android]]
  
 ===== Building an app with Gorilla3D and Delphi 10.3 Rio for Android ===== ===== Building an app with Gorilla3D and Delphi 10.3 Rio for Android =====
Line 106: Line 52:
 Go to "tools" > "options" > "deployment" > "SDK-Manager" and tab "NDK". Here you need to replace every android api version occurrence ("android-*") lower than 18 to at least "android-18" Go to "tools" > "options" > "deployment" > "SDK-Manager" and tab "NDK". Here you need to replace every android api version occurrence ("android-*") lower than 18 to at least "android-18"
  
 +{{ ::openglesv3-config.jpg?600 |}}
  
 When installing Delphi 10.3 Rio, the default configuration is set to "android-14" When installing Delphi 10.3 Rio, the default configuration is set to "android-14"
 +
 +**Since Gorilla3D v0.8.1 we have to set NDK minimum API level to "android-21". On Delphi 10.3.3 its already set to "android-22" by default.**
  
  
Line 114: Line 63:
 [DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidNDK-17b_20.0.32429.4364\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: cannot find -lGLESv3 [DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\20.0\CatalogRepository\AndroidNDK-17b_20.0.32429.4364\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: cannot find -lGLESv3
 </code> </code>
 +
 +Your app should tell Android that it needs at least OpenGL ES 3.0. This can be done in "AndroidManifest.Template.xml":
 +
 +<code>
 +<!-- Tell the system this app requires OpenGL ES 3.0. -->
 +<uses-feature android:glEsVersion="0x00030000" android:required="true" />
 +</code>
 +
 +Change the attribute android:glEsVersion to "0x00030000".