From 179407d639b8aa055ac29fcf0c13b84b2f43ef57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jhonny=20Go=CC=88ransson?= Date: Wed, 27 Nov 2024 10:49:51 +0100 Subject: [PATCH 1/3] Misc info --- docs/en/manuals/project-settings.md | 9 ++++----- docs/en/shared/graphics-api.md | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/en/manuals/project-settings.md b/docs/en/manuals/project-settings.md index b835e9f2..b6b15435 100644 --- a/docs/en/manuals/project-settings.md +++ b/docs/en/manuals/project-settings.md @@ -221,12 +221,11 @@ The texture profiles file to use for this project, `/builtins/graphics/default.t #### Verify Graphics Calls Verify the return value after each graphics call and report any errors in the log. ---- - -### Shader +#### OpenGL Version Hint +OpenGL context version hint. If a specific version is selected, this will used as the minimum version required (does not apply to OpenGL ES). Defaults to OpenGL 3.3. -#### Output SPIR-V -Compile and output SPIR-V shaders for use with Metal or Vulkan. +#### OpenGL Core Profile Hint +Set the 'core' OpenGL profile hint when creating the context. The core profile removes all deprecated features from OpenGL, such as immediate mode rendering. Does not apply to OpenGL ES. `true` by default. --- diff --git a/docs/en/shared/graphics-api.md b/docs/en/shared/graphics-api.md index d7836aa5..0d715b03 100644 --- a/docs/en/shared/graphics-api.md +++ b/docs/en/shared/graphics-api.md @@ -1,8 +1,8 @@ | System | Graphics API | Note | |----------|----------------------------|--------------------------| -| macOS | Metal (via MoltenVK) | | -| Windows | OpenGL 3.1 or Vulkan 1.1 | | -| Linux | OpenGL 3.1 or Vulkan 1.1 | | +| macOS | OpenGL 3.3 or Metal | Vulkan via MoltenVK | +| Windows | OpenGL 3.3 or Vulkan 1.1 | | +| Linux | OpenGL 3.3 or Vulkan 1.1 | | | Android | OpenGLES 3.0 or Vulkan 1.1 | Fallback to OpenGLES 2.0 | -| iOS | Metal (via MoltenVK) | | -| HTML5 | WebGL 2.0 | Fallback to WebGL 1.0 | +| iOS | OpenGLES 3.0 or Metal | Vulkan via MoltenVK | +| HTML5 | WebGL 2.0 or WebGPU | Fallback to WebGL 1.0 | From 370b02135776b7901eb40e1f1f17fe2b23ed8fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jhonny=20Go=CC=88ransson?= Date: Mon, 9 Dec 2024 09:40:59 +0100 Subject: [PATCH 2/3] Update camera information --- docs/en/manuals/camera.md | 20 +++++++++++++++++++- docs/en/manuals/render.md | 7 +------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/en/manuals/camera.md b/docs/en/manuals/camera.md index 4dd91071..369a1c22 100644 --- a/docs/en/manuals/camera.md +++ b/docs/en/manuals/camera.md @@ -132,7 +132,11 @@ You can tell the render script to use the projection provided by the camera by s msg.post("@render:", "use_camera_projection") ``` -Alternatively, you can set a specific camera that should be used for rendering in a render script: +### Render script + +Startinw with Defold 1.9.6, when using the default render script Defold will automatically set the last enabled camera that should be used for rendering. Before this change, a script somewhere in the project needed to explicitly send the `use_camera_projection` message to the renderer to notify it that the view and projection from camera components should be used. This is no longer necesessary, but it is still possible to do so for backwards compatability purposes. + +Alternatively, you can set a specific camera that should be used for rendering in a render script. This could be useful in cases where you need to control more specifically which camera should be used for rendering, for example in a multiplayer game. ```lua -- render.set_camera will automatically use the view and projection matrices @@ -140,6 +144,20 @@ Alternatively, you can set a specific camera that should be used for rendering i render.set_camera("main:/my_go#camera") ``` +To check if a camera is active or not, you can use the `get_enabled` function from the [Camera API](https://defold.com/ref/alpha/camera/#camera.get_enabled:camera): + +```lua +if camera.get_enabled("main:/my_go#camera") then + -- camera is enabled, use it for rendering! + render.set_camera("main:/my_go#camera") +end +``` + +::: sidenote +To use the `set_camera` function together with frustum culling, you need to pass this as an option to the function: +`render.set_camera("main:/my_go#camera", {use_frustum = true})` +::: + ### Panning the camera You pan/move the camera around the game world by moving the game object the camera component is attached to. The camera component will automatically send an updated view matrix based on the current x and y axis position of the camera. diff --git a/docs/en/manuals/render.md b/docs/en/manuals/render.md index 415a5bb5..c09e9267 100644 --- a/docs/en/manuals/render.md +++ b/docs/en/manuals/render.md @@ -135,12 +135,7 @@ msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 2 }) ### Camera projection -You can also use the projection provided by a [Camera component](/manuals/camera). You enable the camera projection by sending a message to the render script: - -```lua -msg.post("@render:", "use_camera_projection") -``` - +When using the default render script and there are there are enabled [Camera components](/manuals/camera) in the project, they will take precedence over any other projections set in the render script. To read more about how to work with camera components in render scripts, please consult the [Camera documentation](/manuals/camera). ## Frustum culling From 1efed20c53229ff8ca35cf047abc8c9e2364bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jhonny=20Go=CC=88ransson?= Date: Tue, 10 Dec 2024 11:45:08 +0100 Subject: [PATCH 3/3] Review fixes --- docs/en/manuals/camera.md | 2 +- docs/en/manuals/project-settings.md | 2 +- docs/en/manuals/render.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/manuals/camera.md b/docs/en/manuals/camera.md index 369a1c22..7beb7821 100644 --- a/docs/en/manuals/camera.md +++ b/docs/en/manuals/camera.md @@ -134,7 +134,7 @@ msg.post("@render:", "use_camera_projection") ### Render script -Startinw with Defold 1.9.6, when using the default render script Defold will automatically set the last enabled camera that should be used for rendering. Before this change, a script somewhere in the project needed to explicitly send the `use_camera_projection` message to the renderer to notify it that the view and projection from camera components should be used. This is no longer necesessary, but it is still possible to do so for backwards compatability purposes. +Starting with Defold 1.9.6, when using the default render script Defold will automatically set the last enabled camera that should be used for rendering. Before this change, a script somewhere in the project needed to explicitly send the `use_camera_projection` message to the renderer to notify it that the view and projection from camera components should be used. This is no longer necesessary, but it is still possible to do so for backwards compatability purposes. Alternatively, you can set a specific camera that should be used for rendering in a render script. This could be useful in cases where you need to control more specifically which camera should be used for rendering, for example in a multiplayer game. diff --git a/docs/en/manuals/project-settings.md b/docs/en/manuals/project-settings.md index b6b15435..270f9a13 100644 --- a/docs/en/manuals/project-settings.md +++ b/docs/en/manuals/project-settings.md @@ -222,7 +222,7 @@ The texture profiles file to use for this project, `/builtins/graphics/default.t Verify the return value after each graphics call and report any errors in the log. #### OpenGL Version Hint -OpenGL context version hint. If a specific version is selected, this will used as the minimum version required (does not apply to OpenGL ES). Defaults to OpenGL 3.3. +OpenGL context version hint. If a specific version is selected, this will be used as the minimum version required (does not apply to OpenGL ES). Defaults to OpenGL 3.3. #### OpenGL Core Profile Hint Set the 'core' OpenGL profile hint when creating the context. The core profile removes all deprecated features from OpenGL, such as immediate mode rendering. Does not apply to OpenGL ES. `true` by default. diff --git a/docs/en/manuals/render.md b/docs/en/manuals/render.md index c09e9267..8a286f57 100644 --- a/docs/en/manuals/render.md +++ b/docs/en/manuals/render.md @@ -135,7 +135,7 @@ msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 2 }) ### Camera projection -When using the default render script and there are there are enabled [Camera components](/manuals/camera) in the project, they will take precedence over any other projections set in the render script. To read more about how to work with camera components in render scripts, please consult the [Camera documentation](/manuals/camera). +When using the default render script and there are enabled [Camera components](/manuals/camera) available in the project, they will take precedence over any other view / projections set in the render script. To read more about how to work with camera components in render scripts, please consult the [Camera documentation](/manuals/camera). ## Frustum culling