public VFrameBuffer(int w, int h) { IW = w; IH = h; FBO = GL.GenFramebuffer(); GL.BindFramebuffer(FramebufferTarget.Framebuffer, FBO); BB = new VTex2D(w, h, false); DB = new VTexDepth(w, h); DRB = GL.GenRenderbuffer(); GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, DRB); GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, RenderbufferStorage.DepthComponent, w, h); GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, RenderbufferTarget.Renderbuffer, DRB); GL.FramebufferTexture(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, BB.ID, 0); DrawBuffersEnum db = DrawBuffersEnum.ColorAttachment0; GL.DrawBuffers(1, ref db); if (GL.CheckFramebufferStatus(FramebufferTarget.Framebuffer) != FramebufferErrorCode.FramebufferComplete) { Console.WriteLine("Framebuffer failure."); while (true) { } } Console.WriteLine("Framebuffer success."); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0); }
public static void Rect(int x, int y, int w, int h, VTex2D img, Vector4 tc, Vector4 bc) { Bind(); GenQuad(x, y, w, h, tc, bc); img.Bind(0); DrawQuad(); img.Release(0); // GL.Begin(BeginMode.Quads); // GL.Vertex2(x, y); //GL.Vertex2(x + width, y); //GL.Vertex2(x + width, y + height); //GL.Vertex2(x, y + height); //GL.End(); Release(); }
public override void InitSkin() { PanelBG = new VTex2D("data/ui/skin/neonblue/panelbg1.jpg", LoadMethod.Multi); But_Norm = new VTex2D("data/ui/skin/neonblue/but_normal.png", LoadMethod.Multi); But_Hover = But_Norm; But_Press = But_Norm; SmallFont = new VFont("data/font/times.ttf.vf"); BigFont = new VFont("data/font/f2.ttf.vf"); WinBord = new VTex2D("data/ui/skin/neonblue/winbord.png", LoadMethod.Multi); WinCon = new VTex2D("data/ui/skin/neonblue/wincon.jpg", LoadMethod.Multi); WinTitle = new VTex2D("data/ui/skin/neonblue/wintitle.png", LoadMethod.Multi); WinBackCol.W = 0.5f; Click = new Sound.VSoundSource("data/ui/skin/neonblue/click.wav"); Type = new Sound.VSoundSource("data/ui/skin/neonblue/type.wav"); EOE = new Sound.VSoundSource("data/ui/skin/neonblue/eoe.wav"); WinBackCol = new Vector4(0.4f, 0.1f, 0.1f, 0.8f); }
public VTex2D StateImg(ButState bs) { VTex2D bi = null; switch (bs) { case ButState.Norm: bi = But_Norm; break; case ButState.Hover: bi = But_Hover; break; case ButState.Press: bi = But_Press; break; } return(bi); }
public virtual void DrawImg(int x, int y, int w, int h, VTex2D img, Vector4 col) { VPen.Rect(x, y, w, h, img, col); }
public virtual void DrawImg(int x, int y, int w, int h, VTex2D img) { DrawImg(x, y, w, h, img, Vector4.One); }
public static void InitDraw() { QFX = new VEQuad(); WhiteTex = new VTex2D("white.png", LoadMethod.Single); }
public void LoadTexs(string folder, string name) { TCol = new VTex2D(folder + "//" + name + "_c.png", LoadMethod.Single); TNorm = new VTex2D(folder + "//" + name + "_n.png", LoadMethod.Single); }
public virtual void Render(VTex2D bb) { }
public override void Render(VTex2D bb) { DrawQuad(); }
public static void Rect(int x, int y, int w, int h, VTex2D img, Vector4 c) { Rect(x, y, w, h, img, c, c); }
public static void Rect(int x, int y, int w, int h, VTex2D img) { Rect(x, y, w, h, img, Vector4.One); }
public override void InitState() { MenuBG = new VTex2D("Data\\2D\\Backgrounds\\MainMenu\\menubg.jpg", LoadMethod.Single, false); Music = StarSoundSys.Play2DFile("Data\\Music\\Menu\\MainMenu\\MenuTheme1.mp3"); UI = new UI(); UI.Root = new ImageForm().Set(0, 0, StarEngine.App.StarApp.W, StarEngine.App.StarApp.H, "ImageForm").SetImage(MenuBG); UI.Root = new ButtonForm().Set(50, 100, 200, 40, "Test"); var test = UI.Root; test.Click = (b) => { Console.WriteLine("Yep!"); }; ppRen = new StarEngine.PostProcess.PostProcessRender(512, 512); Console.WriteLine("Creating 3D Scene graph."); scene3d = new SceneGraph3D(); ppRen.Scene = scene3d; Console.WriteLine("Importing mesh."); ent1 = Import.ImportNode("Data\\3D\\Logo\\Menu\\Rebound1.3ds"); Console.WriteLine("Set up."); var mat1 = new Material3D(); //Console.WriteLine("Loading texture."); mat1.TCol = new Tex2D("Data\\3D\\brick_2.png"); mat1.TNorm = new Tex2D("Data\\3D\\brick_2_NRM.png"); Console.WriteLine("Loaded."); var ge = ent1 as GraphEntity3D; ge.SetMat(mat1); cam1 = new GraphCam3D(); cam1.LocalPos = new OpenTK.Vector3(0, 80, 450); cam1.LookAt(ent1); light1 = new StarEngine.Lighting.GraphLight3D(); var l2 = new StarEngine.Lighting.GraphLight3D(); var l3 = new StarEngine.Lighting.GraphLight3D(); l3.LocalPos = new OpenTK.Vector3(300, 80, 450); l3.Diff = new OpenTK.Vector3(0, 1, 2); l2.LocalPos = new OpenTK.Vector3(5, 200, 500); l2.Diff = new OpenTK.Vector3(2, 2, 1); light1.LocalPos = new OpenTK.Vector3(0, 80, 350); // ent1.Rot(new OpenTK.Vector3(0, 45, 0), Space.Local); scene3d.Add(ent1); scene3d.Add(l2); scene3d.Add(l3); scene3d.Add(light1); scene3d.Add(cam1); light1.Diff = new OpenTK.Vector3(3, 3, 3); }
public UIForm SetImage(VTex2D tex) { CoreTex = tex; return(this); }
public void DrawForm(VTex2D tex, int x = 0, int y = 0) { VPen.BlendMod = VBlend.Alpha; VPen.Rect(GX + x, GY + y, W, H, CoreTex, Col); }
public override void Bind(VTex2D bb) { bb.Bind(0); BFX.Bind(); }
public static void Rect(float x, float y, float w, float h, VTex2D img) { Rect((int)x, (int)y, (int)w, (int)h, img); }
public override void Release(VTex2D bb) { BFX.Release(); bb.Release(0); }
public static void Rect(float x, float y, float w, float h, VTex2D img, Vector4 col) { Rect((int)x, (int)y, (int)w, (int)h, img, col); }
public virtual void Bind(VTex2D bb) { }
public static void Rect(float x, float y, float w, float h, VTex2D img, Vector4 tc, Vector4 bc) { Rect((int)x, (int)y, (int)w, (int)h, img, tc, bc); }
public virtual void Release(VTex2D bb) { }
public UIImage(int x, int y, int w, int h, VTex2D img, UIWidget top = null) : base(x, y, w, h, "", top) { Img = img; }