Nichts besonderes

This commit is contained in:
Leon Rauschenberg 2019-02-14 15:46:16 +01:00
parent 71e600b9c9
commit ac39a65511
13 changed files with 76 additions and 25 deletions

View File

@ -51,19 +51,20 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="JuicyGraphics\renderer\graphicalObjects\gridBackground.cs" />
<Compile Include="SharpGL\Matrix.cs" />
<Compile Include="JuicyGraphics\renderer\camera2D.cs" />
<Compile Include="JuicyGraphics\renderer\iGraphicalObject.cs" />
<Compile Include="JuicyGraphics\renderer\line.cs" />
<Compile Include="JuicyGraphics\renderer\graphicalObjects\line.cs" />
<Compile Include="JuicyGraphics\renderer\renderCam.cs" />
<Compile Include="JuicyGraphics\ui\canvas.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="JuicyGraphics\ui\Form1.cs">
<Compile Include="JuicyGraphics\ui\mainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="JuicyGraphics\ui\Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="JuicyGraphics\ui\mainForm.Designer.cs">
<DependentUpon>mainForm.cs</DependentUpon>
</Compile>
<Compile Include="JuicyGraphics\Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -91,8 +92,8 @@
<Compile Include="SharpGL\VertexBuffers\VertexBuffer.cs" />
<Compile Include="SharpGL\VertexBuffers\VertexBufferArray.cs" />
<Compile Include="SharpGL\Win32.cs" />
<EmbeddedResource Include="JuicyGraphics\ui\Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="JuicyGraphics\ui\mainForm.resx">
<DependentUpon>mainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

View File

@ -1,4 +1,5 @@
using SharpGL;
using System;
using System.Numerics;
namespace Graphics {
@ -15,13 +16,15 @@ namespace Graphics {
}
}
const double maxScale = 18.0;
public double scale {
get {
return mat[0, 0];
}
set {
mat[0, 0] = value;
mat[1, 1] = value;
mat[0, 0] = Math.Min(value, maxScale);
mat[1, 1] = Math.Min(value, maxScale);
}
}

View File

@ -0,0 +1,9 @@
using System.Numerics;
namespace Graphics.Objects {
class gridBackground : iGraphicalObject {
public void render(renderCam context) {
}
}
}

View File

@ -1,7 +1,7 @@
using System.Windows.Forms;
using System.Numerics;
using SharpGL;
using System.Drawing;
namespace Graphics {
class renderCam : camera2D {
@ -9,6 +9,10 @@ namespace Graphics {
OpenGL gl;
Control ownerControl;
public Vector2 resolution {
get { return new Vector2(ownerControl.Size.Width, ownerControl.Size.Height); }
}
public renderCam(OpenGL glContext, Control owner) : base() {
gl = glContext;
ownerControl = owner;

View File

@ -111,6 +111,7 @@ namespace JuicyGraphics {
break;
}
prevMousePosition = MousePosition;
this.Focus();
}
protected override void OnMouseMove(MouseEventArgs e) {
@ -145,7 +146,19 @@ namespace JuicyGraphics {
}
}
Control prevFocused = null;
protected override void OnMouseEnter(EventArgs e) {
prevFocused = Form.ActiveForm.ActiveControl;
this.Focus();
}
protected override void OnMouseLeave(EventArgs e) {
prevFocused.Focus();
}
protected override void OnMouseWheel(MouseEventArgs e) {
Form.ActiveForm.Text = e.Delta.ToString();
rc.scale *= Math.Pow(1.0008, e.Delta);
Invalidate();
}

View File

@ -28,8 +28,10 @@
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.canvas1 = new JuicyGraphics.canvas();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.canvas1 = new JuicyGraphics.canvas();
this.menuStrip1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@ -74,6 +76,8 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.button2);
this.tabPage1.Controls.Add(this.button1);
this.tabPage1.Controls.Add(this.canvas1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
@ -83,6 +87,36 @@
this.tabPage1.Text = "Scene Editor";
this.tabPage1.UseVisualStyleBackColor = true;
//
// 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;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(532, 7);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
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;
//
// canvas1
//
this.canvas1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -94,16 +128,6 @@
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);
@ -133,6 +157,8 @@
private System.Windows.Forms.TabPage tabPage1;
private canvas canvas1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
}
}

View File

@ -40,7 +40,6 @@ namespace SharpGL.RenderContextProviders
/// <param name="hdc">The HDC.</param>
public override void Blit(IntPtr hdc)
{
// TODO: Should this do something in the case of an external context?
if (this.deviceContextHandle != IntPtr.Zero || this.windowHandle != IntPtr.Zero)
{
//Swap the buffers.
@ -53,7 +52,6 @@ namespace SharpGL.RenderContextProviders
/// </summary>
public override void MakeCurrent()
{
// TODO: Should this have an effect with an external context?
// if (renderContextHandle != IntPtr.Zero)
// Win32.wglMakeCurrent(deviceContextHandle, renderContextHandle);
}

View File

@ -104,7 +104,6 @@ namespace SharpGL.RenderContextProviders
DestroyFramebuffers();
// TODO: We should be able to just use the code below - however we
// get invalid dimension issues at the moment, so recreate for now.
/*

View File

@ -112,7 +112,6 @@ namespace SharpGL.RenderContextProviders
}
catch(Exception)
{
// TODO: can we actually get the real version?
createdOpenGLVersion = OpenGLVersion.OpenGL2_1;
}
}

View File

@ -137,7 +137,6 @@ namespace SharpGL.Shaders
if (uniformNamesToLocations.ContainsKey(uniformName) == false)
{
uniformNamesToLocations[uniformName] = gl.GetUniformLocation(shaderProgramObject, uniformName);
// TODO: if it's not found, we should probably throw an exception.
}
// Return the uniform location.