daily update on 20240513 by nitload youmu, instancing render added
This commit is contained in:
@@ -82,8 +82,8 @@ namespace StgSharp
|
||||
(IntPtr id, uint width, uint height) => GL.Viewport(0, 0, width, height);
|
||||
|
||||
shader = CreateShaderProgram();
|
||||
var vertex = CreateShaderSegment(ShaderType.Vertex, 1);
|
||||
var fragment = CreateShaderSegment(ShaderType.Fragment, 1);
|
||||
Shader vertex = CreateShaderSegment(ShaderType.Vertex, 1);
|
||||
Shader fragment = CreateShaderSegment(ShaderType.Fragment, 1);
|
||||
vertex.Compile(0, File.ReadAllText("Shader\\vertex.vert"));
|
||||
vertex.AttachTo(0, shader);
|
||||
fragment.Compile(0, File.ReadAllText("Shader\\fragment.frag"));
|
||||
@@ -116,14 +116,19 @@ namespace StgSharp
|
||||
1.0f, 0.0f,
|
||||
1.0f, 1.0f,
|
||||
0.0f, 1.0f };
|
||||
GL.BindVertexArray(vao[0]);
|
||||
|
||||
vao.Bind(0);
|
||||
|
||||
ebo.SetValue(0, rec.Indices, BufferUsage.STATIC_DRAW);
|
||||
vbo.SetValue(0, rec.VertexBuffer, BufferUsage.STATIC_DRAW);
|
||||
GL.SetVertexAttribute(0, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
|
||||
vbo.SetValueArray(1, texCoord, BufferUsage.STATIC_DRAW);
|
||||
GL.SetVertexAttribute(2, 2, TypeCode.Single, false, 2 * sizeof(float), 0);
|
||||
|
||||
vbo.WriteMatrixData(0, rec.VertexBuffer, BufferUsage.STATIC_DRAW);
|
||||
vao.SetVertexAttribute(0, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
|
||||
|
||||
vbo.WriteScalerData(1, texCoord, BufferUsage.STATIC_DRAW);
|
||||
vao.SetVertexAttribute(2, 2, TypeCode.Single, false, 2 * sizeof(float), 0);
|
||||
|
||||
/**/
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
vbo.Unbind();
|
||||
vao.BindNull();
|
||||
/**/
|
||||
texture.Bind2D(0);
|
||||
@@ -191,34 +196,37 @@ namespace StgSharp
|
||||
|
||||
//Console.WriteLine(NativeCamera.Projection);
|
||||
|
||||
GL.DrawElements(GepmetryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero);
|
||||
GL.DrawElements(GeometryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero);
|
||||
|
||||
vao.BindNull();
|
||||
/**/
|
||||
BlueprintPipeline.SkipAll(output);
|
||||
|
||||
PollEvents();
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
protected override void ProcessInput()
|
||||
{
|
||||
float movement = 0.005f;
|
||||
|
||||
|
||||
if (InternalIO.glfwGetKey(CanvasHandle, (int)KeyboardKey.ESCAPE)
|
||||
== KeyStatus.PRESS)
|
||||
{
|
||||
InternalIO.glfwSetWindowShouldClose(CanvasHandle, 1);
|
||||
return;
|
||||
}
|
||||
if (InternalIO.glfwGetKey(CanvasHandle, (int)KeyboardKey.LEFT_SHIFT)
|
||||
if (InternalIO.glfwGetKey(CanvasHandle, (int)KeyboardKey.LeftShift)
|
||||
== KeyStatus.PRESS)
|
||||
{
|
||||
movement = 0.002f;
|
||||
}
|
||||
if (InternalIO.glfwGetKey(this.CanvasHandle, GLconst.GLFW_KEY_UP) == KeyStatus.PRESS)
|
||||
if (InternalIO.glfwGetKey(this.CanvasHandle, (int)KeyboardKey.UP) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(8);
|
||||
NativeCamera.Pitch(new Radius(movement));
|
||||
}
|
||||
else if (InternalIO.glfwGetKey(this.CanvasHandle, GLconst.GLFW_KEY_DOWN) == KeyStatus.PRESS)
|
||||
else if (InternalIO.glfwGetKey(this.CanvasHandle, (int)KeyboardKey.DOWN) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(2);
|
||||
NativeCamera.Pitch(new Radius(-movement));
|
||||
|
||||
Reference in New Issue
Block a user