daily uodate on 20240411 by nitload youmu, camera complete
This commit is contained in:
@@ -76,8 +76,8 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
Interlocked.Exchange(ref _frameSpeed, _frameCount);
|
||||
Interlocked.Exchange(ref _frameCount, 0);
|
||||
Console.Clear();
|
||||
Console.WriteLine(_frameSpeed);
|
||||
//Console.Clear();
|
||||
//Console.WriteLine(_frameSpeed);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,9 +102,9 @@ namespace StgSharp.Graphics
|
||||
/// <summary>
|
||||
/// Width of this form, represent in <see cref="int"/>
|
||||
/// </summary>
|
||||
public Vec2d Size
|
||||
public vec2d Size
|
||||
{
|
||||
get => new Vec2d(width, height);
|
||||
get => new vec2d(width, height);
|
||||
set
|
||||
{
|
||||
width = (int)value.X;
|
||||
@@ -204,10 +204,10 @@ namespace StgSharp.Graphics
|
||||
/// Resize the current form
|
||||
/// </summary>
|
||||
/// <param name="size">
|
||||
/// A <see cref="Vec2d"/> (width,height) representing the new size of current form
|
||||
/// A <see cref="vec2d"/> (width,height) representing the new size of current form
|
||||
/// </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetSize(Vec2d size)
|
||||
public void SetSize(vec2d size)
|
||||
{
|
||||
this.Size = size;
|
||||
InternalIO.glfwSetWindowSize(this.windowID, (int)size.X, (int)size.Y);
|
||||
@@ -231,13 +231,13 @@ namespace StgSharp.Graphics
|
||||
/// Set the size limit of current form
|
||||
/// </summary>
|
||||
/// <param name="minSize">
|
||||
/// Minimun size of current form. In form of a <see cref="Vec2d"/> of (width,height)
|
||||
/// Minimun size of current form. In form of a <see cref="vec2d"/> of (width,height)
|
||||
/// </param>
|
||||
/// <param name="maxSize">
|
||||
/// Maximum size of current form. In form of a <see cref="Vec2d"/> of (width,height)
|
||||
/// Maximum size of current form. In form of a <see cref="vec2d"/> of (width,height)
|
||||
/// </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetSizeLimit(Vec2d minSize, Vec2d maxSize)
|
||||
public void SetSizeLimit(vec2d minSize, vec2d maxSize)
|
||||
{
|
||||
InternalIO.glfwSetWindowSizeLimits(
|
||||
this.windowID,
|
||||
|
||||
@@ -39,7 +39,7 @@ using System.Text;
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// A collecion of handle to Element Buffer Object in OpenGL.
|
||||
/// A collection of handle to Element Buffer Object in OpenGL.
|
||||
/// Each <see langword="uint"/> value indexed from instance of this class this
|
||||
/// is the only handle to one Element Buffer Object.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public enum FrameBufferTarget:uint
|
||||
{
|
||||
Read = GLconst.READ_FRAMEBUFFER,
|
||||
All = GLconst.FRAMEBUFFER,
|
||||
Draw = GLconst.DRAW_FRAMEBUFFER,
|
||||
}
|
||||
|
||||
public class FrameBuffer : BufferObjectBase
|
||||
{
|
||||
internal unsafe FrameBuffer(int count, IntPtr contextBinding)
|
||||
{
|
||||
binding = contextBinding;
|
||||
_bufferHandle = new glHandleSet(count);
|
||||
((GLcontext*)binding)->glGenFramebuffers((uint)count,_bufferHandle.handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified by target.
|
||||
/// <see langword="FrameBufferTarget.All"/> will be set as default target.
|
||||
/// </summary>
|
||||
/// <param name="index">Index of object to be binded in handle set</param>
|
||||
public unsafe override void Bind(int index)
|
||||
{
|
||||
((GLcontext*)binding)->glBindFramebuffer(GLconst.FRAMEBUFFER, _bufferHandle[index].Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified by target.
|
||||
/// Target of this frame buffer should be set manually.
|
||||
/// </summary>
|
||||
/// <param name="target">The frame buffer target of the binding operation.</param>
|
||||
/// <param name="index">Index of object to be binded in handle set</param>
|
||||
public unsafe void Bind(FrameBufferTarget target, int index)
|
||||
{
|
||||
((GLcontext*)binding)->glBindFramebuffer((uint)target, _bufferHandle[index].Value);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,18 @@ namespace StgSharp.Graphics
|
||||
api->glBindTexture(type, texture.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind a frame buffer to a frame buffer target
|
||||
/// Same function as <see href="https://docs.gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
|
||||
/// </summary>
|
||||
/// <param name="target"> The frame buffer target of the binding operation.</param>
|
||||
/// <param name="handle"> The handle of the frame buffer object to bind.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void BindFrameBuffer(FrameBufferTarget target, glHandle handle)
|
||||
{
|
||||
api->glBindFramebuffer((uint)target,handle.Value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void BindVertexArray(glHandle handle)
|
||||
{
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace StgSharp.Graphics
|
||||
public unsafe static void SetValue(Uniform<Matrix44> uniform, Matrix44 mat)
|
||||
{
|
||||
Matrix44 temp = mat;
|
||||
api->glUniformMatrix4fv(uniform.Handle.Value, 16, false, (float*)&mat);
|
||||
api->glUniformMatrix4fv(uniform.id.Value, 1, false, (float*)&mat);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
Reference in New Issue
Block a user