89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
//using StgSharp.Environment.Win32;
|
|
using StgSharp.Geometries;
|
|
using StgSharp.Graphics;
|
|
using StgSharp.Logic;
|
|
using StgSharp.Math;
|
|
|
|
using System;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace StgSharp
|
|
{
|
|
public class StgSharpDemoForm : ViewModel
|
|
{
|
|
|
|
public void Beep()
|
|
{
|
|
if (CurrentFrameCount%60==0)
|
|
{
|
|
Console.Beep();
|
|
}
|
|
}
|
|
|
|
//[RenderActivity(RenderPriority.Pre_1)]
|
|
public void NoOp()
|
|
{
|
|
int a = 1;
|
|
}
|
|
}
|
|
|
|
internal static class Program
|
|
{
|
|
internal static unsafe void Main(string[] args)
|
|
{
|
|
try
|
|
{
|
|
//StgSharp.TryCreatWindow();
|
|
|
|
/**/
|
|
StgSharp.Init();
|
|
StgSharp.InitGL(4, 6);
|
|
StgSharp.GlobalSetting.VSyncActivated = false;
|
|
StgSharpDemoForm demoForm = new StgSharpDemoForm();
|
|
demoForm.Size = (800, 800);
|
|
demoForm.name = "Hello, Stg#!";
|
|
|
|
|
|
|
|
var stream = demoForm.BuildMainRenderStream
|
|
//<MainRenderStream>
|
|
//<ParticleStream>
|
|
<fboFrame>
|
|
((1,1,1));
|
|
|
|
var rstream = RenderStream.ShareContextWith
|
|
<fboFrame,ParticleStream>(stream);
|
|
|
|
Blueprint blueprint = new Blueprint();
|
|
|
|
BlueprintNode node0 = new BlueprintNode("BufferGenerateStream", rstream);
|
|
BlueprintNode node1 = new BlueprintNode("MainRenderStream",stream);
|
|
node0.AddAfter(blueprint.BeginLayer,
|
|
"input_1", "input_1");
|
|
node0.AddBefore(node1,
|
|
"output_1", "TextureInput");
|
|
node1.AddBefore(blueprint.EndLayer,
|
|
"Output", "output_1");
|
|
|
|
blueprint.AddNativeNode(node0);
|
|
blueprint.AddNativeNode(node1);
|
|
blueprint.Init(0);
|
|
|
|
//Console.WriteLine(2);
|
|
|
|
demoForm.RenderLogic = blueprint;
|
|
demoForm.Show();
|
|
StgSharp.Terminate();
|
|
/**/
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
|
|
InternalIO.InternalWriteLog(
|
|
ex.Message + "\n" + ex.StackTrace,
|
|
LogType.Error);
|
|
}
|
|
}
|
|
}
|
|
} |