finally something gets rendered
This commit is contained in:
@@ -114,6 +114,8 @@ internal class OpenGLEngine : Engine
|
||||
|
||||
private void OnRender(double deltaTime)
|
||||
{
|
||||
_gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
|
||||
var projectionMatrix = _camera.ProjectionMatrix;
|
||||
var viewMatrix = _camera.ViewMatrix;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace EngineSharp.Core.Rendering;
|
||||
public class Mesh
|
||||
{
|
||||
public required Material Material { get; set; }
|
||||
|
||||
// Could make these an ImmutableList. Therefore I know the data won't get changed and I only need to regenerate the renderable mesh (in the MeshRenderer) if the mesh has actually changed
|
||||
public Vector3D<float>[] Vertices { get; set; } = [];
|
||||
public Vector3D<float>[] Normals { get; set; } = [];
|
||||
public uint[] Indices { get; set; } = [];
|
||||
@@ -37,7 +39,7 @@ public class Mesh
|
||||
Normals[i1] += normal;
|
||||
Normals[i2] += normal;
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < Normals.Length; i++)
|
||||
{
|
||||
Normals[i] = Vector3D.Normalize(Normals[i]); // smoothing for shared vertices
|
||||
|
||||
@@ -9,5 +9,5 @@ in vec3 Normal;
|
||||
void main()
|
||||
{
|
||||
vec3 col = vec3(1.0, 0.5, 0.2) * FragPos;
|
||||
FragColor = vec4(1);
|
||||
FragColor = vec4(col, 1.0f);
|
||||
}
|
||||
Reference in New Issue
Block a user