diff --git a/pull.bat b/pull.bat
new file mode 100644
index 0000000..8042495
--- /dev/null
+++ b/pull.bat
@@ -0,0 +1,3 @@
+@echo off
+cls
+git pull origin master
diff --git a/src/JuicyGraphics.csproj b/src/JuicyGraphics.csproj
index 28769c1..537ed06 100644
--- a/src/JuicyGraphics.csproj
+++ b/src/JuicyGraphics.csproj
@@ -105,6 +105,9 @@
Resources.resx
True
+
+ PreserveNewest
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/src/JuicyGraphics/renderer/graphicalObjects/gridBackground.cs b/src/JuicyGraphics/renderer/graphicalObjects/gridBackground.cs
index 626eff6..ebd1ee4 100644
--- a/src/JuicyGraphics/renderer/graphicalObjects/gridBackground.cs
+++ b/src/JuicyGraphics/renderer/graphicalObjects/gridBackground.cs
@@ -1,9 +1,24 @@
using System.Numerics;
+using System.Windows.Forms;
+using SharpGL.Shaders;
+using SharpGL;
+using SharpGL.Enumerations;
+using System.Reflection;
+using System.IO;
namespace Graphics.Objects {
class gridBackground : iGraphicalObject {
+ const double realTileSize = 24.0f;
public void render(renderCam context) {
-
+ Shader renderGrid = new Shader();
+ renderGrid.Create(context.GL, OpenGL.GL_FRAGMENT_SHADER, "background.frag");
+
+ context.GL.Begin(BeginMode.Quads);
+ context.GL.Vertex(-1.0, -1.0);
+ context.GL.Vertex(1.0, -1.0);
+ context.GL.Vertex(1.0, 1.0);
+ context.GL.Vertex(-1.0, 1.0);
+ context.GL.End();
}
}
}
diff --git a/src/JuicyGraphics/renderer/renderCam.cs b/src/JuicyGraphics/renderer/renderCam.cs
index ef05d60..dbf213c 100644
--- a/src/JuicyGraphics/renderer/renderCam.cs
+++ b/src/JuicyGraphics/renderer/renderCam.cs
@@ -13,6 +13,10 @@ namespace Graphics {
get { return new Vector2(ownerControl.Size.Width, ownerControl.Size.Height); }
}
+ public OpenGL GL {
+ get { return gl; }
+ }
+
public renderCam(OpenGL glContext, Control owner) : base() {
gl = glContext;
ownerControl = owner;
diff --git a/src/JuicyGraphics/renderer/shaders/background.frag b/src/JuicyGraphics/renderer/shaders/background.frag
new file mode 100644
index 0000000..93e0a7f
--- /dev/null
+++ b/src/JuicyGraphics/renderer/shaders/background.frag
@@ -0,0 +1,8 @@
+#version 330 core
+out vec4 FragColor;
+
+in vec4 vertexColor;
+
+void main() {
+ FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
\ No newline at end of file
diff --git a/src/JuicyGraphics/ui/canvas.cs b/src/JuicyGraphics/ui/canvas.cs
index c8f6d37..b9af5bc 100644
--- a/src/JuicyGraphics/ui/canvas.cs
+++ b/src/JuicyGraphics/ui/canvas.cs
@@ -52,21 +52,30 @@ namespace JuicyGraphics {
return;
}
+ gridBackground gBg = new gridBackground();
+
protected override void OnPaint(PaintEventArgs e) {
if (renderingForDesigner()) {
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
InitializeOpenGL();
}
+ GL.MakeCurrent();
+ GL.ClearColor(0.9f, 0.9f, 0.9f, 1f);
+ GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
+
GL.LoadIdentity();
+
+ if (rc != null) {
+ GL.Color(0.8, 0.8, 0.8);
+ gBg.render(rc);
+ }
+
GL.Ortho(-(Width / 2160.0), Width / 2160.0,
-(Height / 2160.0), Height / 2160.0,
-1, 1);
if (rc != null)
rc.attacheMatrix();
- GL.MakeCurrent();
- GL.ClearColor(0.3f, 0.35f, 0.7f, 1f);
- GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
GL.Begin(BeginMode.Triangles);
GL.Color(0.9, 0.83, 0.1);
diff --git a/src/JuicyGraphics/ui/mainForm.Designer.cs b/src/JuicyGraphics/ui/mainForm.Designer.cs
index 9e435e0..209b926 100644
--- a/src/JuicyGraphics/ui/mainForm.Designer.cs
+++ b/src/JuicyGraphics/ui/mainForm.Designer.cs
@@ -28,10 +28,10 @@
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
this.canvas1 = new JuicyGraphics.canvas();
+ this.tabPage2 = new System.Windows.Forms.TabPage();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@@ -87,15 +87,15 @@
this.tabPage1.Text = "Scene Editor";
this.tabPage1.UseVisualStyleBackColor = true;
//
- // tabPage2
+ // button2
//
- this.tabPage2.Location = new System.Drawing.Point(4, 22);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(671, 455);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "Object Editor";
- this.tabPage2.UseVisualStyleBackColor = true;
+ this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.button2.Location = new System.Drawing.Point(532, 37);
+ this.button2.Name = "button2";
+ this.button2.Size = new System.Drawing.Size(75, 23);
+ this.button2.TabIndex = 2;
+ this.button2.Text = "button2";
+ this.button2.UseVisualStyleBackColor = true;
//
// button1
//
@@ -106,16 +106,7 @@
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(532, 37);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 2;
- this.button2.Text = "button2";
- this.button2.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
//
// canvas1
//
@@ -128,6 +119,16 @@
this.canvas1.TabIndex = 0;
this.canvas1.Text = "canvas1";
//
+ // tabPage2
+ //
+ this.tabPage2.Location = new System.Drawing.Point(4, 22);
+ this.tabPage2.Name = "tabPage2";
+ this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
+ this.tabPage2.Size = new System.Drawing.Size(671, 455);
+ this.tabPage2.TabIndex = 1;
+ this.tabPage2.Text = "Object Editor";
+ this.tabPage2.UseVisualStyleBackColor = true;
+ //
// mainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
diff --git a/src/JuicyGraphics/ui/mainForm.cs b/src/JuicyGraphics/ui/mainForm.cs
index 21d5ab2..b46f359 100644
--- a/src/JuicyGraphics/ui/mainForm.cs
+++ b/src/JuicyGraphics/ui/mainForm.cs
@@ -6,6 +6,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -20,21 +21,13 @@ namespace JuicyGraphics {
}
- //private void openGLControl1_OpenGLDraw(object sender, SharpGL.RenderEventArgs args) {
- // OpenGL GL = ((OpenGLControl)sender).OpenGL;
- // //GL.SetDimensions(Width, Height);
- // GL.Viewport(0, 0, Width, Height);
- // GL.Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
- // GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
- // GL.ClearColor(0f, 0.3f, 0.7f, 1f);
-
- // GL.Begin(BeginMode.Triangles);
- // GL.Color(1.0, 0.0, 0.0);
- // GL.Vertex(1.0, 1.0);
- // GL.Vertex(-1.0, -1.0);
- // GL.Vertex(-1.0, 1.0);
- // GL.End();
- // GL.Flush();
- //}
+ private void button1_Click(object sender, EventArgs e) {
+ string msg = "";
+ Assembly assembly = Assembly.GetExecutingAssembly();
+ foreach (string resource in assembly.GetManifestResourceNames()) {
+ msg += resource + "\n";
+ }
+ MessageBox.Show(msg);
+ }
}
}
diff --git a/src/Properties/Resources.Designer.cs b/src/Properties/Resources.Designer.cs
index 3293a32..df522ef 100644
--- a/src/Properties/Resources.Designer.cs
+++ b/src/Properties/Resources.Designer.cs
@@ -59,5 +59,14 @@ namespace JuicyGraphics.Properties {
resourceCulture = value;
}
}
+
+ ///
+ /// Looks up a localized string similar to .
+ ///
+ internal static string gridFrag {
+ get {
+ return ResourceManager.GetString("gridFrag", resourceCulture);
+ }
+ }
}
}
diff --git a/src/Properties/Resources.resx b/src/Properties/Resources.resx
index af7dbeb..5015829 100644
--- a/src/Properties/Resources.resx
+++ b/src/Properties/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -68,9 +69,10 @@
-
+
+
@@ -85,9 +87,10 @@
-
+
+
@@ -109,9 +112,12 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
\ No newline at end of file
diff --git a/src/SharpGL/Shaders/Shader.cs b/src/SharpGL/Shaders/Shader.cs
index b371b95..23fefc7 100644
--- a/src/SharpGL/Shaders/Shader.cs
+++ b/src/SharpGL/Shaders/Shader.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
namespace SharpGL.Shaders
@@ -11,13 +13,16 @@ namespace SharpGL.Shaders
///
public class Shader
{
- public void Create(OpenGL gl, uint shaderType, string source)
+ public void Create(OpenGL gl, uint shaderType, string resourceFile)
{
// Create the OpenGL shader object.
shaderObject = gl.CreateShader(shaderType);
// Set the shader source.
- gl.ShaderSource(shaderObject, source);
+ using (var reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(string.Format("JuicyGraphics.JuicyGraphics.renderer.shaders.{0}", resourceFile)))) {
+ gl.ShaderSource(shaderObject, reader.ReadToEnd());
+ }
+
// Compile the shader object.
gl.CompileShader(shaderObject);