use modular initing system rather than calling Init() method.

This commit is contained in:
Youmu Liu
2025-11-11 18:22:28 +08:00
parent 678a846e54
commit 44bf78b937
65 changed files with 1328 additions and 1814 deletions
+25 -17
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Partical"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
// AuthorGroup: Nitload
// Copyright (c) Nitload. 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
@@ -25,6 +25,7 @@
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Common.Graphics;
using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
@@ -122,9 +123,8 @@ namespace StgSharp
/**/
GL.TextureImage2d<byte>(
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, (uint)Height,
ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null);
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width,
(uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null);
/**/
// GL.Assert(false);
@@ -164,9 +164,8 @@ namespace StgSharp
// GL.ClearError();
// Console.Write($"Size set to {Height},{Width}");
// Console.WriteLine($"Image resized to {i.Height} {i.Width}");
GL.GetTextureImage(
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, i.PixelBuffer);
GL.GetTextureImage(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte,
i.PixelBuffer);
/*
for (int num = 0; num < i.PixelBuffer.Length; num+=10000)
{
@@ -287,7 +286,19 @@ namespace StgSharp
vbo.Unbind();
GL.BindVertexArray(GlHandle.Zero);
NativeCameraViewTarget([ 0f, 0f, -100f ], [ 0f, 0f, 0f ], [ 0f, 1f, 0f ]);
NativeCameraViewTarget([
0f,
0f,
-100f
], [
0f,
0f,
0f
], [
0f,
1f,
0f
]);
NativeCameraViewRange(new Degree(1.5f), Vec2.Zero, (50, 50));
NativeCameraUniform(s, "Camera");
@@ -301,15 +312,13 @@ namespace StgSharp
// GL.Assert(true);
t = CreateTexture(1);
t.Bind2D(0);
GL.TextureImage2d<byte>(
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, (uint)Height,
ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null!);
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width,
(uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null!);
t.Set2dWrapProperty(0, TextureWrap.Repeat, TextureWrap.Repeat);
t.Set2dFilterProperty(0, TextureFilter.Linear, TextureFilter.Linear);
// GL.Assert(true);
GL.FrameBufferTexture2d(
FrameBufferTarget.All, glAttachment.Color(0), Texture2DTarget.Texture2D, t[0], 0);
GL.FrameBufferTexture2d(FrameBufferTarget.All, glAttachment.Color(0), Texture2DTarget.Texture2D, t[0], 0);
GL.SetRenderBufferStorage(RenderBufferInternalFormat.Depth24_Stencil8, this.Size);
GL.CombineFrameBufferRenderBuffer(FrameBufferAttachment.DepthAndStencil, rbo[0]);
@@ -360,9 +369,8 @@ namespace StgSharp
// GL.Assert(true);
autoT = CreateAutoTexture(4);
autoT.DefaultTextureProperty = new TextureProperty(
TextureFilter.Nearest, TextureFilter.Nearest, TextureWrap.Repeat,
TextureWrap.Repeat);
autoT.DefaultTextureProperty = new TextureProperty(TextureFilter.Nearest, TextureFilter.Nearest,
TextureWrap.Repeat, TextureWrap.Repeat);
f_t = CreateTexture(1);
f_t.Bind2D(0);