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
1.0.0:default-material [2023/02/27 16:10] – [Changing Shaders at DesignTime] admin1.0.0:default-material [2023/04/17 08:59] (current) – [Adding new Textures at DesignTime] admin
Line 1466: Line 1466:
 </file> </file>
  
-Read more about TLocals structure in VertexShader/SurfaceShader in section [[:#TGorillaGlobalsNode|TGorillaGlobalsNode]]+Read more about TLocals structure in VertexShader/SurfaceShader in section [[#tgorillaglobalsnode_globals|TGorillaGlobalsNode]]
 at //TGorillaGLSLVertexShaderLocalsStructNode// and //TGorillaGLSLFragmentShaderLocalsStructNode//. at //TGorillaGLSLVertexShaderLocalsStructNode// and //TGorillaGLSLFragmentShaderLocalsStructNode//.
 +
 +==== Adding new Textures at DesignTime ====
 +
 +Besides the possibility of adding textures by code at runtime, you can also add new textures at designtime.
 +
 +Move inside the object inspector to the specific material source (inherited from TGorillaDefaultMaterialSource).
 +
 +__Steps:__
 +  * Open the design editor of the "**Bitmaps**" property
 +  * Add a new item
 +  * Input a name for the texture
 +  * Choose where the texture will be available: PixelShader or VertexShader
 +
 +__//NOTICE://__ The name will be important to access the texture in your shader!
 +
 +Due to Firemonkey implementation, you will access your texture with the **prefix "_"**. So for example, if you name your texture "**MyTexture**", you will
 +access it by "**_MyTexture**".
 +
 +When you choose the shader your texture will be available, you can access it also at design time in the corresponding property:
 +
 +^ShaderKind^Property^
 +|PixelShader|<TGorillaDefaultMaterialSource>.SurfaceShader|
 +|VertexShader|<TGorillaDefaultMaterialSource>.VertexShader|
 +
 +
 +In the collection item you can configure further properties of your texture and you can of course load the image data itself.
 +
 +__//NOTICE//__: Not all of the properties are fully restorable at runtime, because there are some automatisms which can't be overwritten by Gorilla3D. Use the "**ProtectFormatSettings**" property to at least try to protect those properties from implicit modification.
 +
 +__//WARNING//__: When adding new texture always add them at the end of the collection, to not intercept default textures.
 +
 +=== Availabled Properties ===
 +
 +^Property^Descr^
 +|Bitmap|Image data loadable from BMP, PNG or JPEG|
 +|BorderColor|Defines a texture border color.|
 +|DataType|Defines the data type of the internal texture format. See OpenGL specification for further information.|
 +|Format|Defines the general texture format. See OpenGL specification for further information.|
 +|IgnoreInArray|Internally arrays of textures are used for specific topics (shadows), where the name of the texture becomes obsolete.|
 +|InternalFormat|Defines the internal texture format. See OpenGL specification for further information.|
 +|IsDynamic|The texture will automatically retrieve its image data from a renderpass or other dynamic source. It's not recommended to use this with user specific textures.|
 +|MagFilter|Defines the magnification texture filtering in combination with the MinFilter property.|
 +|MinFilter|Defines the minification texture filtering in combination with the MagFilter property.|
 +|Name|A name for the texture will always be needed! Access the texture in shaders with the prefix "_"|
 +|ProtoectFormatSettings|TRUE/FALSE to protect the texture from implicit modification on re-init during runtime.|
 +|ShaderKind|Defines where the texture will be available. In PixelShader or VertexShader.|
 +|TextureKind|Kind of the texture: 2D, 3D, CubeMap, 2DArray (**recommened: only 2D**)|
 +|TilingX|Tiling of the texture on x-axis (2D)|
 +|TilingY|Tiling of the texture on y-axis (2D)|
 +|WrapR|Texture wrapping on R-axis (for 3D textures)|
 +|WrapS|Texture wrapping on S-axis|
 +|WrapT|Texture wrapping on T-axis|