daily update on 20240506 by nitload youmu
This commit is contained in:
@@ -1,4 +1,34 @@
|
||||
using StgSharp;
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="MainRenderStream.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Logic;
|
||||
@@ -15,12 +45,13 @@ namespace StgSharp
|
||||
|
||||
public class MainRenderStream : glRenderStream
|
||||
{
|
||||
private Uniform<float, float, float, float> color;
|
||||
|
||||
private ElementBuffer ebo;
|
||||
private Uniform<int> ourTexture;
|
||||
private Uniform<int> ourTexture2;
|
||||
private ShaderProgram shader;
|
||||
private Texture texture;
|
||||
private Uniform<float, float, float, float> color;
|
||||
private Uniform<int> ourTexture;
|
||||
private Uniform<int> ourTexture2;
|
||||
private VertexArray vao;
|
||||
private VertexBuffer vbo;
|
||||
|
||||
@@ -42,16 +73,13 @@ namespace StgSharp
|
||||
/**/
|
||||
}
|
||||
|
||||
protected sealed override void Init()
|
||||
protected override sealed void Init()
|
||||
{
|
||||
SetSizeLimit(800, 800, 800, 800);
|
||||
|
||||
|
||||
FrameSizeCallback =
|
||||
(IntPtr id, uint width, uint height) =>
|
||||
{
|
||||
GL.Viewport(0, 0, width, height);
|
||||
};
|
||||
(IntPtr id, uint width, uint height) => GL.Viewport(0, 0, width, height);
|
||||
|
||||
shader = CreateShaderProgram();
|
||||
var vertex = CreateShaderSegment(ShaderType.Vertex, 1);
|
||||
@@ -122,19 +150,19 @@ namespace StgSharp
|
||||
new vec3d(0, 0, 100),
|
||||
new vec3d(0, 1, 0)
|
||||
);
|
||||
NativeCameraViewRange(new Degree(5),(0, 0), (50f, 50f));
|
||||
NativeCameraUniform(shader, "NativeCamera");
|
||||
|
||||
NativeCameraViewRange(new Degree(10f), (0, 0), (50f, 50f));
|
||||
NativeCameraUniform(shader, "camera");
|
||||
|
||||
}
|
||||
|
||||
protected sealed override void Main(
|
||||
protected override sealed void Main(
|
||||
in Dictionary<string, BlueprintPipeline> input,
|
||||
in Dictionary<string, BlueprintPipeline> output
|
||||
)
|
||||
{
|
||||
GL.ClearColor(0.333f, 0.555f, 0.555f, 1.0f);
|
||||
//Console.WriteLine(1);
|
||||
GL.Clear(MaskBufferBit.COLOR | MaskBufferBit.DEPTH);
|
||||
GL.Clear(MaskBufferBit.COLOR /**/| MaskBufferBit.DEPTH /**/ );
|
||||
|
||||
/**/
|
||||
vao.Bind(0);
|
||||
@@ -148,29 +176,26 @@ namespace StgSharp
|
||||
/**/
|
||||
|
||||
/**/
|
||||
float time = /* CurrentFrameCount / /**/ 60.0f;
|
||||
float time = /* CurrentFrameCount, / /**/ 60.0f;
|
||||
|
||||
//Console.WriteLine(2);
|
||||
|
||||
GL.SetValue(color,
|
||||
0.5f + MathF.Cos(time),
|
||||
0.5f + MathF.Sin(time * 0.66667f + (2 * Scaler.Pi / 3)),
|
||||
0.5f + MathF.Sin(time * 0.33333f + (Scaler.Pi / 3)),
|
||||
0.5f + MathF.Sin((time * 0.66667f) + ((2 * Scaler.Pi) / 3)),
|
||||
0.5f + MathF.Sin((time * 0.33333f) + (Scaler.Pi / 3)),
|
||||
time
|
||||
);
|
||||
|
||||
NativeCamera.SetAllUniforms();
|
||||
/**/
|
||||
|
||||
//Console.WriteLine(NativeCamera.Projection);
|
||||
|
||||
GL.DrawElements(GepmetryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero);
|
||||
|
||||
//vao.BindNull();
|
||||
vao.BindNull();
|
||||
/**/
|
||||
//Console.WriteLine(3);
|
||||
BlueprintPipeline.SkipAll(output);
|
||||
|
||||
//Console.WriteLine(4);
|
||||
//Console.Clear();
|
||||
}
|
||||
|
||||
protected override void ProcessInput()
|
||||
@@ -183,20 +208,25 @@ namespace StgSharp
|
||||
}
|
||||
if (InternalIO.glfwGetKey(this.CanvasHandle, GLconst.GLFW_KEY_UP) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(8);
|
||||
NativeCamera.Pitch(new Radius(movement));
|
||||
}
|
||||
else if (InternalIO.glfwGetKey(this.CanvasHandle, GLconst.GLFW_KEY_DOWN) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(2);
|
||||
NativeCamera.Pitch(new Radius(-movement));
|
||||
}
|
||||
if (InternalIO.glfwGetKey(CanvasHandle, GLconst.GLFW_KEY_LEFT) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(4);
|
||||
NativeCamera.Yaw(new Radius(-movement));
|
||||
}
|
||||
else if (InternalIO.glfwGetKey(CanvasHandle, GLconst.GLFW_KEY_RIGHT) == KeyStatus.PRESS)
|
||||
{
|
||||
//Console.WriteLine(6);
|
||||
NativeCamera.Yaw(new Radius(movement));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace StgSharp
|
||||
{
|
||||
try
|
||||
{
|
||||
InternalIO.InternalWriteLog($"\n\n\nProgram Started",LogType.Info);
|
||||
InternalIO.InternalWriteLog($"Program Started",LogType.Info);
|
||||
|
||||
//StgSharp.TryCreatWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user