daily update on 20240427 by nitload youmu
This commit is contained in:
@@ -1,28 +1,47 @@
|
||||
using System;
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public abstract partial class glRenderStream:RenderStream
|
||||
public abstract partial class glRenderStream: RenderStream
|
||||
{
|
||||
protected sealed override void NativeCameraViewTarget(vec3d position, vec3d direction, vec3d up)
|
||||
{
|
||||
NativeCamera.SetViewDirection(position, direction, up);
|
||||
}
|
||||
|
||||
protected sealed override Uniform<Matrix44> NativeCameraUniform(ShaderProgram source, string name)
|
||||
{
|
||||
NativeCamera.GainAllUniforms(source, name);
|
||||
return NativeCamera.convertedUniform;
|
||||
}
|
||||
|
||||
protected IntPtr glContextHandle
|
||||
{
|
||||
get { return ContextHandle; }
|
||||
set { ContextHandle = value; }
|
||||
}
|
||||
|
||||
internal sealed override void CreateCanvas((int width, int height, int depth) size, (int x_stretch, int y_stretch, int z_stretch) coordStrech, string name)
|
||||
internal unsafe sealed override void CreateCanvas()
|
||||
{
|
||||
Width = size.width; Height = size.height;
|
||||
Depth = size.depth;
|
||||
_coordStretch = coordStrech;
|
||||
Name = name;
|
||||
|
||||
byte[] nameCode = Encoding.UTF8.GetBytes(name);
|
||||
CanvasHandle = InternalIO.glfwCreateWindow(
|
||||
Width,Height,nameCode,Monitor,IntPtr.Zero
|
||||
);
|
||||
NativeCamera = new Camera();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected sealed override void NativeCameraViewRange(Radius fieldOfRange,vec2d offset, (float frontDepth, float backDepth) viewDepth)
|
||||
{
|
||||
NativeCamera.SetViewRange(fieldOfRange,this.Size, offset, viewDepth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,11 +59,11 @@ namespace StgSharp.Graphics
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(name);
|
||||
if (SharedCanvas == IntPtr.Zero)
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, monitor, IntPtr.Zero);
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, Monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, monitor, SharedCanvas.CanvasHandle);
|
||||
windowPtr = InternalIO.glfwCreateWindow(Width, Height, tittleBytes, Monitor, SharedCanvas);
|
||||
}
|
||||
if (((long)windowPtr == -1) || ((long)windowPtr == -2))
|
||||
{
|
||||
@@ -64,8 +83,16 @@ namespace StgSharp.Graphics
|
||||
InternalIO.glfwMakeContextCurrent(CanvasHandle);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
|
||||
{
|
||||
InternalIO.glfwSetWindowSizeLimits(this.CanvasHandle, minWidth, minHeight, maxWidth, maxHeight);
|
||||
}
|
||||
internal sealed override void InternalInit()
|
||||
{
|
||||
CreateCanvas();
|
||||
MakeAsCurrentContext();
|
||||
this.LoadGLapi();
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -80,5 +107,6 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
Deinit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user