Skip to content

#26 editor improvements, #2 Obj file loading (WIP) and more general enhancements - #56

Merged
Av3boy merged 29 commits into
devfrom
26-editor-improvements
Apr 8, 2025
Merged

Av3boy merged 29 commits into
devfrom
26-editor-improvements

Conversation

@Av3boy

@Av3boy Av3boy commented Apr 8, 2025

Copy link
Copy Markdown
Owner

#26 editor improvements, #2 Obj file loading (WIP) and more general enhancements

Contents

  1. Made the UI renderer render UI elements relative to the camera. The dimension calculation is incorrect relative to the screen coordinates but it somewhat works. I wasn't able to resolve it in NDC coordinates.

  2. Added a basic script to load obj files as game object meshes. This can't be tested yet since the game object rendering logic needs to be reworked. Currently it just renders 36 triangles but it should use the same logic as for the UIElement i.e. element buffer and indicies etc.

  3. Added a placeholder for the text renderer

  4. Added missing XML documentation and other miscellaneous improvements.

Checklist

  • I have merged the latest changes from main to my branch.
  • I have tested my changes and any affected components.
  • I have added the proper documentation about my changes
  • I have made sure there is no overlapping work.
  • I have discussed any / all issues brought up from code review.

@Av3boy
Av3boy requested a review from Copilot April 8, 2025 18:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 147 out of 147 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

Core/Entities/UI/Layouts/GridLayout.cs:62

  • The checks 'row < 0' and 'column < 0' are redundant since row and column are unsigned integers; remove these comparisons.
if (row < 0 || column < 0 || column >= Columns)

Core/Entities/GameObject.cs:69

  • There appears to be duplicate declarations of the private _transform field; ensure that _transform is declared only once to avoid potential conflicts.
public override Transform Transform

Core/Entities/GameObject.cs:142

  • Using a fixed count of 36 vertices for drawing may not work correctly when multiple meshes or different mesh sizes are involved; adjust the drawing logic to iterate over Meshes and use each mesh's index count or vertex count.
Window.GL.DrawArrays(PrimitiveType.Triangles, 0, 36);

Comment on lines +13 to +14
public List<TItem> Items { get; set; } = [];

Copilot AI Apr 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The List is not being properly instantiated; consider replacing [] with new List() for proper initialization.

Suggested change
public List<TItem> Items { get; set; } = [];
public List<TItem> Items { get; set; } = new List<TItem>();

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +33
// Matrix4x4.CreateRotationZ(Math.DegreesToRadians(Rotation.Angle)) *
Matrix4x4.CreateRotationZ(0) *
// Matrix4x4.CreateTranslation(new Vector3(Position.X, Position.Y, 0));
Matrix4x4.CreateTranslation(new Vector3(0, 0, 0));

Copilot AI Apr 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a zero-rotation matrix with a hardcoded value and zero translation likely does not reflect the intended transformation; update the transformation logic to use the correct rotation and translation values.

Suggested change
// Matrix4x4.CreateRotationZ(Math.DegreesToRadians(Rotation.Angle)) *
Matrix4x4.CreateRotationZ(0) *
// Matrix4x4.CreateTranslation(new Vector3(Position.X, Position.Y, 0));
Matrix4x4.CreateTranslation(new Vector3(0, 0, 0));
Matrix4x4.CreateRotationZ(Math.DegreesToRadians(Rotation.Angle)) *
Matrix4x4.CreateTranslation(new Vector3(Position.X, Position.Y, 0));

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +76
Vertices = [.. vertices],
Normals = [.. normals],
TextureCoordinates = [.. textureCoordinates],
Indices = [.. indices]

Copilot AI Apr 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax '[.. vertices]' is not standard in C# for copying a list; consider using vertices.ToArray() or similar to correctly assign the vertex data.

Suggested change
Vertices = [.. vertices],
Normals = [.. normals],
TextureCoordinates = [.. textureCoordinates],
Indices = [.. indices]
Vertices = vertices.ToArray(),
Normals = normals.ToArray(),
TextureCoordinates = textureCoordinates.ToArray(),
Indices = indices.ToArray()

Copilot uses AI. Check for mistakes.
@Av3boy
Av3boy merged commit 20ed442 into dev Apr 8, 2025
@Av3boy
Av3boy deleted the 26-editor-improvements branch April 8, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants