Expose various engine features to scripting

This commit is contained in:
Wojtek Figat
2023-01-31 16:01:56 +01:00
parent a0c6add732
commit b071cdb843
6 changed files with 17 additions and 27 deletions

View File

@@ -161,6 +161,11 @@ namespace FlaxEngine
} }
} }
/// <summary>
/// Gets the aspect ratio used by the viewport.
/// </summary>
public float AspectRatio => !Mathf.IsZero(Height) ? Width / Height : 0f;
/// <summary> /// <summary>
/// Determines whether the specified <see cref="Viewport"/> is equal to this instance. /// Determines whether the specified <see cref="Viewport"/> is equal to this instance.
/// </summary> /// </summary>
@@ -326,21 +331,5 @@ namespace FlaxEngine
vector /= w; vector /= w;
} }
} }
/// <summary>
/// Gets the aspect ratio used by the viewport.
/// </summary>
/// <value>The aspect ratio.</value>
public float AspectRatio
{
get
{
if (!Mathf.IsZero(Height))
{
return Width / Height;
}
return 0f;
}
}
} }
} }

View File

@@ -514,7 +514,7 @@ public:
API_FIELD(ReadOnly) static BlendingMode Additive; API_FIELD(ReadOnly) static BlendingMode Additive;
/// <summary> /// <summary>
/// Gets the alpha blending. /// Gets the alpha blending. Source alpha controls the output color (0 - use destination color, 1 - use source color).
/// </summary> /// </summary>
API_FIELD(ReadOnly) static BlendingMode AlphaBlend; API_FIELD(ReadOnly) static BlendingMode AlphaBlend;

View File

@@ -134,7 +134,7 @@ public:
/// <summary> /// <summary>
/// Quad rendering shader /// Quad rendering shader
/// </summary> /// </summary>
GPUShader* QuadShader; API_FIELD(ReadOnly) GPUShader* QuadShader;
/// <summary> /// <summary>
/// The current task being executed. /// The current task being executed.

View File

@@ -84,6 +84,14 @@ void RenderView::PrepareCache(const RenderContext& renderContext, float width, f
MainScreenSize = mainView->ScreenSize; MainScreenSize = mainView->ScreenSize;
} }
void RenderView::SetUp(const Matrix& viewProjection)
{
// Copy data
Matrix::Invert(viewProjection, IVP);
Frustum.SetMatrix(viewProjection);
CullingFrustum = Frustum;
}
void RenderView::SetUp(const Matrix& view, const Matrix& projection) void RenderView::SetUp(const Matrix& view, const Matrix& projection)
{ {
// Copy data // Copy data

View File

@@ -255,13 +255,7 @@ public:
public: public:
// Set up view with custom params // Set up view with custom params
// @param viewProjection View * Projection matrix // @param viewProjection View * Projection matrix
void SetUp(const Matrix& viewProjection) void SetUp(const Matrix& viewProjection);
{
// Copy data
Matrix::Invert(viewProjection, IVP);
Frustum.SetMatrix(viewProjection);
CullingFrustum = Frustum;
}
// Set up view with custom params // Set up view with custom params
// @param view View matrix // @param view View matrix

View File

@@ -29,9 +29,8 @@ public:
/// Performs rendering for the input task. /// Performs rendering for the input task.
/// </summary> /// </summary>
/// <param name="task">The scene rendering task.</param> /// <param name="task">The scene rendering task.</param>
static void Render(SceneRenderTask* task); API_FUNCTION() static void Render(SceneRenderTask* task);
public:
/// <summary> /// <summary>
/// Draws scene objects depth (to the output Z buffer). The output must be depth texture to write hardware depth to it. /// Draws scene objects depth (to the output Z buffer). The output must be depth texture to write hardware depth to it.
/// </summary> /// </summary>