svn path=/trunk/DemoLib/; revision=74584
This commit is contained in:
Jeffrey Stedfast 2007-03-19 01:52:06 +00:00
Коммит 863de2ffa5
29 изменённых файлов: 3238 добавлений и 0 удалений

1
AUTHORS Normal file
Просмотреть файл

@ -0,0 +1 @@
Jeffrey Stedfast <fejj@novell.com>

0
ChangeLog Normal file
Просмотреть файл

16
DemoLib.mds Normal file
Просмотреть файл

@ -0,0 +1,16 @@
<Combine name="DemoLib" fileversion="2.0" outputpath="./build/bin/" MakePkgConfig="False" MakeLibPC="True">
<Configurations active="Debug">
<Configuration name="Debug" ctype="CombineConfiguration">
<Entry build="True" name="DemoLib" configuration="Debug" />
</Configuration>
<Configuration name="Release" ctype="CombineConfiguration">
<Entry build="True" name="DemoLib" configuration="Release" />
</Configuration>
</Configurations>
<StartMode startupentry="DemoLib" single="True">
<Execute type="None" entry="DemoLib" />
</StartMode>
<Entries>
<Entry filename="./DemoLib/DemoLib.mdp" />
</Entries>
</Combine>

199
DemoLib/Camera.cs Normal file
Просмотреть файл

@ -0,0 +1,199 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace DemoLib {
public class Camera {
Vertex position;
Vector viewdir;
Vector right;
Vector up;
// Default Constructor
public Camera () {
position = new Vertex (0.0f, 0.0f, 0.0f);
viewdir = new Vector (0.0f, 0.0f, -1.0f);
right = new Vector (1.0f, 0.0f, 0.0f);
up = new Vector (0.0f, 1.0f, 0.0f);
}
// Positional Constructors
public Camera (Vertex position) {
this.position = position;
viewdir = new Vector (0.0f, 0.0f, -1.0f);
right = new Vector (1.0f, 0.0f, 0.0f);
up = new Vector (0.0f, 1.0f, 0.0f);
}
public Camera (float x, float y, float z) {
position = new Vertex (x, y, z);
viewdir = new Vector (0.0f, 0.0f, -1.0f);
right = new Vector (1.0f, 0.0f, 0.0f);
up = new Vector (0.0f, 1.0f, 0.0f);
}
// Positional + LookAt Constructors
public Camera (Vertex position, Vertex target) {
this.position = position;
LookAt (target);
}
public Camera (Vertex position, Vertex target, Vector upVector) {
this.position = position;
LookAt (target, upVector);
}
// Properties
public Vertex Position {
get { return position; }
set { position = value; }
}
public Vector ViewDirection {
get { return viewdir; }
}
// FIXME: better name for this?
public Vector RightVector {
get { return right; }
}
// FIXME: better name for this?
public Vector UpVector {
get { return up; }
}
// Methods
// Direct the camera toward a specific point in space
public void LookAt (float x, float y, float z) {
Vertex point = new Vertex (x, y, z);
LookAt (point);
}
public void LookAt (Vertex point) {
Vector delta = point - position;
viewdir = delta.Normal;
if (Math.Abs (delta.x) < 0.00001f && Math.Abs (delta.z) < 0.00001f) {
delta.x = 0.0f;
delta.Normalize ();
right = new Vector (1.0f, 0.0f, 0.0f);
up = delta.Cross (right);
right = viewdir.Cross (up) * -1.0f;
} else {
delta.y = 0.0f;
delta.Normalize ();
up = new Vector (0.0f, 1.0f, 0.0f);
right = delta.Cross (up) * -1.0f;
up = viewdir.Cross (right);
}
right.Normalize ();
up.Normalize ();
}
// Direct the camera toward a specific point in space using the specified upward orientation
public void LookAt (Vertex point, Vector upVector) {
viewdir = point - position;
viewdir.Normalize ();
up = upVector.Normal;
right = viewdir.Cross (up);
right.Normalize ();
}
// Move the camera relative to world axis
public void Move (Vector amount) {
position += amount;
}
// Move the camera relative to its own axis/orientation
public void MoveRelative (Vector amount) {
Elevate (amount.y);
Strafe (amount.x);
Zoom (amount.z);
}
// Move the camera to a specific position
public void MoveTo (Vertex point) {
position = point;
}
// Move the camera to a specific position
public void MoveTo (float x, float y, float z) {
position = new Vertex (x, y, z);
}
// Rotate camera up or down (aka Tilt)
public void Pitch (float angle) {
// rotate around the right vector (normally the x-axis)
viewdir = (viewdir * (float) Math.Cos (angle)) + (up * (float) Math.Sin (angle));
viewdir.Normalize ();
up = viewdir.Cross (right);
up.Normalize ();
}
// Rotate camera left or right (aka Pan)
public void Yaw (float angle) {
// rotate around the up vector (normally the y-axis)
viewdir = (viewdir * (float) Math.Cos (angle)) - (right * (float) Math.Sin (angle));
viewdir.Normalize ();
right = viewdir.Cross (up);
right.Normalize ();
}
// Roll the camera left or right
public void Roll (float angle) {
// rotate around the view-direction vector (normally the z-axis)
right = (right * (float) Math.Cos (angle)) + (up * (float) Math.Sin (angle));
right.Normalize ();
up = viewdir.Cross (right) * -1.0f;
up.Normalize ();
}
// Change the elevation of the camera
public void Elevate (float amount) {
position += (up * amount);
}
// Strafe the camera left or right
public void Strafe (float amount) {
position += (right * amount);
}
// Zoom camera in or out
public void Zoom (float amount) {
position += (viewdir * amount);
}
}
}

241
DemoLib/Demo.cs Normal file
Просмотреть файл

@ -0,0 +1,241 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Collections;
using Tao.OpenGl;
using Tao.FreeGlut;
namespace DemoLib {
public class Demo {
static string title = "DemoLib Demo";
static int displayFlags = 0;
static int height = 560;
static int width = 704;
static bool fullscreen;
static bool loop;
static ArrayList scenes;
static int scene = 0;
static int lastFrame = 0;
// FPS vars
static int fpsTarget = 80;
static int fpsTimerStart = 0;
static int vfpsNumFrames = 0;
static int fpsNumFrames = 0;
// Constructors
public Demo () {
Glut.glutInit ();
SetGLDefaults ();
}
static void SetGLDefaults () {
Gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
Gl.glDisable (Gl.GL_BLEND);
Gl.glDisable (Gl.GL_CULL_FACE);
Gl.glDisable (Gl.GL_DEPTH_TEST);
Gl.glDisable (Gl.GL_FOG);
Gl.glDisable (Gl.GL_DITHER);
Gl.glDisable (Gl.GL_LINE_STIPPLE);
Gl.glDisable (Gl.GL_LIGHT0);
Gl.glDisable (Gl.GL_LIGHTING);
Gl.glDisable (Gl.GL_NORMALIZE);
Gl.glDisable (Gl.GL_TEXTURE_1D);
Gl.glDisable (Gl.GL_TEXTURE_2D);
Gl.glDisable (Gl.GL_TEXTURE_3D);
}
static void SetGLCallbacks () {
Glut.glutDisplayFunc (new Glut.DisplayCallback (Display));
Glut.glutReshapeFunc (new Glut.ReshapeCallback (Reshape));
Glut.glutIdleFunc (new Glut.IdleCallback (Idle));
Glut.glutKeyboardFunc (new Glut.KeyboardCallback (Keyboard));
Glut.glutSpecialFunc (new Glut.SpecialCallback (Special));
}
// Properties
public int DesiredFPS {
get { return fpsTarget; }
set { fpsTarget = value; }
}
// Methods
public void Init (string title) {
Init (title, 704, 560, false);
}
public void Init (string title, int width, int height) {
Init (title, width, height, false);
}
public void Init (string title, int width, int height, bool fullscreen) {
Demo.fullscreen = fullscreen;
Demo.height = height;
Demo.width = width;
Demo.title = title;
scenes = new ArrayList ();
}
public void AddScene (Scene scene) {
if (scene == null)
throw new ArgumentNullException ();
/* Collect other glutInitDisplayMode flags: some scenes may need the
* stencil buffer, others might need the accum buffer, still others
* might need the depth buffer, etc. */
displayFlags |= scene.DisplayFlags;
scenes.Add (scene);
}
public void Run () {
Run (false);
}
public void Run (bool loop) {
if (scenes.Count < 1)
return;
Glut.glutInitDisplayMode (Glut.GLUT_RGBA | Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH);
Glut.glutInitWindowSize (width, height);
Glut.glutCreateWindow (title);
if (fullscreen)
Glut.glutFullScreen ();
Demo.loop = loop;
((Scene) scenes[0]).Reset (width, height);
SetGLCallbacks ();
Glut.glutMainLoop ();
}
static void RenderFPS () {
int now = Environment.TickCount;
if (fpsTimerStart == 0) {
fpsTimerStart = now;
return;
}
if ((now - fpsTimerStart) > 5000) {
//float secs = (now - fpsTimerStart) / 1000;
//System.Console.WriteLine ("{0} frames ({1} virtual) in {2:f1} seconds = {3:f3} FPS ({4:f3} virtual)",
// fpsNumFrames, vfpsNumFrames, secs, fpsNumFrames / secs, vfpsNumFrames / secs);
fpsTimerStart = now;
vfpsNumFrames = 0;
fpsNumFrames = 0;
}
}
// OpenGL Event callbacks
static void Display () {
((Scene) scenes[scene]).RenderFrame ();
//fpsNumFrames++;
RenderFPS ();
Glut.glutSwapBuffers ();
}
static void Reshape (int width, int height) {
Demo.height = height;
Demo.width = width;
((Scene) scenes[scene]).Resize (width, height);
}
static int FramesElapsed () {
int now = Environment.TickCount;
int n;
if (lastFrame == 0) {
lastFrame = now;
return 1;
}
if ((n = ((now - lastFrame) / (1000 / fpsTarget))) > 0) {
lastFrame = now;
return n;
}
return 0;
}
static void Idle () {
int nFrames = FramesElapsed ();
int i = 0;
if (nFrames == 0) {
//Glut.glutPostRedisplay ();
return;
}
while (i < nFrames) {
if (!((Scene) scenes[scene]).AdvanceFrame ()) {
scene++;
if (scene == scenes.Count) {
if (!loop)
Environment.Exit (0);
scene = 0;
}
((Scene) scenes[scene]).Reset (width, height);
}
i++;
}
fpsNumFrames++;
vfpsNumFrames += nFrames;
Glut.glutPostRedisplay ();
}
static void Keyboard (byte c, int x, int y) {
switch ((char) c) {
case 'q':
case 'Q':
Environment.Exit (0);
break;
}
}
static void Special (int c, int x, int y) {
switch (c) {
case 27: // Escape
Environment.Exit (0);
break;
}
}
}
}

48
DemoLib/DemoLib.mdp Normal file
Просмотреть файл

@ -0,0 +1,48 @@
<Project name="DemoLib" fileversion="2.0" language="C#" clr-version="Net_1_1" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="./bin/Debug" assembly="DemoLib" />
<Build debugmode="True" target="Exe" />
<Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" win32Icon="./" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
<Output directory="./bin/Release" assembly="DemoLib" />
<Build debugmode="False" target="WinExe" />
<Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" win32Icon="./" ctype="CSharpCompilerParameters" />
</Configuration>
</Configurations>
<Contents>
<File name="./Vertex.cs" subtype="Code" buildaction="Compile" />
<File name="./Vector.cs" subtype="Code" buildaction="Compile" />
<File name="./Scene.cs" subtype="Code" buildaction="Compile" />
<File name="./Demo.cs" subtype="Code" buildaction="Compile" />
<File name="./gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" />
<File name="./gtk-gui/generated.cs" subtype="Code" buildaction="Compile" />
<File name="./ScreenResolution.cs" subtype="Code" buildaction="Compile" />
<File name="./gtk-gui/DemoLib.ScreenResolution.cs" subtype="Code" buildaction="Compile" />
<File name="./Program.cs" subtype="Code" buildaction="Compile" />
<File name="./FloatingCageScene.cs" subtype="Code" buildaction="Compile" />
<File name="./IScene.cs" subtype="Code" buildaction="Compile" />
<File name="./Camera.cs" subtype="Code" buildaction="Compile" />
<File name="./VectorCubesScene.cs" subtype="Code" buildaction="Compile" />
<File name="./VectorCubeFormations.cs" subtype="Code" buildaction="Compile" />
<File name="./Resources" subtype="Directory" buildaction="Compile" />
<File name="./References" subtype="Directory" buildaction="Compile" />
<File name="./References/Linux" subtype="Directory" buildaction="Compile" />
<File name="./References/Win32" subtype="Directory" buildaction="Compile" />
<File name="./Properties/AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<ProjectReference type="Assembly" localcopy="True" refto="./References/Linux/Tao.FreeGlut.dll" />
<ProjectReference type="Assembly" localcopy="True" refto="./References/Linux/Tao.OpenGl.dll" />
<ProjectReference type="Assembly" localcopy="True" refto="./References/Linux/Tao.OpenGl.ExtensionLoader.dll" />
<ProjectReference type="Assembly" localcopy="True" refto="./References/Linux/Tao.OpenGl.Glu.dll" />
</References>
<GtkDesignInfo partialTypes="True" />
</Project>

Двоичные данные
DemoLib/DemoLib.pidb Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,416 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using DemoLib;
using Tao.OpenGl;
using Tao.FreeGlut;
namespace DemoLib {
public class FloatingCageScene : Scene {
static float CAMERA_ZOOM_SPEED_X = 0.0f;
static float CAMERA_ZOOM_SPEED_Y = 0.0f;
static float CAMERA_ZOOM_SPEED_Z = -0.08f;
static float INNER_ROT_X = 0.7f;
static float INNER_ROT_Y = 0.8f;
static float INNER_ROT_Z = 0.9f;
static float OUTER_ROT_X = -0.7f;
static float OUTER_ROT_Y = -0.8f;
static float OUTER_ROT_Z = -0.9f;
static readonly float[,,] innerVerts = new float[4,4,3] {
/* normal: 0.0f, 1.0f, 0.0f */
{ { -4.0f, -3.0f, 3.0f },
{ -4.0f, -3.0f, -3.0f },
{ -3.0f, -3.0f, 3.0f },
{ -3.0f, -3.0f, -3.0f },
},
{ { 3.0f, -3.0f, 3.0f },
{ 3.0f, -3.0f, -3.0f },
{ 4.0f, -3.0f, 3.0f },
{ 4.0f, -3.0f, -3.0f },
},
{ { -3.0f, -3.0f, 4.0f },
{ -3.0f, -3.0f, 3.0f },
{ 3.0f, -3.0f, 4.0f },
{ 3.0f, -3.0f, 3.0f },
},
{ { -3.0f, -3.0f, -3.0f },
{ -3.0f, -3.0f, -4.0f },
{ 3.0f, -3.0f, -3.0f },
{ 3.0f, -3.0f, -4.0f },
}
};
static readonly float[,,] outerVerts = new float[4,4,3] {
/* normal: 0.0f, 1.0f, 0.0f */
{ { -4.0f, -4.0f, 4.0f },
{ -4.0f, -4.0f, -4.0f },
{ -3.0f, -4.0f, 4.0f },
{ -3.0f, -4.0f, -4.0f },
},
{ { 3.0f, -4.0f, 4.0f },
{ 3.0f, -4.0f, -4.0f },
{ 4.0f, -4.0f, 4.0f },
{ 4.0f, -4.0f, -4.0f },
},
{ { -4.0f, -4.0f, 4.0f },
{ -4.0f, -4.0f, 3.0f },
{ 4.0f, -4.0f, 4.0f },
{ 4.0f, -4.0f, 3.0f },
},
{ { -4.0f, -4.0f, -3.0f },
{ -4.0f, -4.0f, -4.0f },
{ 4.0f, -4.0f, -3.0f },
{ 4.0f, -4.0f, -4.0f },
}
};
enum State {
START = 0,
ZOOM_OUT = 1,
ZOOMED_OUT = 2,
ZOOM_IN = 3,
FINISH = 4,
FADE_OUT = 5,
COMPLETE
}
struct vector_t {
public float x;
public float y;
public float z;
}
State state;
int nFrames;
vector_t innerCage;
int innerCageId;
vector_t outerCage;
int outerCageId;
vector_t camera;
// Constructors
public FloatingCageScene () : base () {
//camera = new Vertex ();
//innerCage = new Vertex ();
//outerCage = new Vertex ();
}
// Private initialization
static void SwapVerts (ref float[,,] verts, int i, int v0, int v1) {
float[] tmp = new float [3];
int k;
for (k = 0; k < 3; k++)
tmp[k] = verts[i,v0,k];
for (k = 0; k < 3; k++)
verts[i,v0,k] = verts[i,v1,k];
for (k = 0; k < 3; k++)
verts[i,v1,k] = tmp[k];
}
static void DrawCage (byte[] colour, float[,,] verts, float normv, bool swap) {
int norm = 1;
int i, j;
do {
float normx, normy, normz;
Gl.glColor3ubv (colour);
switch (norm) {
case 0:
normx = normv;
normy = 0.0f;
normz = 0.0f;
break;
case 1:
default:
normx = 0.0f;
normy = normv;
normz = 0.0f;
break;
case 2:
normx = 0.0f;
normy = 0.0f;
normz = normv;
break;
}
for (i = 0; i < 4; i++) {
if (swap)
SwapVerts (ref verts, i, 0, 3);
/* draw 4 faces */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f (normx, normy, normz);
for (j = 0; j < 4; j++) {
Gl.glVertex3fv (ref verts[i,j,0]);
verts[i,j,norm] = -verts[i,j,norm];
}
Gl.glEnd ();
SwapVerts (ref verts, i, 0, 3);
/* draw the opposite 4 faces */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f (-normx, -normy, -normz);
for (j = 0; j < 4; j++) {
float tmp;
Gl.glVertex3fv (ref verts[i,j,0]);
verts[i,j,norm] = -verts[i,j,norm];
/* shift all co-ords one axis */
if (norm == 1) {
tmp = verts[i,j,0];
verts[i,j,0] = verts[i,j,1];
verts[i,j,1] = tmp;
} else {
tmp = verts[i,j,0];
verts[i,j,0] = verts[i,j,2];
verts[i,j,2] = tmp;
}
}
Gl.glEnd ();
if (swap)
SwapVerts (ref verts, i, 0, 3);
}
/* darken the colour */
if (colour[0] > 0)
colour[0] -= 64;
if (colour[1] > 0)
colour[1] -= 64;
if (colour[2] > 0)
colour[2] -= 64;
norm = (norm + 2) % 3;
} while (norm != 1);
}
static int GetCageId (byte[] colour) {
byte[] red = new byte[3] { 226, 0, 0 };
float[,,] verts = new float[4,4,3];
int id;
id = Gl.glGenLists (1);
Gl.glNewList (id, Gl.GL_COMPILE);
Array.Copy (outerVerts, verts, 48);
DrawCage (red, verts, 1.0f, false);
Array.Copy (innerVerts, verts, 48);
DrawCage (colour, verts, 1.0f, true);
Gl.glEndList ();
return id;
}
void InitCallLists () {
if (innerCageId != 0)
return;
byte[] colour = new byte[3] { 0, 0, 0 };
colour[1] = 226;
innerCageId = GetCageId (colour);
colour[1] = 0;
colour[2] = 226;
outerCageId = GetCageId (colour);
}
// Interface Properties
public override int DisplayFlags {
get { return Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH; }
}
public override bool Complete {
get { return state >= State.COMPLETE; }
}
// Interface Methods
public override void Reset (int width, int height) {
Gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
Gl.glClearDepth (1.0f);
Gl.glShadeModel (Gl.GL_FLAT);
Gl.glEnable (Gl.GL_CULL_FACE);
Gl.glCullFace (Gl.GL_BACK);
Gl.glEnable (Gl.GL_DEPTH_TEST);
Gl.glDepthFunc (Gl.GL_LEQUAL);
Gl.glDisable (Gl.GL_BLEND);
Gl.glHint (Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
state = State.START;
nFrames = 0;
innerCage.x = 0.0f;
innerCage.y = 0.0f;
innerCage.z = 0.0f;
outerCage.x = 0.0f;
outerCage.y = 0.0f;
outerCage.z = 0.0f;
camera.x = 0.0f;
camera.y = 0.0f;
camera.z = -1.3f;
InitCallLists ();
Resize (width, height);
}
public override void Resize (int width, int height) {
Gl.glViewport (0, 0, width, height);
Gl.glMatrixMode (Gl.GL_PROJECTION);
Gl.glLoadIdentity ();
Glu.gluPerspective (45.0f, (double) width / (double) height, 0.1f, 100.0f);
Gl.glMatrixMode (Gl.GL_MODELVIEW);
Gl.glLoadIdentity ();
}
public override bool AdvanceFrame () {
bool zoom = false;
innerCage.x += INNER_ROT_X;
innerCage.y += INNER_ROT_Y;
innerCage.z += INNER_ROT_Z;
outerCage.x += OUTER_ROT_X;
outerCage.y += OUTER_ROT_Y;
outerCage.z += OUTER_ROT_Z;
if (state == State.ZOOM_IN) {
camera.x -= CAMERA_ZOOM_SPEED_X;
camera.y -= CAMERA_ZOOM_SPEED_Y;
camera.z -= CAMERA_ZOOM_SPEED_Z;
zoom = true;
} else if (state == State.ZOOM_OUT) {
camera.x += CAMERA_ZOOM_SPEED_X;
camera.y += CAMERA_ZOOM_SPEED_Y;
camera.z += CAMERA_ZOOM_SPEED_Z;
zoom = true;
} else if (state == State.FADE_OUT) {
// this is a short-lived state as well
zoom = true;
}
if ((zoom && nFrames == 175) || nFrames == 800) {
nFrames = 0;
state++;
} else
nFrames++;
return state != State.COMPLETE;
}
public override void RenderFrame () {
byte[] fade = new byte [4] { 0, 0, 0, 0 };
Gl.glClear (Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
if (state == State.COMPLETE)
return;
Gl.glPolygonMode (Gl.GL_FRONT_AND_BACK, Gl.GL_FILL);
Gl.glLoadIdentity ();
Gl.glTranslatef (camera.x, camera.y, camera.z);
Gl.glPushMatrix ();
Gl.glScalef (0.3f, 0.3f, 0.3f);
Gl.glRotatef (innerCage.x, 1.0f, 0.0f, 0.0f);
Gl.glRotatef (innerCage.y, 0.0f, 1.0f, 0.0f);
Gl.glRotatef (innerCage.z, 0.0f, 0.0f, 1.0f);
Gl.glCallList (innerCageId);
Gl.glPopMatrix ();
Gl.glPushMatrix ();
Gl.glScalef (0.6f, 0.6f, 0.6f);
Gl.glRotatef (outerCage.x, 1.0f, 0.0f, 0.0f);
Gl.glRotatef (outerCage.y, 0.0f, 1.0f, 0.0f);
Gl.glRotatef (outerCage.z, 0.0f, 0.0f, 1.0f);
Gl.glCallList (outerCageId);
Gl.glPopMatrix ();
if (state == State.START && nFrames < 128) {
Gl.glEnable (Gl.GL_BLEND);
Gl.glBlendFunc (Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
Gl.glDisable (Gl.GL_DEPTH_TEST);
fade[3] = (byte) (255 - (nFrames * 2));
Gl.glColor4ubv (fade);
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, 0.0f, 1.0f);
Gl.glVertex3f (-1.0f, 1.0f, 0.0f);
Gl.glVertex3f (-1.0f, -1.0f, 0.0f);
Gl.glVertex3f ( 1.0f, 1.0f, 0.0f);
Gl.glVertex3f ( 1.0f, -1.0f, 0.0f);
Gl.glEnd ();
Gl.glDisable (Gl.GL_BLEND);
Gl.glEnable (Gl.GL_DEPTH_TEST);
Gl.glDepthFunc (Gl.GL_LEQUAL);
} else if (state == State.FADE_OUT) {
Gl.glEnable (Gl.GL_BLEND);
Gl.glBlendFunc (Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
Gl.glDisable (Gl.GL_DEPTH_TEST);
fade[3] = (byte) (nFrames * (255.0f / 175.0f));
Gl.glColor4ubv (fade);
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, 0.0f, 1.0f);
Gl.glVertex3f (-1.0f, 1.0f, 0.0f);
Gl.glVertex3f (-1.0f, -1.0f, 0.0f);
Gl.glVertex3f ( 1.0f, 1.0f, 0.0f);
Gl.glVertex3f ( 1.0f, -1.0f, 0.0f);
Gl.glEnd ();
Gl.glDisable (Gl.GL_BLEND);
Gl.glEnable (Gl.GL_DEPTH_TEST);
Gl.glDepthFunc (Gl.GL_LEQUAL);
}
}
}
}

41
DemoLib/IScene.cs Normal file
Просмотреть файл

@ -0,0 +1,41 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace DemoLib {
public interface IScene {
// Get required OpenGL display flags
int DisplayFlags { get; }
// Check if the Scene is complete
bool Complete { get; }
// Reset the scene
void Reset (int width, int height);
// Resize the scene
void Resize (int width, int height);
// Advance to the next frame
bool AdvanceFrame ();
// Render the current frame
void RenderFrame ();
}
}

53
DemoLib/Program.cs Normal file
Просмотреть файл

@ -0,0 +1,53 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using DemoLib;
using Gtk;
namespace DemoLib {
class Program {
public static void Main (string[] args) {
Application.Init ();
ScreenResolution res = new ScreenResolution ();
res.Show ();
Application.Run ();
if (res.Exit) {
System.Console.WriteLine ("User clicked Exit");
return;
}
System.Console.WriteLine ("Resolution: {0}x{1}:{2} FullScreen={3}",
res.Width, res.Height, res.ColourDepth, res.FullScreen);
Demo demo = new Demo ();
demo.Init ("OpenGL#", res.Width, res.Height, res.FullScreen);
Scene scene = new VectorCubesScene (false);
demo.AddScene (scene);
scene = new FloatingCageScene ();
demo.AddScene (scene);
demo.Run (true);
return;
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

Двоичные данные
DemoLib/References/Linux/Tao.FreeGlut.dll Executable file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="freeglut.dll" target="libglut.so.3" />
</configuration>

Двоичные данные
DemoLib/References/Linux/Tao.OpenGl.ExtensionLoader.dll Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,4 @@
<configuration>
<dllmap dll="opengl32.dll" target="libGL.so.1" />
<dllmap dll="glu32.dll" target="libGLU.so.1" />
</configuration>

Двоичные данные
DemoLib/References/Linux/Tao.OpenGl.Glu.dll Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,4 @@
<configuration>
<dllmap dll="opengl32.dll" target="libGL.so.1" />
<dllmap dll="glu32.dll" target="libGLU.so.1" />
</configuration>

Двоичные данные
DemoLib/References/Linux/Tao.OpenGl.dll Executable file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,4 @@
<configuration>
<dllmap dll="opengl32.dll" target="libGL.so.1" />
<dllmap dll="glu32.dll" target="libGLU.so.1" />
</configuration>

53
DemoLib/Scene.cs Normal file
Просмотреть файл

@ -0,0 +1,53 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace DemoLib {
public class Scene : IScene {
// Constructors
public Scene () {
}
// Interface Properties
public virtual int DisplayFlags {
get { return 0; }
}
public virtual bool Complete {
get { return false; }
}
// Interface Methods
public virtual void Reset (int width, int height) {
}
public virtual void Resize (int width, int height) {
}
public virtual bool AdvanceFrame () {
return true;
}
public virtual void RenderFrame () {
}
}
}

151
DemoLib/ScreenResolution.cs Normal file
Просмотреть файл

@ -0,0 +1,151 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace DemoLib {
public partial class ScreenResolution : Gtk.Dialog {
bool exitClicked;
void PlayClicked (object button, System.EventArgs args) {
exitClicked = false;
this.Hide ();
Gtk.Main.Quit ();
}
void ExitClicked (object button, System.EventArgs args) {
exitClicked = true;
this.Hide ();
Gtk.Main.Quit ();
}
// Constructors
public ScreenResolution () {
Build ();
button_play.Clicked += PlayClicked;
button_exit.Clicked += ExitClicked;
}
public ScreenResolution (int width, int height)
: this () {
Gtk.ToggleButton radio;
string label;
label = width.ToString () + "x" + height.ToString ();
switch (label) {
case "320x240":
radio = radio_320x240;
break;
case "640x480":
radio = radio_640x480;
break;
case "800x600":
radio = radio_800x600;
break;
case "1024x768":
radio = radio_1024x768;
break;
case "1280x1024":
radio = radio_1280x1024;
break;
case "1400x1280":
radio = radio_1400x1280;
break;
default:
throw new ArgumentOutOfRangeException ();
}
radio.Active = true;
}
public ScreenResolution (int width, int height, bool fullscreen)
: this (width, height) {
checkbox_fullscreen.Active = fullscreen;
}
public ScreenResolution (int width, int height, bool fullscreen, int colourDepth)
: this (width, height, fullscreen) {
if (colourDepth != 16 && colourDepth != 32)
throw new ArgumentOutOfRangeException ("colourDepth");
if (colourDepth == 16)
radio_16bit.Active = true;
else if (colourDepth == 32)
radio_32bit.Active = true;
}
// Properties
public bool Exit {
get { return exitClicked; }
}
public int Width {
get {
if (radio_320x240.Active)
return 320;
if (radio_640x480.Active)
return 640;
if (radio_800x600.Active)
return 800;
if (radio_1024x768.Active)
return 1024;
if (radio_1280x1024.Active)
return 1280;
if (radio_1400x1280.Active)
return 1400;
return -1;
}
}
public int Height {
get {
if (radio_320x240.Active)
return 240;
if (radio_640x480.Active)
return 480;
if (radio_800x600.Active)
return 600;
if (radio_1024x768.Active)
return 768;
if (radio_1280x1024.Active)
return 1024;
if (radio_1400x1280.Active)
return 1280;
return -1;
}
}
public bool FullScreen {
get { return checkbox_fullscreen.Active; }
}
public int ColourDepth {
get {
if (radio_16bit.Active)
return 16;
if (radio_32bit.Active)
return 32;
return -1;
}
}
}
}

299
DemoLib/Vector.cs Normal file
Просмотреть файл

@ -0,0 +1,299 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Text;
namespace DemoLib {
public class Vector : ICloneable {
public static readonly Vector Zero = new Vector (0.0f, 0.0f, 0.0f);
public static readonly Vector Up = new Vector (0.0f, 1.0f, 0.0f);
public float[] v;
// Constructors
public Vector ()
: this (0.0f, 0.0f, 0.0f, 1.0f) {
}
public Vector (float x)
: this (x, 0.0f, 0.0f, 1.0f) {
}
public Vector (float x, float y)
: this (x, y, 0.0f, 1.0f) {
}
public Vector (float x, float y, float z)
: this (x, y, z, 1.0f) {
}
public Vector (float x, float y, float z, float w) {
v = new float[4];
v[0] = x;
v[1] = y;
v[2] = z;
v[3] = w;
}
// Properties
public float x {
get { return v[0]; }
set { v[0] = value; }
}
public float y {
get { return v[1]; }
set { v[1] = value; }
}
public float z {
get { return v[2]; }
set { v[2] = value; }
}
public float w {
get { return v[3]; }
set { v[3] = value; }
}
float x2y2z2 {
get { return (x * x) + (y * y) + (z * z); }
}
// Length of this Vector
public float Length {
get {
return (float) Math.Sqrt ((double) (x2y2z2));
}
}
// A new Normal Vector representative of this Vector
public Vector Normal {
get {
float len = this.Length;
if (len == 0.0f)
return this;
return new Vector (x / len, y / len, z / len, w);
}
}
// Angle between this Vector and the X-Axis
public float AngleX {
get {
float n = x2y2z2;
return (float) Math.Acos (x / Math.Sqrt ((double) (n * n)));
}
}
// Angle between this Vector and the Y-Axis
public float AngleY {
get {
float n = x2y2z2;
return (float) Math.Acos (y / Math.Sqrt ((double) (n * n)));
}
}
// Angle between this Vector and the Z-Axis
public float AngleZ {
get {
float n = x2y2z2;
return (float) Math.Acos (z / Math.Sqrt ((double) (n * n)));
}
}
// Methods
public object Clone () {
return new Vector (x, y, z, w);
}
// Normalize this Vector
public void Normalize () {
float len = this.Length;
if (len == 0.0f)
return;
x /= len;
y /= len;
z /= len;
}
// Angle between this Vector and another Vector
public float Angle (Vector vector) {
float dot = this.Dot (vector);
float n1 = vector.x2y2z2;
float n0 = x2y2z2;
return (float) Math.Acos (dot / Math.Sqrt ((double) (n0 * n1)));
}
/* Matrix math:
* 1 0 0 0
* 0 cos (a) -sin (a) 0
* 0 sin (a) cos (a) 0
* 0 0 0 1
**/
public void RotateX (float angle) {
y = (y * (float) Math.Cos (angle)) - (z * (float) Math.Sin (angle));
z = (y * (float) Math.Sin (angle)) + (z * (float) Math.Cos (angle));
}
/* Matrix math:
* cos (a) 0 sin (a) 0
* 0 1 0 0
* -sin (a) 0 cos (a) 0
* 0 0 0 1
**/
public void RotateY (float angle) {
x = (x * (float) Math.Cos (angle)) + (z * (float) Math.Sin (angle));
z = -(x * (float) Math.Sin (angle)) + (z * (float) Math.Cos (angle));
}
/* Matrix math:
* cos (a) -sin (a) 0 0
* sin (a) cos (a) 0 0
* 0 0 1 0
* 0 0 0 1
**/
public void RotateZ (float angle) {
x = (x * (float) Math.Cos (angle)) - (y * (float) Math.Sin (angle));
y = (x * (float) Math.Sin (angle)) + (y * (float) Math.Cos (angle));
}
// Dot product of 2 Vectors
public float Dot (Vector vector) {
return (x * vector.x) + (y * vector.y) + (z * vector.z);
}
// Cross product of 2 Vectors
public Vector Cross (Vector vector) {
return new Vector ((y * vector.z) - (z * vector.y),
(z * vector.z) - (z * vector.x),
(x * vector.y) - (y * vector.x));
}
// Dot product of 2 Vectors
public static float Dot (Vector v0, Vector v1) {
return (v0.x * v1.x) + (v0.y * v1.y) + (v0.z * v1.z);
}
// Cross product of 2 Vectors
public static Vector Cross (Vector v0, Vector v1) {
return new Vector ((v0.y * v1.z) - (v0.z * v1.y),
(v0.z * v1.z) - (v0.z * v1.x),
(v0.x * v1.y) - (v0.y * v1.x));
}
// Overloaded Operators
public static explicit operator Vertex (Vector v) {
return new Vertex (v.x, v.y, v.z);
}
// Multiplication by a scalar value
public static Vector operator * (Vector v, float scalar) {
return new Vector (v.x * scalar, v.y * scalar, v.z * scalar);
}
// Division by a scalar value
public static Vector operator / (Vector v, float scalar) {
if (scalar == 0.0f)
throw new DivideByZeroException ();
return new Vector (v.x / scalar, v.y / scalar, v.z / scalar);
}
// Vector addition
public static Vector operator + (Vector v0, Vector v1) {
return new Vector (v0.x + v1.x, v0.y + v1.y, v0.z + v1.z);
}
// Vector subtraction
public static Vector operator - (Vector v0, Vector v1) {
return new Vector (v0.x - v1.x, v0.y - v1.y, v0.z - v1.z);
}
public static bool operator == (Vector v0, Vector v1) {
return ((Math.Abs (v1.x - v0.x) < 0.00001f) &&
(Math.Abs (v1.y - v0.y) < 0.00001f) &&
(Math.Abs (v1.z - v0.z) < 0.00001f));
}
public static bool operator != (Vector v0, Vector v1) {
return ((Math.Abs (v1.x - v0.x) >= 0.00001f) ||
(Math.Abs (v1.y - v0.y) >= 0.00001f) ||
(Math.Abs (v1.z - v0.z) >= 0.00001f));
}
// tolerance comparisons
public static bool operator < (Vector v, float tolerance) {
tolerance = Math.Abs (tolerance);
return ((Math.Abs (v.x) < tolerance) &&
(Math.Abs (v.y) < tolerance) &&
(Math.Abs (v.z) < tolerance));
}
public static bool operator <= (Vector v, float tolerance) {
tolerance = Math.Abs (tolerance);
return ((Math.Abs (v.x) <= tolerance) &&
(Math.Abs (v.y) <= tolerance) &&
(Math.Abs (v.z) <= tolerance));
}
public static bool operator > (Vector v, float tolerance) {
tolerance = Math.Abs (tolerance);
return ((Math.Abs (v.x) > tolerance) &&
(Math.Abs (v.y) > tolerance) &&
(Math.Abs (v.z) > tolerance));
}
public static bool operator >= (Vector v, float tolerance) {
tolerance = Math.Abs (tolerance);
return ((Math.Abs (v.x) >= tolerance) &&
(Math.Abs (v.y) >= tolerance) &&
(Math.Abs (v.z) >= tolerance));
}
public override string ToString () {
StringBuilder str = new StringBuilder ("Vector: (");
str.Append (x);
str.Append (", ");
str.Append (y);
str.Append (", ");
str.Append (z);
str.Append (')');
return str.ToString ();
}
public override bool Equals (object obj) {
return base.Equals (obj);
}
public override int GetHashCode () {
return base.GetHashCode ();
}
}
}

Просмотреть файл

@ -0,0 +1,380 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
namespace DemoLib {
public partial class VectorCubesScene : Scene {
static readonly float[,] flat_plane_floats = new float [144,3] {
{ 3.0f, 0.0f, 1.0f }, { 2.0f, 0.0f, -1.0f }, { -2.0f, 0.0f, 1.0f },
{ -6.0f, 0.0f, 3.0f }, { -6.0f, 0.0f, -3.0f }, { 1.0f, 0.0f, 4.0f },
{ 1.0f, 0.0f, 2.0f }, { 5.0f, 0.0f, -6.0f }, { -5.0f, 0.0f, -1.0f },
{ -1.0f, 0.0f, 2.0f }, { 5.0f, 0.0f, -1.0f }, { 0.0f, 0.0f, -1.0f },
{ 2.0f, 0.0f, -4.0f }, { 1.0f, 0.0f, 0.0f }, { 4.0f, 0.0f, -3.0f },
{ 5.0f, 0.0f, 2.0f }, { 0.0f, 0.0f, 1.0f }, { 2.0f, 0.0f, 1.0f },
{ -6.0f, 0.0f, -2.0f }, { -2.0f, 0.0f, -4.0f }, { 1.0f, 0.0f, -2.0f },
{ -6.0f, 0.0f, 0.0f }, { 5.0f, 0.0f, 5.0f }, { -3.0f, 0.0f, 5.0f },
{ 3.0f, 0.0f, -1.0f }, { 4.0f, 0.0f, 1.0f }, { 4.0f, 0.0f, -5.0f },
{ 1.0f, 0.0f, 5.0f }, { -3.0f, 0.0f, 0.0f }, { 2.0f, 0.0f, -3.0f },
{ -5.0f, 0.0f, -4.0f }, { -6.0f, 0.0f, 4.0f }, { 5.0f, 0.0f, -3.0f },
{ 0.0f, 0.0f, -5.0f }, { -3.0f, 0.0f, -5.0f }, { 4.0f, 0.0f, -2.0f },
{ -6.0f, 0.0f, -5.0f }, { -5.0f, 0.0f, 5.0f }, { 1.0f, 0.0f, -1.0f },
{ 1.0f, 0.0f, -4.0f }, { 3.0f, 0.0f, -3.0f }, { 5.0f, 0.0f, -5.0f },
{ 0.0f, 0.0f, 3.0f }, { 3.0f, 0.0f, -2.0f }, { 4.0f, 0.0f, -1.0f },
{ -3.0f, 0.0f, -4.0f }, { -1.0f, 0.0f, 0.0f }, { -2.0f, 0.0f, 2.0f },
{ 0.0f, 0.0f, -3.0f }, { 5.0f, 0.0f, 4.0f }, { 3.0f, 0.0f, 5.0f },
{ -5.0f, 0.0f, -6.0f }, { -5.0f, 0.0f, 2.0f }, { 0.0f, 0.0f, 5.0f },
{ -1.0f, 0.0f, -4.0f }, { 4.0f, 0.0f, 5.0f }, { 3.0f, 0.0f, 4.0f },
{ 1.0f, 0.0f, 1.0f }, { -2.0f, 0.0f, 5.0f }, { 2.0f, 0.0f, -5.0f },
{ 5.0f, 0.0f, 3.0f }, { -3.0f, 0.0f, -6.0f }, { -5.0f, 0.0f, -3.0f },
{ -1.0f, 0.0f, 5.0f }, { -2.0f, 0.0f, -6.0f }, { 2.0f, 0.0f, -2.0f },
{ 5.0f, 0.0f, 0.0f }, { -5.0f, 0.0f, -5.0f }, { 2.0f, 0.0f, 2.0f },
{ 5.0f, 0.0f, -4.0f }, { -6.0f, 0.0f, 2.0f }, { 5.0f, 0.0f, 1.0f },
{ 2.0f, 0.0f, 5.0f }, { -5.0f, 0.0f, -2.0f }, { 4.0f, 0.0f, -4.0f },
{ -6.0f, 0.0f, -1.0f }, { -4.0f, 0.0f, -3.0f }, { 1.0f, 0.0f, 3.0f },
{ 2.0f, 0.0f, 3.0f }, { 2.0f, 0.0f, 0.0f }, { -5.0f, 0.0f, 4.0f },
{ 4.0f, 0.0f, 4.0f }, { -3.0f, 0.0f, -3.0f }, { 4.0f, 0.0f, -6.0f },
{ 2.0f, 0.0f, 4.0f }, { -2.0f, 0.0f, 3.0f }, { 3.0f, 0.0f, -6.0f },
{ -4.0f, 0.0f, 3.0f }, { 0.0f, 0.0f, 0.0f }, { -4.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 2.0f }, { -2.0f, 0.0f, -3.0f }, { -6.0f, 0.0f, -4.0f },
{ -6.0f, 0.0f, 1.0f }, { -2.0f, 0.0f, -2.0f }, { 0.0f, 0.0f, -2.0f },
{ -5.0f, 0.0f, 3.0f }, { -4.0f, 0.0f, -6.0f }, { 5.0f, 0.0f, -2.0f },
{ 3.0f, 0.0f, -4.0f }, { -1.0f, 0.0f, -1.0f }, { 1.0f, 0.0f, -3.0f },
{ 1.0f, 0.0f, -5.0f }, { 0.0f, 0.0f, 4.0f }, { -1.0f, 0.0f, 1.0f },
{ 3.0f, 0.0f, 2.0f }, { -2.0f, 0.0f, -1.0f }, { -1.0f, 0.0f, -2.0f },
{ -3.0f, 0.0f, 2.0f }, { -4.0f, 0.0f, -1.0f }, { -4.0f, 0.0f, 2.0f },
{ -4.0f, 0.0f, -5.0f }, { -4.0f, 0.0f, -2.0f }, { -3.0f, 0.0f, 3.0f },
{ -6.0f, 0.0f, 5.0f }, { -1.0f, 0.0f, -5.0f }, { -3.0f, 0.0f, 1.0f },
{ -3.0f, 0.0f, -1.0f }, { -2.0f, 0.0f, 4.0f }, { 4.0f, 0.0f, 0.0f },
{ -1.0f, 0.0f, -3.0f }, { -1.0f, 0.0f, 3.0f }, { -3.0f, 0.0f, -2.0f },
{ -5.0f, 0.0f, 1.0f }, { 4.0f, 0.0f, 3.0f }, { 0.0f, 0.0f, -4.0f },
{ -3.0f, 0.0f, 4.0f }, { -1.0f, 0.0f, 4.0f }, { 0.0f, 0.0f, -6.0f },
{ 2.0f, 0.0f, -6.0f }, { -4.0f, 0.0f, 4.0f }, { -2.0f, 0.0f, -5.0f },
{ 1.0f, 0.0f, -6.0f }, { -1.0f, 0.0f, -6.0f }, { -6.0f, 0.0f, -6.0f },
{ -5.0f, 0.0f, 0.0f }, { -4.0f, 0.0f, 5.0f }, { 3.0f, 0.0f, 3.0f },
{ 3.0f, 0.0f, 0.0f }, { -2.0f, 0.0f, 0.0f }, { -4.0f, 0.0f, -4.0f },
{ -4.0f, 0.0f, 1.0f }, { 4.0f, 0.0f, 2.0f }, { 3.0f, 0.0f, -5.0f }
};
static readonly float[,] snowflake_floats = new float [144,3] {
{ 7.0f, 0.0f, -1.0f }, { 6.0f, 0.0f, -7.0f }, { 0.0f, 0.0f, 4.0f },
{ -5.0f, 0.0f, 7.0f }, { -7.0f, 0.0f, -1.0f }, { 7.0f, 0.0f, -6.0f },
{ 0.0f, 0.0f, -2.0f }, { 1.0f, -1.0f, -1.0f }, { 0.0f, -1.0f, -1.0f },
{ 0.0f, 0.0f, 6.0f }, { 5.0f, 0.0f, -5.0f }, { 6.0f, 0.0f, -6.0f },
{ 0.0f, 0.0f, 7.0f }, { -2.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 1.0f },
{ 1.0f, -1.0f, 0.0f }, { -7.0f, 0.0f, 6.0f }, { 3.0f, 0.0f, -3.0f },
{ -8.0f, 0.0f, -1.0f }, { -6.0f, 0.0f, -5.0f }, { 0.0f, 0.0f, 9.0f },
{ 0.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, -8.0f }, { 8.0f, 0.0f, 1.0f },
{ -7.0f, 0.0f, 7.0f }, { -5.0f, 0.0f, -5.0f }, { -5.0f, 0.0f, -6.0f },
{ 7.0f, 0.0f, 4.0f }, { 7.0f, 0.0f, 5.0f }, { 7.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, -6.0f }, { 0.0f, 0.0f, 1.0f }, { 7.0f, 0.0f, 7.0f },
{ -4.0f, 0.0f, -7.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, -2.0f, 0.0f },
{ -5.0f, 0.0f, -7.0f }, { 6.0f, 0.0f, 0.0f }, { 4.0f, 0.0f, 7.0f },
{ 0.0f, 2.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 6.0f, 0.0f, 5.0f },
{ 0.0f, 0.0f, 0.0f }, { 0.0f, -1.0f, 0.0f }, { 4.0f, 0.0f, -7.0f },
{ -6.0f, 0.0f, 7.0f }, { -5.0f, 0.0f, 0.0f }, { -5.0f, 0.0f, 5.0f },
{ -8.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 5.0f }, { -6.0f, 0.0f, 5.0f },
{ -1.0f, 1.0f, 1.0f }, { 7.0f, 0.0f, -2.0f }, { -7.0f, 0.0f, 4.0f },
{ 2.0f, 0.0f, 7.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 2.0f },
{ 4.0f, 0.0f, -4.0f }, { 0.0f, 0.0f, -4.0f }, { 2.0f, 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.0f }, { 6.0f, 0.0f, -5.0f }, { 1.0f, 0.0f, 8.0f },
{ 6.0f, 0.0f, 7.0f }, { 3.0f, 0.0f, 3.0f }, { -4.0f, 0.0f, -4.0f },
{ -6.0f, 0.0f, 0.0f }, { -4.0f, 0.0f, 7.0f }, { 7.0f, 0.0f, -4.0f },
{ 0.0f, 0.0f, 0.0f }, { 0.0f, -1.0f, 1.0f }, { -7.0f, 0.0f, 0.0f },
{ 5.0f, 0.0f, -6.0f }, { 6.0f, 0.0f, 6.0f }, { 5.0f, 0.0f, 7.0f },
{ 5.0f, 0.0f, 0.0f }, { 9.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 8.0f },
{ -2.0f, 0.0f, 7.0f }, { -1.0f, -1.0f, 1.0f }, { -7.0f, 0.0f, -7.0f },
{ -7.0f, 0.0f, -4.0f }, { -5.0f, 0.0f, 6.0f }, { 0.0f, 0.0f, -9.0f },
{ -1.0f, -1.0f, -1.0f }, { -3.0f, 0.0f, 3.0f }, { -7.0f, 0.0f, 5.0f },
{ 0.0f, 0.0f, -5.0f }, { 7.0f, 0.0f, -5.0f }, { -7.0f, 0.0f, -2.0f },
{ -1.0f, 0.0f, -7.0f }, { -7.0f, 0.0f, 2.0f }, { -1.0f, 0.0f, 8.0f },
{ -7.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, -7.0f }, { -2.0f, 0.0f, -7.0f },
{ 4.0f, 0.0f, 0.0f }, { -1.0f, 1.0f, -1.0f }, { 0.0f, 0.0f, 0.0f },
{ 4.0f, 0.0f, 4.0f }, { -1.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 1.0f },
{ -3.0f, 0.0f, -3.0f }, { 1.0f, 0.0f, -8.0f }, { 0.0f, 0.0f, -7.0f },
{ -7.0f, 0.0f, -6.0f }, { 5.0f, 0.0f, 6.0f }, { 0.0f, 0.0f, 0.0f },
{ 1.0f, 1.0f, -1.0f }, { 8.0f, 0.0f, -1.0f }, { -1.0f, 0.0f, 1.0f },
{ -9.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, -1.0f }, { 7.0f, 0.0f, 2.0f },
{ 8.0f, 0.0f, 0.0f }, { 2.0f, 0.0f, -7.0f }, { 7.0f, 0.0f, 1.0f },
{ -1.0f, 1.0f, 0.0f }, { 7.0f, 0.0f, -7.0f }, { 0.0f, 1.0f, 0.0f },
{ -4.0f, 0.0f, 4.0f }, { 0.0f, 1.0f, 1.0f }, { -4.0f, 0.0f, 0.0f },
{ 1.0f, 0.0f, 0.0f }, { -7.0f, 0.0f, -5.0f }, { -6.0f, 0.0f, 6.0f },
{ 0.0f, 0.0f, 0.0f }, { 5.0f, 0.0f, -7.0f }, { 5.0f, 0.0f, 5.0f },
{ -1.0f, 0.0f, 7.0f }, { 0.0f, 0.0f, -8.0f }, { 1.0f, 0.0f, 7.0f },
{ -1.0f, -1.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { -6.0f, 0.0f, -7.0f },
{ 0.0f, 1.0f, -1.0f }, { -8.0f, 0.0f, 0.0f }, { -1.0f, 0.0f, -1.0f },
{ 1.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, -1.0f }, { -6.0f, 0.0f, -6.0f },
{ 7.0f, 0.0f, 6.0f }, { 0.0f, 0.0f, 0.0f }, { 1.0f, -1.0f, 1.0f }
};
static readonly float[,] cross_plane_floats = new float [144,3] {
{ -1.2f, 0.0f, 1.2f }, { 0.0f, 2.4f, 2.4f }, { -4.8f, 0.0f, 1.2f },
{ 0.0f, 3.6f, 3.6f }, { 4.8f, 0.0f, -2.4f }, { 0.0f, -3.6f, 0.0f },
{ -4.8f, 0.0f, -3.6f }, { -2.4f, 0.0f, 3.6f }, { 0.0f, 3.6f, 4.8f },
{ -4.8f, 0.0f, -4.8f }, { 3.6f, 0.0f, 3.6f }, { 0.0f, -1.2f, 3.6f },
{ 0.0f, -4.8f, 0.0f }, { 3.6f, 0.0f, 4.8f }, { 3.6f, 0.0f, 1.2f },
{ 0.0f, 1.2f, -4.8f }, { 0.0f, -4.8f, 2.4f }, { -2.4f, 0.0f, -4.8f },
{ 1.2f, 0.0f, 3.6f }, { 0.0f, 3.6f, -1.2f }, { -1.2f, 0.0f, -4.8f },
{ 0.0f, 2.4f, -4.8f }, { -3.6f, 0.0f, 1.2f }, { 1.2f, 0.0f, 1.2f },
{ 0.0f, -3.6f, -4.8f }, { 0.0f, -3.6f, 4.8f }, { -4.8f, 0.0f, 0.0f },
{ 3.6f, 0.0f, 2.4f }, { 0.0f, 1.2f, 0.0f }, { 0.0f, 1.2f, -3.6f },
{ 0.0f, 1.2f, 4.8f }, { -3.6f, 0.0f, 4.8f }, { 0.0f, -2.4f, 1.2f },
{ 4.8f, 0.0f, 2.4f }, { 0.0f, 4.8f, -4.8f }, { 0.0f, -2.4f, -4.8f },
{ 0.0f, 3.6f, -3.6f }, { 1.2f, 0.0f, -1.2f }, { 4.8f, 0.0f, -3.6f },
{ -2.4f, 0.0f, 2.4f }, { 0.0f, 4.8f, -2.4f }, { 2.4f, 0.0f, -2.4f },
{ 0.0f, 3.6f, 1.2f }, { 1.2f, 0.0f, 2.4f }, { 4.8f, 0.0f, 4.8f },
{ 0.0f, -1.2f, 2.4f }, { 2.4f, 0.0f, 4.8f }, { 0.0f, -4.8f, -1.2f },
{ 2.4f, 0.0f, 0.0f }, { -3.6f, 0.0f, 0.0f }, { -3.6f, 0.0f, -2.4f },
{ -4.8f, 0.0f, 3.6f }, { 0.0f, 4.8f, -1.2f }, { -4.8f, 0.0f, 2.4f },
{ -3.6f, 0.0f, 3.6f }, { 0.0f, 4.8f, -3.6f }, { -1.2f, 0.0f, 4.8f },
{ -2.4f, 0.0f, -3.6f }, { 0.0f, 3.6f, 0.0f }, { 0.0f, -1.2f, 4.8f },
{ 0.0f, -1.2f, -1.2f }, { 4.8f, 0.0f, -4.8f }, { 0.0f, -2.4f, -3.6f },
{ 4.8f, 0.0f, -1.2f }, { 0.0f, 2.4f, 0.0f }, { 0.0f, -4.8f, -2.4f },
{ 2.4f, 0.0f, 2.4f }, { 0.0f, 3.6f, -4.8f }, { 0.0f, 3.6f, -2.4f },
{ 0.0f, -2.4f, 2.4f }, { 2.4f, 0.0f, -4.8f }, { -2.4f, 0.0f, -1.2f },
{ 0.0f, -1.2f, 1.2f }, { -3.6f, 0.0f, 2.4f }, { 0.0f, -3.6f, -2.4f },
{ 0.0f, -2.4f, 0.0f }, { -2.4f, 0.0f, -2.4f }, { 3.6f, 0.0f, -2.4f },
{ 0.0f, 2.4f, 4.8f }, { 1.2f, 0.0f, -4.8f }, { 0.0f, 1.2f, 2.4f },
{ 0.0f, -4.8f, 1.2f }, { 0.0f, 2.4f, 3.6f }, { 4.8f, 0.0f, 0.0f },
{ 0.0f, -1.2f, 0.0f }, { 0.0f, -4.8f, 4.8f }, { -1.2f, 0.0f, 0.0f },
{ 0.0f, -1.2f, -3.6f }, { 3.6f, 0.0f, -1.2f }, { 1.2f, 0.0f, 0.0f },
{ -1.2f, 0.0f, -1.2f }, { 3.6f, 0.0f, -3.6f }, { 0.0f, 4.8f, 1.2f },
{ -1.2f, 0.0f, 3.6f }, { -3.6f, 0.0f, -3.6f }, { -1.2f, 0.0f, 2.4f },
{ 0.0f, -2.4f, 4.8f }, { 0.0f, 4.8f, 2.4f }, { 0.0f, -3.6f, -3.6f },
{ 0.0f, 2.4f, 1.2f }, { 0.0f, -2.4f, -2.4f }, { -4.8f, 0.0f, 4.8f },
{ -4.8f, 0.0f, -1.2f }, { 0.0f, -1.2f, -4.8f }, { -2.4f, 0.0f, 0.0f },
{ 4.8f, 0.0f, 3.6f }, { 0.0f, 4.8f, 0.0f }, { 0.0f, 2.4f, -3.6f },
{ -1.2f, 0.0f, -2.4f }, { 0.0f, -4.8f, -4.8f }, { -2.4f, 0.0f, 4.8f },
{ 2.4f, 0.0f, 3.6f }, { 0.0f, -3.6f, -1.2f }, { 2.4f, 0.0f, -3.6f },
{ 0.0f, 1.2f, -2.4f }, { 2.4f, 0.0f, 1.2f }, { 0.0f, 3.6f, 2.4f },
{ 1.2f, 0.0f, -2.4f }, { 1.2f, 0.0f, -3.6f }, { 0.0f, 1.2f, 1.2f },
{ -2.4f, 0.0f, 1.2f }, { -1.2f, 0.0f, -3.6f }, { -3.6f, 0.0f, -4.8f },
{ 1.2f, 0.0f, 4.8f }, { 3.6f, 0.0f, 0.0f }, { 0.0f, 2.4f, -2.4f },
{ 0.0f, -1.2f, -2.4f }, { 0.0f, 1.2f, 3.6f }, { -4.8f, 0.0f, -2.4f },
{ 0.0f, -2.4f, -1.2f }, { 0.0f, -3.6f, 1.2f }, { 0.0f, 4.8f, 4.8f },
{ 0.0f, -4.8f, 3.6f }, { 0.0f, 2.4f, -1.2f }, { 0.0f, 1.2f, -1.2f },
{ 0.0f, -2.4f, 3.6f }, { 3.6f, 0.0f, -4.8f }, { -3.6f, 0.0f, -1.2f },
{ 0.0f, -3.6f, 3.6f }, { 0.0f, -4.8f, -3.6f }, { 4.8f, 0.0f, 1.2f },
{ 0.0f, -3.6f, 2.4f }, { 0.0f, 4.8f, 3.6f }, { 2.4f, 0.0f, -1.2f }
};
static readonly float[,] tunnel_floats = new float [144,3] {
{ 0.0f, -2.4f, -3.6f }, { -1.2f, 2.4f, -4.8f }, { -2.4f, 1.2f, -2.4f },
{ 2.4f, -1.2f, 4.8f }, { -2.4f, -1.2f, -3.6f }, { -2.4f, -2.4f, 0.0f },
{ 2.4f, -2.4f, -3.6f }, { -1.2f, -2.4f, -3.6f }, { 0.0f, -2.4f, 1.2f },
{ 2.4f, 0.0f, 3.6f }, { -2.4f, 2.4f, 4.8f }, { 0.0f, 2.4f, 1.2f },
{ 2.4f, 2.4f, 2.4f }, { -2.4f, -1.2f, 2.4f }, { -2.4f, 1.2f, 4.8f },
{ 1.2f, -2.4f, 1.2f }, { 2.4f, -1.2f, -4.8f }, { 0.0f, 2.4f, -2.4f },
{ 0.0f, -2.4f, -1.2f }, { -1.2f, 2.4f, 2.4f }, { 1.2f, 2.4f, 0.0f },
{ -2.4f, 2.4f, 2.4f }, { 2.4f, -1.2f, -3.6f }, { 2.4f, 2.4f, -2.4f },
{ 2.4f, -2.4f, 3.6f }, { 2.4f, 1.2f, -2.4f }, { 2.4f, 1.2f, -3.6f },
{ 1.2f, 2.4f, 2.4f }, { 1.2f, 2.4f, -3.6f }, { 2.4f, 2.4f, -3.6f },
{ -1.2f, -2.4f, 1.2f }, { 0.0f, -2.4f, 4.8f }, { -2.4f, -1.2f, -1.2f },
{ 0.0f, 2.4f, 2.4f }, { -2.4f, -2.4f, 4.8f }, { -2.4f, 0.0f, -2.4f },
{ -2.4f, 1.2f, -3.6f }, { -2.4f, 0.0f, -1.2f }, { 2.4f, -2.4f, -1.2f },
{ -1.2f, 2.4f, -1.2f }, { -2.4f, 1.2f, 3.6f }, { -2.4f, 1.2f, -4.8f },
{ -2.4f, 1.2f, -1.2f }, { 2.4f, 0.0f, -4.8f }, { -2.4f, -2.4f, 2.4f },
{ -1.2f, -2.4f, -1.2f }, { -2.4f, 2.4f, -1.2f }, { 2.4f, 0.0f, 1.2f },
{ -2.4f, -2.4f, 3.6f }, { 2.4f, 1.2f, 0.0f }, { -2.4f, -1.2f, 1.2f },
{ 2.4f, -2.4f, 1.2f }, { -1.2f, 2.4f, -2.4f }, { -2.4f, 0.0f, 4.8f },
{ 2.4f, 0.0f, 0.0f }, { 2.4f, -1.2f, 1.2f }, { -2.4f, 0.0f, -3.6f },
{ -2.4f, -2.4f, -4.8f }, { -2.4f, 0.0f, -4.8f }, { 2.4f, 2.4f, 0.0f },
{ -2.4f, 2.4f, -2.4f }, { -2.4f, -1.2f, -4.8f }, { 1.2f, -2.4f, 3.6f },
{ -2.4f, 1.2f, 1.2f }, { 2.4f, -2.4f, -4.8f }, { 0.0f, -2.4f, 0.0f },
{ 2.4f, 0.0f, -2.4f }, { -2.4f, -1.2f, -2.4f }, { -2.4f, -2.4f, 1.2f },
{ 2.4f, -2.4f, 4.8f }, { -1.2f, -2.4f, 4.8f }, { 2.4f, -2.4f, -2.4f },
{ 1.2f, -2.4f, -1.2f }, { -1.2f, 2.4f, 3.6f }, { -2.4f, 2.4f, -4.8f },
{ -1.2f, 2.4f, 4.8f }, { 1.2f, -2.4f, 4.8f }, { 1.2f, 2.4f, -4.8f },
{ 2.4f, 0.0f, -1.2f }, { 2.4f, -2.4f, 0.0f }, { 2.4f, 1.2f, 4.8f },
{ -2.4f, 0.0f, 0.0f }, { -2.4f, -2.4f, -3.6f }, { 2.4f, 2.4f, -1.2f },
{ 0.0f, 2.4f, 4.8f }, { -1.2f, 2.4f, -3.6f }, { -1.2f, 2.4f, 0.0f },
{ 2.4f, 2.4f, -4.8f }, { 0.0f, -2.4f, -4.8f }, { 2.4f, 1.2f, 2.4f },
{ -2.4f, 0.0f, 1.2f }, { 2.4f, 0.0f, -3.6f }, { -2.4f, -2.4f, -1.2f },
{ 2.4f, -1.2f, 3.6f }, { 1.2f, 2.4f, 3.6f }, { -2.4f, 2.4f, 1.2f },
{ -1.2f, -2.4f, 2.4f }, { -2.4f, 0.0f, 3.6f }, { -2.4f, -1.2f, 4.8f },
{ 2.4f, -1.2f, 2.4f }, { 2.4f, -1.2f, -2.4f }, { 0.0f, -2.4f, 3.6f },
{ 2.4f, -2.4f, 2.4f }, { -2.4f, -1.2f, 3.6f }, { -2.4f, 1.2f, 2.4f },
{ -2.4f, 2.4f, 0.0f }, { -2.4f, -1.2f, 0.0f }, { 0.0f, -2.4f, -2.4f },
{ 1.2f, 2.4f, 4.8f }, { -1.2f, -2.4f, -2.4f }, { 2.4f, 1.2f, -4.8f },
{ 1.2f, 2.4f, 1.2f }, { 2.4f, 2.4f, 1.2f }, { 2.4f, 1.2f, -1.2f },
{ -2.4f, 0.0f, 2.4f }, { 0.0f, -2.4f, 2.4f }, { 2.4f, 0.0f, 2.4f },
{ 1.2f, 2.4f, -2.4f }, { 0.0f, 2.4f, -4.8f }, { 0.0f, 2.4f, 3.6f },
{ 0.0f, 2.4f, -3.6f }, { 1.2f, 2.4f, -1.2f }, { 2.4f, 0.0f, 4.8f },
{ -1.2f, -2.4f, 3.6f }, { 2.4f, -1.2f, 0.0f }, { -2.4f, 1.2f, 0.0f },
{ 1.2f, -2.4f, -3.6f }, { -1.2f, -2.4f, -4.8f }, { 0.0f, 2.4f, -1.2f },
{ -2.4f, -2.4f, -2.4f }, { 2.4f, 1.2f, 3.6f }, { 2.4f, -1.2f, -1.2f },
{ 1.2f, -2.4f, 2.4f }, { -2.4f, 2.4f, -3.6f }, { 0.0f, 2.4f, 0.0f },
{ -2.4f, 2.4f, 3.6f }, { 1.2f, -2.4f, -4.8f }, { 1.2f, -2.4f, -2.4f },
{ -1.2f, -2.4f, 0.0f }, { 1.2f, -2.4f, 0.0f }, { 2.4f, 2.4f, 4.8f },
{ -1.2f, 2.4f, 1.2f }, { 2.4f, 1.2f, 1.2f }, { 2.4f, 2.4f, 3.6f }
};
static readonly float[,] hollow_cube_floats = new float [144,3] {
{ -6.0f, -6.0f, -3.0f }, { 2.0f, -6.0f, 6.0f }, { -3.0f, -6.0f, 6.0f },
{ 6.0f, 2.0f, 6.0f }, { 6.0f, -5.0f, 6.0f }, { 2.0f, 6.0f, -6.0f },
{ -6.0f, 6.0f, 4.0f }, { -6.0f, -2.0f, 6.0f }, { -6.0f, 6.0f, 2.0f },
{ 6.0f, -6.0f, -5.0f }, { 6.0f, 6.0f, 0.0f }, { -6.0f, -1.0f, 6.0f },
{ 4.0f, 6.0f, -6.0f }, { 6.0f, -6.0f, -3.0f }, { 1.0f, 6.0f, 6.0f },
{ 6.0f, 0.0f, 6.0f }, { 6.0f, -6.0f, 5.0f }, { -2.0f, -6.0f, -6.0f },
{ 6.0f, 5.0f, 6.0f }, { 1.0f, -6.0f, 6.0f }, { 6.0f, -6.0f, -1.0f },
{ 6.0f, 1.0f, -6.0f }, { -6.0f, 0.0f, -6.0f }, { 6.0f, -6.0f, -6.0f },
{ 6.0f, -6.0f, 3.0f }, { 5.0f, -6.0f, -6.0f }, { 1.0f, 6.0f, -6.0f },
{ -6.0f, 6.0f, -2.0f }, { 0.0f, 6.0f, -6.0f }, { 6.0f, -6.0f, 4.0f },
{ 5.0f, 6.0f, -6.0f }, { -6.0f, -5.0f, -6.0f }, { 4.0f, -6.0f, -6.0f },
{ -5.0f, -6.0f, -6.0f }, { 2.0f, -6.0f, -6.0f }, { 5.0f, 6.0f, 6.0f },
{ -6.0f, -1.0f, -6.0f }, { -6.0f, -6.0f, -6.0f }, { 6.0f, 6.0f, -6.0f },
{ 0.0f, -6.0f, -6.0f }, { 6.0f, 1.0f, 6.0f }, { -6.0f, 6.0f, 5.0f },
{ 6.0f, 6.0f, 2.0f }, { -6.0f, 5.0f, 6.0f }, { 6.0f, -1.0f, 6.0f },
{ 3.0f, 6.0f, 6.0f }, { -6.0f, -6.0f, -1.0f }, { 6.0f, 0.0f, -6.0f },
{ -3.0f, -6.0f, -6.0f }, { -6.0f, 6.0f, 1.0f }, { -6.0f, 3.0f, -6.0f },
{ 2.0f, 6.0f, 6.0f }, { -4.0f, 6.0f, -6.0f }, { 6.0f, -6.0f, 6.0f },
{ -6.0f, -6.0f, 2.0f }, { -2.0f, -6.0f, 6.0f }, { -6.0f, -6.0f, 1.0f },
{ 6.0f, 4.0f, 6.0f }, { 6.0f, 6.0f, 4.0f }, { 6.0f, 6.0f, 5.0f },
{ 0.0f, 0.0f, 0.0f }, { 3.0f, 6.0f, -6.0f }, { -6.0f, 4.0f, -6.0f },
{ 6.0f, -6.0f, -2.0f }, { 6.0f, 6.0f, -2.0f }, { -1.0f, 6.0f, -6.0f },
{ -6.0f, -6.0f, -5.0f }, { -2.0f, 6.0f, 6.0f }, { -6.0f, -6.0f, 5.0f },
{ -6.0f, 5.0f, -6.0f }, { 6.0f, -5.0f, -6.0f }, { 6.0f, -4.0f, 6.0f },
{ 6.0f, -1.0f, -6.0f }, { 4.0f, 6.0f, 6.0f }, { -4.0f, -6.0f, -6.0f },
{ 6.0f, -2.0f, -6.0f }, { -6.0f, -4.0f, -6.0f }, { -6.0f, -6.0f, 4.0f },
{ 6.0f, -4.0f, -6.0f }, { -5.0f, 6.0f, 6.0f }, { -2.0f, 6.0f, -6.0f },
{ 6.0f, 6.0f, -5.0f }, { 6.0f, 6.0f, -3.0f }, { -6.0f, -6.0f, -2.0f },
{ 3.0f, -6.0f, 6.0f }, { 6.0f, 6.0f, -4.0f }, { -6.0f, 4.0f, 6.0f },
{ -6.0f, 6.0f, -5.0f }, { -1.0f, -6.0f, 6.0f }, { 6.0f, -6.0f, 0.0f },
{ 6.0f, -6.0f, -4.0f }, { 6.0f, 6.0f, 3.0f }, { -1.0f, -6.0f, -6.0f },
{ 6.0f, 3.0f, -6.0f }, { -6.0f, 6.0f, 0.0f }, { -6.0f, 6.0f, -3.0f },
{ -6.0f, -3.0f, -6.0f }, { -6.0f, 6.0f, -6.0f }, { 0.0f, 0.0f, 0.0f },
{ -5.0f, 6.0f, -6.0f }, { -6.0f, 1.0f, -6.0f }, { 6.0f, 5.0f, -6.0f },
{ -6.0f, -6.0f, -4.0f }, { -6.0f, -6.0f, 3.0f }, { -6.0f, 3.0f, 6.0f },
{ 0.0f, 0.0f, 0.0f }, { 0.0f, 6.0f, 6.0f }, { 1.0f, -6.0f, -6.0f },
{ -5.0f, -6.0f, 6.0f }, { -6.0f, -4.0f, 6.0f }, { 6.0f, 3.0f, 6.0f },
{ -6.0f, 2.0f, -6.0f }, { -3.0f, 6.0f, -6.0f }, { 6.0f, 2.0f, -6.0f },
{ -6.0f, 6.0f, -4.0f }, { -6.0f, 6.0f, 6.0f }, { 6.0f, -2.0f, 6.0f },
{ -4.0f, 6.0f, 6.0f }, { 6.0f, 6.0f, -1.0f }, { -6.0f, 6.0f, -1.0f },
{ -6.0f, -2.0f, -6.0f }, { -6.0f, -6.0f, 0.0f }, { -6.0f, -5.0f, 6.0f },
{ -6.0f, 6.0f, 3.0f }, { 6.0f, 6.0f, 1.0f }, { -6.0f, -6.0f, 6.0f },
{ -6.0f, 1.0f, 6.0f }, { 6.0f, -3.0f, -6.0f }, { -6.0f, 2.0f, 6.0f },
{ 6.0f, -6.0f, 1.0f }, { 6.0f, -6.0f, 2.0f }, { 3.0f, -6.0f, -6.0f },
{ -4.0f, -6.0f, 6.0f }, { 6.0f, 4.0f, -6.0f }, { -1.0f, 6.0f, 6.0f },
{ 6.0f, -3.0f, 6.0f }, { -6.0f, 0.0f, 6.0f }, { -6.0f, -3.0f, 6.0f },
{ 6.0f, 6.0f, 6.0f }, { 5.0f, -6.0f, 6.0f }, { 4.0f, -6.0f, 6.0f },
{ 0.0f, -6.0f, 6.0f }, { -3.0f, 6.0f, 6.0f }, { 0.0f, 0.0f, 0.0f }
};
static readonly float[,] dice_floats = new float [144,3] {
{ -5.0f, -4.0f, -5.0f }, { 5.0f, -5.0f, -5.0f }, { 0.0f, 0.0f, 5.0f },
{ 3.0f, -5.0f, 5.0f }, { -5.0f, -5.0f, -2.0f }, { -2.0f, 0.0f, -5.0f },
{ 2.0f, -5.0f, 5.0f }, { -4.0f, -5.0f, 5.0f }, { 5.0f, 5.0f, -3.0f },
{ 5.0f, -5.0f, 4.0f }, { 5.0f, -5.0f, 5.0f }, { 5.0f, 0.0f, 0.0f },
{ -5.0f, -5.0f, 5.0f }, { -5.0f, 1.0f, -5.0f }, { -5.0f, -3.0f, 5.0f },
{ 5.0f, -2.0f, -5.0f }, { -2.0f, 2.0f, -5.0f }, { 5.0f, -5.0f, 2.0f },
{ 2.0f, -2.0f, -5.0f }, { 5.0f, 5.0f, 2.0f }, { 5.0f, 0.0f, 5.0f },
{ 5.0f, 5.0f, 0.0f }, { 3.0f, 5.0f, -5.0f }, { -1.0f, -5.0f, -5.0f },
{ 5.0f, -4.0f, 5.0f }, { 5.0f, 3.0f, -5.0f }, { -5.0f, -5.0f, -5.0f },
{ -5.0f, 5.0f, 3.0f }, { 2.0f, -5.0f, -2.0f }, { -5.0f, -5.0f, -3.0f },
{ 5.0f, -3.0f, -5.0f }, { -5.0f, -5.0f, 1.0f }, { -5.0f, -1.0f, 5.0f },
{ -5.0f, 5.0f, 1.0f }, { -5.0f, 2.0f, -5.0f }, { 2.0f, 2.0f, -5.0f },
{ 4.0f, -5.0f, 5.0f }, { -5.0f, 0.0f, 5.0f }, { -5.0f, 5.0f, -5.0f },
{ 0.0f, 0.0f, 5.0f }, { 5.0f, 4.0f, -5.0f }, { -3.0f, -5.0f, -5.0f },
{ 0.0f, 5.0f, 0.0f }, { 2.0f, 0.0f, -5.0f }, { -5.0f, 5.0f, -2.0f },
{ 0.0f, 0.0f, 5.0f }, { -5.0f, 3.0f, 5.0f }, { 2.0f, 5.0f, 5.0f },
{ -3.0f, 5.0f, 5.0f }, { -2.0f, 5.0f, 5.0f }, { 5.0f, -2.0f, 5.0f },
{ 1.0f, -5.0f, -5.0f }, { 5.0f, 4.0f, 5.0f }, { 3.0f, 5.0f, 5.0f },
{ 4.0f, -5.0f, -5.0f }, { 5.0f, 5.0f, 3.0f }, { 5.0f, -5.0f, 1.0f },
{ -5.0f, 5.0f, 0.0f }, { -4.0f, 5.0f, -5.0f }, { 0.0f, 5.0f, -5.0f },
{ 5.0f, -3.0f, 5.0f }, { 2.0f, 5.0f, -5.0f }, { -5.0f, 0.0f, -5.0f },
{ -1.0f, 5.0f, 5.0f }, { 5.0f, 2.0f, -5.0f }, { -5.0f, 5.0f, 2.0f },
{ 1.0f, 5.0f, 5.0f }, { -5.0f, -4.0f, 5.0f }, { -5.0f, 3.0f, -5.0f },
{ -3.0f, 5.0f, -5.0f }, { 2.0f, 5.0f, 2.0f }, { -5.0f, 2.0f, 2.0f },
{ -5.0f, 4.0f, -5.0f }, { 5.0f, -5.0f, -3.0f }, { 2.0f, -5.0f, -5.0f },
{ -5.0f, -5.0f, 0.0f }, { 5.0f, -1.0f, -5.0f }, { 0.0f, 0.0f, 5.0f },
{ 0.0f, 0.0f, 5.0f }, { -2.0f, -5.0f, 5.0f }, { -1.0f, -5.0f, 5.0f },
{ 5.0f, 5.0f, -2.0f }, { 5.0f, -5.0f, 0.0f }, { 0.0f, -5.0f, 5.0f },
{ -2.0f, -2.0f, -5.0f }, { 5.0f, -5.0f, 3.0f }, { 4.0f, 5.0f, 5.0f },
{ -5.0f, 5.0f, -3.0f }, { -2.0f, -5.0f, -5.0f }, { 1.0f, -5.0f, 5.0f },
{ -5.0f, -1.0f, -5.0f }, { -1.0f, 5.0f, -5.0f }, { 0.0f, 5.0f, 5.0f },
{ 5.0f, 5.0f, 5.0f }, { -5.0f, -5.0f, 3.0f }, { -2.0f, 5.0f, -2.0f },
{ 5.0f, 5.0f, -1.0f }, { -5.0f, -2.0f, -2.0f }, { 5.0f, -5.0f, -1.0f },
{ -5.0f, -5.0f, 2.0f }, { 4.0f, 5.0f, -5.0f }, { 0.0f, -5.0f, -5.0f },
{ -5.0f, -2.0f, 2.0f }, { -3.0f, -5.0f, 5.0f }, { 0.0f, 0.0f, 5.0f },
{ -2.0f, 5.0f, -5.0f }, { -5.0f, 5.0f, 4.0f }, { 5.0f, 3.0f, 5.0f },
{ -2.0f, -5.0f, 2.0f }, { -5.0f, -2.0f, -5.0f }, { 5.0f, -4.0f, -5.0f },
{ -4.0f, 5.0f, 5.0f }, { 5.0f, 1.0f, 5.0f }, { 5.0f, 2.0f, 5.0f },
{ 5.0f, 5.0f, -4.0f }, { 5.0f, 5.0f, 4.0f }, { -5.0f, 2.0f, 5.0f },
{ 5.0f, 5.0f, 1.0f }, { 2.0f, 5.0f, -2.0f }, { -5.0f, -5.0f, -1.0f },
{ -5.0f, -5.0f, 4.0f }, { -5.0f, -5.0f, -4.0f }, { 5.0f, -1.0f, 5.0f },
{ 5.0f, 0.0f, -5.0f }, { 5.0f, 5.0f, -5.0f }, { -4.0f, -5.0f, -5.0f },
{ -2.0f, 5.0f, 2.0f }, { -5.0f, -3.0f, -5.0f }, { -5.0f, 2.0f, -2.0f },
{ -5.0f, -2.0f, 5.0f }, { 1.0f, 5.0f, -5.0f }, { 5.0f, -5.0f, -4.0f },
{ -5.0f, 4.0f, 5.0f }, { -5.0f, 5.0f, -4.0f }, { 5.0f, -2.0f, -2.0f },
{ 3.0f, -5.0f, -5.0f }, { 0.0f, 0.0f, 5.0f }, { -5.0f, 1.0f, 5.0f },
{ 0.0f, 0.0f, 5.0f }, { -5.0f, 5.0f, 5.0f }, { 5.0f, -5.0f, -2.0f },
{ 5.0f, 2.0f, 2.0f }, { -5.0f, 5.0f, -1.0f }, { 5.0f, 1.0f, -5.0f }
};
static readonly float[,] nested_floats = new float [144,3] {
{ -2.4f, -4.8f, 4.8f }, { -2.4f, 2.4f, 0.0f }, { -1.2f, 4.8f, 4.8f },
{ 4.8f, 4.8f, -4.8f }, { 2.4f, -2.4f, 2.4f }, { 4.8f, 4.8f, 4.8f },
{ 4.8f, -3.6f, -4.8f }, { 0.0f, 2.4f, 2.4f }, { 3.6f, 4.8f, 4.8f },
{ 4.8f, 4.8f, 3.6f }, { 1.2f, 4.8f, 4.8f }, { 1.2f, 2.4f, -2.4f },
{ -4.8f, 2.4f, 4.8f }, { 2.4f, 2.4f, -1.2f }, { -4.8f, 4.8f, -3.6f },
{ 4.8f, -4.8f, -1.2f }, { 4.8f, -4.8f, -3.6f }, { -4.8f, -3.6f, -4.8f },
{ 4.8f, -2.4f, 4.8f }, { -3.6f, 3.6f, -3.6f }, { -3.6f, -3.6f, -3.6f },
{ 2.4f, 1.2f, 2.4f }, { 2.4f, -2.4f, -2.4f }, { 3.6f, 4.8f, -4.8f },
{ 2.4f, -1.2f, 2.4f }, { -1.2f, 2.4f, 2.4f }, { -4.8f, 0.0f, -4.8f },
{ -4.8f, 1.2f, 4.8f }, { 3.6f, -3.6f, 3.6f }, { -4.8f, -4.8f, 2.4f },
{ -4.8f, -3.6f, 4.8f }, { -4.8f, -1.2f, 4.8f }, { 2.4f, 2.4f, 0.0f },
{ 4.8f, 2.4f, -4.8f }, { 2.4f, 0.0f, -2.4f }, { -4.8f, -2.4f, 4.8f },
{ 2.4f, 2.4f, -2.4f }, { 1.2f, -2.4f, 2.4f }, { -4.8f, 4.8f, 2.4f },
{ -3.6f, -4.8f, 4.8f }, { 4.8f, -3.6f, 4.8f }, { 4.8f, 3.6f, 4.8f },
{ -4.8f, -4.8f, 1.2f }, { 4.8f, 1.2f, 4.8f }, { 1.2f, -4.8f, -4.8f },
{ 0.0f, 4.8f, 4.8f }, { -4.8f, -4.8f, -2.4f }, { 2.4f, -1.2f, -2.4f },
{ -4.8f, -4.8f, -1.2f }, { -3.6f, 4.8f, -4.8f }, { 0.0f, -4.8f, -4.8f },
{ 3.6f, -4.8f, -4.8f }, { 2.4f, 0.0f, 2.4f }, { 0.0f, 4.8f, -4.8f },
{ 2.4f, -4.8f, 4.8f }, { -4.8f, -4.8f, 3.6f }, { 4.8f, 3.6f, -4.8f },
{ -2.4f, -2.4f, 1.2f }, { 3.6f, 3.6f, -3.6f }, { -2.4f, 0.0f, 2.4f },
{ 2.4f, 2.4f, 2.4f }, { -3.6f, 4.8f, 4.8f }, { -4.8f, 4.8f, -1.2f },
{ -1.2f, 4.8f, -4.8f }, { -2.4f, 0.0f, -2.4f }, { 4.8f, 0.0f, -4.8f },
{ 4.8f, 4.8f, 0.0f }, { -2.4f, 2.4f, 1.2f }, { -4.8f, 1.2f, -4.8f },
{ 4.8f, 4.8f, 1.2f }, { 3.6f, -4.8f, 4.8f }, { 4.8f, -1.2f, -4.8f },
{ -2.4f, -1.2f, 2.4f }, { 0.0f, -4.8f, 4.8f }, { 1.2f, 2.4f, 2.4f },
{ 4.8f, -4.8f, 3.6f }, { -1.2f, -2.4f, -2.4f }, { 2.4f, -2.4f, -1.2f },
{ -4.8f, 0.0f, 4.8f }, { -4.8f, -4.8f, 0.0f }, { 4.8f, 4.8f, -2.4f },
{ -3.6f, -3.6f, 3.6f }, { 4.8f, -4.8f, 0.0f }, { -4.8f, -4.8f, -3.6f },
{ 2.4f, 4.8f, 4.8f }, { -2.4f, 2.4f, 2.4f }, { 3.6f, -3.6f, -3.6f },
{ -2.4f, -2.4f, 2.4f }, { 4.8f, -4.8f, 2.4f }, { -4.8f, 2.4f, -4.8f },
{ 0.0f, -2.4f, 2.4f }, { 0.0f, -2.4f, -2.4f }, { 1.2f, -4.8f, 4.8f },
{ -3.6f, -4.8f, -4.8f }, { -2.4f, 4.8f, -4.8f }, { -4.8f, 4.8f, -2.4f },
{ -2.4f, 2.4f, -2.4f }, { 2.4f, 4.8f, -4.8f }, { -4.8f, 3.6f, -4.8f },
{ -1.2f, -4.8f, 4.8f }, { 4.8f, -2.4f, -4.8f }, { -2.4f, -2.4f, 0.0f },
{ -4.8f, 4.8f, 4.8f }, { 1.2f, -2.4f, -2.4f }, { -2.4f, 2.4f, -1.2f },
{ -1.2f, 2.4f, -2.4f }, { 2.4f, 1.2f, -2.4f }, { 4.8f, 4.8f, -3.6f },
{ 4.8f, 2.4f, 4.8f }, { -4.8f, 4.8f, 3.6f }, { -4.8f, -4.8f, -4.8f },
{ 2.4f, -2.4f, 1.2f }, { 4.8f, 4.8f, -1.2f }, { -2.4f, -1.2f, -2.4f },
{ 2.4f, -2.4f, 0.0f }, { -4.8f, 4.8f, -4.8f }, { 2.4f, 2.4f, 1.2f },
{ -2.4f, -2.4f, -1.2f }, { -4.8f, -2.4f, -4.8f }, { 2.4f, -4.8f, -4.8f },
{ -4.8f, -4.8f, 4.8f }, { -1.2f, -2.4f, 2.4f }, { 4.8f, -4.8f, -2.4f },
{ 4.8f, -4.8f, -4.8f }, { -4.8f, -1.2f, -4.8f }, { -4.8f, 4.8f, 0.0f },
{ 4.8f, 0.0f, 4.8f }, { -4.8f, 3.6f, 4.8f }, { -2.4f, -4.8f, -4.8f },
{ 4.8f, -4.8f, 1.2f }, { 4.8f, 1.2f, -4.8f }, { 0.0f, 2.4f, -2.4f },
{ -2.4f, 1.2f, 2.4f }, { 1.2f, 4.8f, -4.8f }, { -2.4f, 1.2f, -2.4f },
{ -2.4f, -2.4f, -2.4f }, { 4.8f, -1.2f, 4.8f }, { -1.2f, -4.8f, -4.8f },
{ 4.8f, -4.8f, 4.8f }, { -2.4f, 4.8f, 4.8f }, { -3.6f, 3.6f, 3.6f },
{ 3.6f, 3.6f, 3.6f }, { -4.8f, 4.8f, 1.2f }, { 4.8f, 4.8f, 2.4f }
};
}
}

415
DemoLib/VectorCubesScene.cs Normal file
Просмотреть файл

@ -0,0 +1,415 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using DemoLib;
using Tao.OpenGl;
using Tao.FreeGlut;
namespace DemoLib {
public partial class VectorCubesScene : Scene {
enum State {
FlatPlaneFormation = 0,
SnowflakeFormation = 2,
CrossPlaneFormation = 4,
TunnelFormation = 6,
HollowFormation = 8,
DiceFormation = 10,
NestedFormation = 12,
Complete
}
struct vector_t {
public float x;
public float y;
public float z;
}
struct camera_t {
public vector_t pos;
public vector_t rot;
}
static Vector[][] formations = null;
camera_t camera;
Vector[] cubes;
State state;
int cubeId;
int nFrames;
int start;
bool lighting;
public VectorCubesScene () : this (false) {
}
public VectorCubesScene (bool enableLighting) : base () {
int i;
lighting = enableLighting;
if (formations == null) {
//float[][,] floats = new float[7][,];
//floats[0] = flat_plane_floats;
//floats[1] = snowflake_floats;
//floats[2] = cross_plane_floats;
//floats[3] = tunnel_floats;
//floats[4] = hollow_cube_floats;
//floats[5] = dice_floats;
//floats[6] = nested_floats;
//
//formations = new Vector [7][];
//
//for (i = 0; i < 7; i++) {
// formations[i] = new Vector [144];
// for (int j = 0; i < 144; i++) {
// float x = floats[i][j, 0];
// float y = floats[i][j, 1];
// float z = floats[i][j, 2];
//
// formations[i][j] = new Vector (x, y, z);
// }
//}
float x, y, z;
formations = new Vector [7][];
for (i = 0; i < 7; i++)
formations[i] = new Vector [144];
// flat plane formation
for (i = 0; i < 144; i++) {
x = flat_plane_floats[i, 0];
y = flat_plane_floats[i, 1];
z = flat_plane_floats[i, 2];
formations[0][i] = new Vector (x, y, z);
}
// snowflake formation
for (i = 0; i < 144; i++) {
x = snowflake_floats[i, 0];
y = snowflake_floats[i, 1];
z = snowflake_floats[i, 2];
formations[1][i] = new Vector (x, y, z);
}
// cross-plane formation
for (i = 0; i < 144; i++) {
x = cross_plane_floats[i, 0];
y = cross_plane_floats[i, 1];
z = cross_plane_floats[i, 2];
formations[2][i] = new Vector (x, y, z);
}
// tunnel formation
for (i = 0; i < 144; i++) {
x = tunnel_floats[i, 0];
y = tunnel_floats[i, 1];
z = tunnel_floats[i, 2];
formations[3][i] = new Vector (x, y, z);
}
// hollow cube formation
for (i = 0; i < 144; i++) {
x = hollow_cube_floats[i, 0];
y = hollow_cube_floats[i, 1];
z = hollow_cube_floats[i, 2];
formations[4][i] = new Vector (x, y, z);
}
// dice formation
for (i = 0; i < 144; i++) {
x = dice_floats[i, 0];
y = dice_floats[i, 1];
z = dice_floats[i, 2];
formations[5][i] = new Vector (x, y, z);
}
// nested cubes formation
for (i = 0; i < 144; i++) {
x = nested_floats[i, 0];
y = nested_floats[i, 1];
z = nested_floats[i, 2];
formations[6][i] = new Vector (x, y, z);
}
}
cubes = new Vector [144];
for (i = 0; i < 144; i++)
cubes[i] = new Vector ();
}
static int GetCubeId () {
byte[] light = new byte[3] { 135, 206, 255 };
byte[] dark = new byte[3] { 108, 166, 205 };
int id;
id = Gl.glGenLists (1);
Gl.glNewList (id, Gl.GL_COMPILE);
Gl.glColor3ubv (light);
/* top panel (ccw) */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, -1.0f, 0.0f);
Gl.glVertex3f (-0.5f, -0.5f, 0.5f);
Gl.glVertex3f (-0.5f, -0.5f, -0.5f);
Gl.glVertex3f ( 0.5f, -0.5f, 0.5f);
Gl.glVertex3f ( 0.5f, -0.5f, -0.5f);
Gl.glEnd ();
/* bottom panel (cw) */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, 1.0f, 0.0f);
Gl.glVertex3f ( 0.5f, 0.5f, -0.5f);
Gl.glVertex3f (-0.5f, 0.5f, -0.5f);
Gl.glVertex3f ( 0.5f, 0.5f, 0.5f);
Gl.glVertex3f (-0.5f, 0.5f, 0.5f);
Gl.glEnd ();
/* dark colour for these */
Gl.glColor3ubv (dark);
/* right panel */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 1.0f, 0.0f, 0.0f);
Gl.glVertex3f ( 0.5f, -0.5f, 0.5f);
Gl.glVertex3f ( 0.5f, -0.5f, -0.5f);
Gl.glVertex3f ( 0.5f, 0.5f, 0.5f);
Gl.glVertex3f ( 0.5f, 0.5f, -0.5f);
Gl.glEnd ();
/* left panel */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f (-1.0f, 0.0f, 0.0f);
Gl.glVertex3f (-0.5f, 0.5f, -0.5f);
Gl.glVertex3f (-0.5f, -0.5f, -0.5f);
Gl.glVertex3f (-0.5f, 0.5f, 0.5f);
Gl.glVertex3f (-0.5f, -0.5f, 0.5f);
Gl.glEnd ();
/* front panel */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, 0.0f, 1.0f);
Gl.glVertex3f (-0.5f, 0.5f, 0.5f);
Gl.glVertex3f (-0.5f, -0.5f, 0.5f);
Gl.glVertex3f ( 0.5f, 0.5f, 0.5f);
Gl.glVertex3f ( 0.5f, -0.5f, 0.5f);
Gl.glEnd ();
/* back panel */
Gl.glBegin (Gl.GL_TRIANGLE_STRIP);
Gl.glNormal3f ( 0.0f, 0.0f, -1.0f);
Gl.glVertex3f ( 0.5f, -0.5f, -0.5f);
Gl.glVertex3f (-0.5f, -0.5f, -0.5f);
Gl.glVertex3f ( 0.5f, 0.5f, -0.5f);
Gl.glVertex3f (-0.5f, 0.5f, -0.5f);
Gl.glEnd ();
Gl.glEndList ();
return id;
}
void InitCallLists () {
if (cubeId == 0)
cubeId = GetCubeId ();
}
// Interface Properties
public override int DisplayFlags {
get { return Glut.GLUT_DOUBLE | Glut.GLUT_DEPTH; }
}
public override bool Complete {
get { return state >= State.Complete; }
}
// Interface Methods
public override void Reset (int width, int height) {
Gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
Gl.glClearDepth (1.0f);
Gl.glShadeModel (Gl.GL_FLAT);
Gl.glEnable (Gl.GL_CULL_FACE);
Gl.glCullFace (Gl.GL_BACK);
Gl.glEnable (Gl.GL_DEPTH_TEST);
Gl.glDepthFunc (Gl.GL_LEQUAL);
Gl.glDisable (Gl.GL_BLEND);
Gl.glHint (Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
if (lighting) {
float[] light = new float[4] { 1.0f, 1.0f, 4.0f, 0.0f };
float[] specular = new float[4] { 1.0f, 0.7f, 0.1f, 0.5f };
float[] ambient = new float[4] { 0.529f, 0.8f, 1.0f, 0.5f };
float[] shininess = new float[1] { 20.0f };
Gl.glEnable (Gl.GL_LIGHT0);
Gl.glEnable (Gl.GL_LIGHTING);
Gl.glEnable (Gl.GL_NORMALIZE);
Gl.glLightfv (Gl.GL_LIGHT0, Gl.GL_POSITION, light);
Gl.glMaterialfv (Gl.GL_FRONT, Gl.GL_AMBIENT_AND_DIFFUSE, ambient);
Gl.glMaterialfv (Gl.GL_FRONT, Gl.GL_SPECULAR, specular);
Gl.glMaterialfv (Gl.GL_FRONT, Gl.GL_SHININESS, shininess);
Gl.glDrawBuffer (Gl.GL_BACK);
} else {
Gl.glDisable (Gl.GL_LIGHT0);
Gl.glDisable (Gl.GL_LIGHTING);
Gl.glDisable (Gl.GL_NORMALIZE);
}
state = 0;
start = 0;
nFrames = 0;
camera.pos.x = 20.0f;
camera.pos.y = 400.0f;
camera.pos.z = 20.0f;
camera.rot.x = 0.0f;
camera.rot.y = 0.0f;
camera.rot.z = 0.0f;
for (int i = 0; i < 144; i++) {
cubes[i].x = formations[0][i].x;
cubes[i].y = formations[0][i].y;
cubes[i].z = formations[0][i].z;
}
InitCallLists ();
Resize (width, height);
}
public override void Resize (int width, int height) {
Gl.glViewport (0, 0, width, height);
Gl.glMatrixMode (Gl.GL_PROJECTION);
Gl.glLoadIdentity ();
Glu.gluPerspective (45.0f, (double) width / (double) height, 0.1f, 400.0f);
Gl.glMatrixMode (Gl.GL_MODELVIEW);
Gl.glLoadIdentity ();
}
static int MoveCube (ref Vector cube, Vector start, Vector finish) {
Vector delta = finish - cube;
if (delta <= 0.001f) {
cube.x = finish.x;
cube.y = finish.y;
cube.z = finish.z;
return 0;
}
delta = finish - start;
delta *= 0.005f;
cube += delta;
return 1;
}
public override bool AdvanceFrame () {
int prev, next, moved = 0;
int i;
if ((((int) state) & 0x1) != 0) {
/* we are between states... move each cube closer to
* where it is supposed to be for the next state */
// next formation...
prev = (((int) state) >> 1);
next = prev + 1;
for (i = 0; i < 144; i++)
moved += MoveCube (ref cubes[i], formations[prev][i], formations[next][i]);
if (moved == 0) {
start = nFrames;
state++;
}
} else {
// last for 600 frames for each state
if ((nFrames - start) >= 600)
state++;
}
// rotate the camera
camera.rot.x += 0.7f;
camera.rot.y += 0.8f;
camera.rot.z += 0.9f;
// zoom the camera
camera.pos.y -= (camera.pos.y / 75.0f);
if (camera.pos.y < 0.01f)
camera.pos.y = 0.0f;
nFrames++;
return state != State.Complete;
}
public override void RenderFrame () {
Gl.glClear (Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
Gl.glPolygonMode (Gl.GL_FRONT_AND_BACK, Gl.GL_FILL);
Gl.glLoadIdentity ();
Glu.gluLookAt (camera.pos.x,
camera.pos.y,
camera.pos.z,
0.0f, 0.0f, 0.0f,
0.0f, 0.1f, 0.0f);
Gl.glPushMatrix ();
Gl.glRotatef (camera.rot.x, 1.0f, 0.0f, 0.0f);
Gl.glRotatef (camera.rot.y, 0.0f, 1.0f, 0.0f);
Gl.glRotatef (camera.rot.z, 0.0f, 0.0f, 1.0f);
for (int i = 0; i < 144; i++) {
Vector delta;
if (i == 0) {
delta = cubes[0];
} else {
delta = cubes[i] - cubes[i - 1];
}
Gl.glTranslatef (delta.x, delta.y, delta.z);
Gl.glCallList (cubeId);
}
Gl.glPopMatrix ();
}
}
}

148
DemoLib/Vertex.cs Normal file
Просмотреть файл

@ -0,0 +1,148 @@
/*
* Copyright (C) 2007 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using System.Text;
namespace DemoLib {
public class Vertex : ICloneable {
public static readonly Vertex Origin = new Vertex (0.0f, 0.0f, 0.0f);
public float[] v;
// Constructors
public Vertex ()
: this (0.0f, 0.0f, 0.0f, 1.0f) {
}
public Vertex (float x)
: this (x, 0.0f, 0.0f, 1.0f) {
}
public Vertex (float x, float y)
: this (x, y, 0.0f, 1.0f) {
}
public Vertex (float x, float y, float z)
: this (x, y, z, 1.0f) {
}
public Vertex (float x, float y, float z, float w) {
v = new float[4];
v[0] = x;
v[1] = y;
v[2] = z;
v[3] = w;
}
// Properties
public float x {
get { return v[0]; }
set { v[0] = value; }
}
public float y {
get { return v[1]; }
set { v[1] = value; }
}
public float z {
get { return v[2]; }
set { v[2] = value; }
}
public float w {
get { return v[3]; }
set { v[3] = value; }
}
// Methods
public object Clone () {
return new Vertex (x, y, z, w);
}
// Overloaded Operators
public static explicit operator Vector (Vertex v) {
return new Vector (v.x, v.y, v.z);
}
// Multiplication by a scalar value
public static Vertex operator * (Vertex v, float scalar) {
return new Vertex (v.x * scalar, v.y * scalar, v.z * scalar, v.w);
}
// Division by a scalar value
public static Vertex operator / (Vertex v, float scalar) {
if (scalar == 0.0f)
throw new DivideByZeroException ();
return new Vertex (v.x / scalar, v.y / scalar, v.z / scalar);
}
// Vertex addition (results in a Vector)
public static Vector operator + (Vertex v0, Vertex v1) {
return new Vector (v0.x + v1.x, v0.y + v1.y, v0.z + v1.z);
}
// Vertex subtraction (results in a Vector)
public static Vector operator - (Vertex v0, Vertex v1) {
return new Vector (v0.x - v1.x, v0.y - v1.y, v0.z - v1.z);
}
public static Vertex operator + (Vertex vertex, Vector vector) {
return (Vertex) (((Vector) vertex) + vector);
}
public static Vertex operator - (Vertex vertex, Vector vector) {
return (Vertex) (((Vector) vertex) - vector);
}
public static bool operator == (Vertex v0, Vertex v1) {
return ((Math.Abs (v1.x - v0.x) < 0.00001f) &&
(Math.Abs (v1.y - v0.y) < 0.00001f) &&
(Math.Abs (v1.z - v0.z) < 0.00001f));
}
public static bool operator != (Vertex v0, Vertex v1) {
return ((Math.Abs (v1.x - v0.x) >= 0.00001f) ||
(Math.Abs (v1.y - v0.y) >= 0.00001f) ||
(Math.Abs (v1.z - v0.z) >= 0.00001f));
}
public override string ToString () {
StringBuilder str = new StringBuilder ("Vertex: (");
str.Append (x);
str.Append (", ");
str.Append (y);
str.Append (", ");
str.Append (z);
str.Append (')');
return str.ToString ();
}
public override bool Equals (object obj) {
return base.Equals (obj);
}
public override int GetHashCode () {
return base.GetHashCode ();
}
}
}

Просмотреть файл

@ -0,0 +1,303 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace DemoLib {
public partial class ScreenResolution {
private Gtk.VBox vbox;
private Gtk.Image image;
private Gtk.HBox hbox;
private Gtk.Frame frame_resolution;
private Gtk.Alignment GtkAlignment1;
private Gtk.Table table_resolution;
private Gtk.CheckButton checkbox_fullscreen;
private Gtk.RadioButton radio_1024x768;
private Gtk.RadioButton radio_1280x1024;
private Gtk.RadioButton radio_1400x1280;
private Gtk.RadioButton radio_320x240;
private Gtk.RadioButton radio_640x480;
private Gtk.RadioButton radio_800x600;
private Gtk.Label label_resolution;
private Gtk.Frame frame_colour_quality;
private Gtk.Alignment GtkAlignment2;
private Gtk.Table table_colour_quality;
private Gtk.RadioButton radio_16bit;
private Gtk.RadioButton radio_32bit;
private Gtk.Label label_colours;
private Gtk.Button button_play;
private Gtk.Button button_exit;
protected virtual void Build() {
Stetic.Gui.Initialize();
// Widget DemoLib.ScreenResolution
this.Events = ((Gdk.EventMask)(256));
this.Name = "DemoLib.ScreenResolution";
this.Title = Mono.Unix.Catalog.GetString("Settings");
this.Icon = Gtk.IconTheme.Default.LoadIcon("stock_3d-colors", 16, 0);
// Internal child DemoLib.ScreenResolution.VBox
Gtk.VBox w1 = this.VBox;
w1.Events = ((Gdk.EventMask)(256));
w1.Name = "dialog_VBox";
w1.BorderWidth = ((uint)(2));
// Container child dialog_VBox.Gtk.Box+BoxChild
this.vbox = new Gtk.VBox();
this.vbox.Name = "vbox";
// Container child vbox.Gtk.Box+BoxChild
this.image = new Gtk.Image();
this.image.Name = "image";
this.image.Pixbuf = Gtk.IconTheme.Default.LoadIcon("stock_3d-colors", 48, 0);
this.vbox.Add(this.image);
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox[this.image]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
// Container child vbox.Gtk.Box+BoxChild
this.hbox = new Gtk.HBox();
this.hbox.Name = "hbox";
// Container child hbox.Gtk.Box+BoxChild
this.frame_resolution = new Gtk.Frame();
this.frame_resolution.Name = "frame_resolution";
this.frame_resolution.LabelXalign = 0F;
this.frame_resolution.BorderWidth = ((uint)(6));
// Container child frame_resolution.Gtk.Container+ContainerChild
this.GtkAlignment1 = new Gtk.Alignment(0F, 0F, 1F, 1F);
this.GtkAlignment1.Name = "GtkAlignment1";
this.GtkAlignment1.LeftPadding = ((uint)(12));
// Container child GtkAlignment1.Gtk.Container+ContainerChild
this.table_resolution = new Gtk.Table(((uint)(4)), ((uint)(2)), false);
this.table_resolution.Name = "table_resolution";
this.table_resolution.RowSpacing = ((uint)(6));
this.table_resolution.ColumnSpacing = ((uint)(6));
this.table_resolution.BorderWidth = ((uint)(6));
// Container child table_resolution.Gtk.Table+TableChild
this.checkbox_fullscreen = new Gtk.CheckButton();
this.checkbox_fullscreen.CanFocus = true;
this.checkbox_fullscreen.Name = "checkbox_fullscreen";
this.checkbox_fullscreen.Label = Mono.Unix.Catalog.GetString("Fullscreen");
this.checkbox_fullscreen.DrawIndicator = true;
this.checkbox_fullscreen.UseUnderline = true;
this.table_resolution.Add(this.checkbox_fullscreen);
Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table_resolution[this.checkbox_fullscreen]));
w3.TopAttach = ((uint)(3));
w3.BottomAttach = ((uint)(4));
w3.RightAttach = ((uint)(2));
w3.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_1024x768 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("1024 x 768"));
this.radio_1024x768.CanFocus = true;
this.radio_1024x768.Name = "radio_1024x768";
this.radio_1024x768.Active = true;
this.radio_1024x768.DrawIndicator = true;
this.radio_1024x768.UseUnderline = true;
this.radio_1024x768.Group = new GLib.SList(System.IntPtr.Zero);
this.table_resolution.Add(this.radio_1024x768);
Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_1024x768]));
w4.LeftAttach = ((uint)(1));
w4.RightAttach = ((uint)(2));
w4.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_1280x1024 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("1280 x 1024"));
this.radio_1280x1024.CanFocus = true;
this.radio_1280x1024.Name = "radio_1280x1024";
this.radio_1280x1024.DrawIndicator = true;
this.radio_1280x1024.UseUnderline = true;
this.radio_1280x1024.Group = this.radio_1024x768.Group;
this.table_resolution.Add(this.radio_1280x1024);
Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_1280x1024]));
w5.TopAttach = ((uint)(1));
w5.BottomAttach = ((uint)(2));
w5.LeftAttach = ((uint)(1));
w5.RightAttach = ((uint)(2));
w5.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_1400x1280 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("1400 x 1280"));
this.radio_1400x1280.CanFocus = true;
this.radio_1400x1280.Name = "radio_1400x1280";
this.radio_1400x1280.DrawIndicator = true;
this.radio_1400x1280.UseUnderline = true;
this.radio_1400x1280.Group = this.radio_1024x768.Group;
this.table_resolution.Add(this.radio_1400x1280);
Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_1400x1280]));
w6.TopAttach = ((uint)(2));
w6.BottomAttach = ((uint)(3));
w6.LeftAttach = ((uint)(1));
w6.RightAttach = ((uint)(2));
w6.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_320x240 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("320 x 240"));
this.radio_320x240.CanFocus = true;
this.radio_320x240.Name = "radio_320x240";
this.radio_320x240.DrawIndicator = true;
this.radio_320x240.UseUnderline = true;
this.radio_320x240.Group = this.radio_1024x768.Group;
this.table_resolution.Add(this.radio_320x240);
Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_320x240]));
w7.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_640x480 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("640 x 480"));
this.radio_640x480.CanFocus = true;
this.radio_640x480.Name = "radio_640x480";
this.radio_640x480.DrawIndicator = true;
this.radio_640x480.UseUnderline = true;
this.radio_640x480.Group = this.radio_1024x768.Group;
this.table_resolution.Add(this.radio_640x480);
Gtk.Table.TableChild w8 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_640x480]));
w8.TopAttach = ((uint)(1));
w8.BottomAttach = ((uint)(2));
w8.YOptions = ((Gtk.AttachOptions)(4));
// Container child table_resolution.Gtk.Table+TableChild
this.radio_800x600 = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("800 x 600"));
this.radio_800x600.CanFocus = true;
this.radio_800x600.Name = "radio_800x600";
this.radio_800x600.DrawIndicator = true;
this.radio_800x600.UseUnderline = true;
this.radio_800x600.Group = this.radio_1024x768.Group;
this.table_resolution.Add(this.radio_800x600);
Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table_resolution[this.radio_800x600]));
w9.TopAttach = ((uint)(2));
w9.BottomAttach = ((uint)(3));
w9.YOptions = ((Gtk.AttachOptions)(4));
this.GtkAlignment1.Add(this.table_resolution);
this.frame_resolution.Add(this.GtkAlignment1);
this.label_resolution = new Gtk.Label();
this.label_resolution.Name = "label_resolution";
this.label_resolution.LabelProp = Mono.Unix.Catalog.GetString("<b>Screen Resolution</b>");
this.label_resolution.UseMarkup = true;
this.frame_resolution.LabelWidget = this.label_resolution;
this.hbox.Add(this.frame_resolution);
Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox[this.frame_resolution]));
w12.Position = 0;
w12.Expand = false;
w12.Fill = false;
// Container child hbox.Gtk.Box+BoxChild
this.frame_colour_quality = new Gtk.Frame();
this.frame_colour_quality.Name = "frame_colour_quality";
this.frame_colour_quality.LabelXalign = 0F;
this.frame_colour_quality.BorderWidth = ((uint)(6));
// Container child frame_colour_quality.Gtk.Container+ContainerChild
this.GtkAlignment2 = new Gtk.Alignment(0F, 0F, 1F, 1F);
this.GtkAlignment2.Name = "GtkAlignment2";
this.GtkAlignment2.LeftPadding = ((uint)(12));
// Container child GtkAlignment2.Gtk.Container+ContainerChild
this.table_colour_quality = new Gtk.Table(((uint)(2)), ((uint)(1)), false);
this.table_colour_quality.Name = "table_colour_quality";
this.table_colour_quality.RowSpacing = ((uint)(6));
this.table_colour_quality.ColumnSpacing = ((uint)(6));
this.table_colour_quality.BorderWidth = ((uint)(6));
// Container child table_colour_quality.Gtk.Table+TableChild
this.radio_16bit = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("16 bit"));
this.radio_16bit.CanFocus = true;
this.radio_16bit.Name = "radio_16bit";
this.radio_16bit.Active = true;
this.radio_16bit.DrawIndicator = true;
this.radio_16bit.UseUnderline = true;
this.radio_16bit.Group = new GLib.SList(System.IntPtr.Zero);
this.table_colour_quality.Add(this.radio_16bit);
Gtk.Table.TableChild w13 = ((Gtk.Table.TableChild)(this.table_colour_quality[this.radio_16bit]));
w13.XOptions = ((Gtk.AttachOptions)(4));
w13.YOptions = ((Gtk.AttachOptions)(0));
// Container child table_colour_quality.Gtk.Table+TableChild
this.radio_32bit = new Gtk.RadioButton(Mono.Unix.Catalog.GetString("32 bit"));
this.radio_32bit.CanFocus = true;
this.radio_32bit.Name = "radio_32bit";
this.radio_32bit.DrawIndicator = true;
this.radio_32bit.UseUnderline = true;
this.radio_32bit.Group = this.radio_16bit.Group;
this.table_colour_quality.Add(this.radio_32bit);
Gtk.Table.TableChild w14 = ((Gtk.Table.TableChild)(this.table_colour_quality[this.radio_32bit]));
w14.TopAttach = ((uint)(1));
w14.BottomAttach = ((uint)(2));
w14.XOptions = ((Gtk.AttachOptions)(4));
w14.YOptions = ((Gtk.AttachOptions)(4));
this.GtkAlignment2.Add(this.table_colour_quality);
this.frame_colour_quality.Add(this.GtkAlignment2);
this.label_colours = new Gtk.Label();
this.label_colours.Name = "label_colours";
this.label_colours.LabelProp = Mono.Unix.Catalog.GetString("<b>Colour Quality</b>");
this.label_colours.UseMarkup = true;
this.frame_colour_quality.LabelWidget = this.label_colours;
this.hbox.Add(this.frame_colour_quality);
Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.hbox[this.frame_colour_quality]));
w17.Position = 1;
w17.Expand = false;
w17.Fill = false;
this.vbox.Add(this.hbox);
Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.vbox[this.hbox]));
w18.Position = 1;
w18.Expand = false;
w18.Fill = false;
w1.Add(this.vbox);
Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(w1[this.vbox]));
w19.Position = 0;
w19.Expand = false;
w19.Fill = false;
// Internal child DemoLib.ScreenResolution.ActionArea
Gtk.HButtonBox w20 = this.ActionArea;
w20.Events = ((Gdk.EventMask)(256));
w20.Name = "DemoLib.ScreenResolution_ActionArea";
w20.Spacing = 6;
w20.BorderWidth = ((uint)(5));
w20.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
// Container child DemoLib.ScreenResolution_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.button_play = new Gtk.Button();
this.button_play.CanDefault = true;
this.button_play.CanFocus = true;
this.button_play.Name = "button_play";
this.button_play.UseUnderline = true;
this.button_play.Label = Mono.Unix.Catalog.GetString("_Play");
this.AddActionWidget(this.button_play, -5);
Gtk.ButtonBox.ButtonBoxChild w21 = ((Gtk.ButtonBox.ButtonBoxChild)(w20[this.button_play]));
w21.Expand = false;
w21.Fill = false;
// Container child DemoLib.ScreenResolution_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.button_exit = new Gtk.Button();
this.button_exit.CanDefault = true;
this.button_exit.CanFocus = true;
this.button_exit.Name = "button_exit";
this.button_exit.UseStock = true;
this.button_exit.UseUnderline = true;
this.button_exit.Label = "gtk-quit";
this.AddActionWidget(this.button_exit, 0);
Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w20[this.button_exit]));
w22.Position = 1;
w22.Expand = false;
w22.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll();
}
this.DefaultWidth = 375;
this.DefaultHeight = 276;
this.Show();
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
namespace Stetic {
internal class Gui {
private static bool initialized;
internal static void Initialize() {
if ((Stetic.Gui.initialized == false)) {
Stetic.Gui.initialized = true;
}
}
}
internal class ActionGroups {
public static Gtk.ActionGroup GetActionGroup(System.Type type) {
return Stetic.ActionGroups.GetActionGroup(type.FullName);
}
public static Gtk.ActionGroup GetActionGroup(string name) {
return null;
}
}
}

389
DemoLib/gtk-gui/gui.stetic Normal file
Просмотреть файл

@ -0,0 +1,389 @@
<?xml version="1.0" encoding="utf-8"?>
<stetic-interface>
<widget class="Gtk.Dialog" id="DemoLib.ScreenResolution" design-size="375 276">
<property name="MemberName" />
<property name="Events">ButtonPressMask</property>
<property name="Title" translatable="yes">Settings</property>
<property name="Icon">stock:stock_3d-colors Menu</property>
<property name="Buttons">2</property>
<property name="HelpButton">False</property>
<child internal-child="VBox">
<widget class="Gtk.VBox" id="dialog_VBox">
<property name="MemberName" />
<property name="Events">ButtonPressMask</property>
<property name="BorderWidth">2</property>
<child>
<widget class="Gtk.VBox" id="vbox">
<property name="MemberName" />
<child>
<widget class="Gtk.Image" id="image">
<property name="MemberName" />
<property name="Pixbuf">stock:stock_3d-colors Dialog</property>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.HBox" id="hbox">
<property name="MemberName" />
<child>
<widget class="Gtk.Frame" id="frame_resolution">
<property name="MemberName" />
<property name="LabelXalign">0</property>
<property name="BorderWidth">6</property>
<child>
<widget class="Gtk.Alignment" id="GtkAlignment1">
<property name="MemberName" />
<property name="Xalign">0</property>
<property name="Yalign">0</property>
<property name="LeftPadding">12</property>
<child>
<widget class="Gtk.Table" id="table_resolution">
<property name="MemberName" />
<property name="NRows">4</property>
<property name="NColumns">2</property>
<property name="RowSpacing">6</property>
<property name="ColumnSpacing">6</property>
<property name="BorderWidth">6</property>
<child>
<widget class="Gtk.CheckButton" id="checkbox_fullscreen">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">Fullscreen</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
</widget>
<packing>
<property name="TopAttach">3</property>
<property name="BottomAttach">4</property>
<property name="RightAttach">2</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_1024x768">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">1024 x 768</property>
<property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="LeftAttach">1</property>
<property name="RightAttach">2</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_1280x1024">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">1280 x 1024</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="TopAttach">1</property>
<property name="BottomAttach">2</property>
<property name="LeftAttach">1</property>
<property name="RightAttach">2</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_1400x1280">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">1400 x 1280</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="TopAttach">2</property>
<property name="BottomAttach">3</property>
<property name="LeftAttach">1</property>
<property name="RightAttach">2</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_320x240">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">320 x 240</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_640x480">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">640 x 480</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="TopAttach">1</property>
<property name="BottomAttach">2</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_800x600">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">800 x 600</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_resolution</property>
</widget>
<packing>
<property name="TopAttach">2</property>
<property name="BottomAttach">3</property>
<property name="AutoSize">True</property>
<property name="YOptions">Fill</property>
<property name="XExpand">True</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="Gtk.Label" id="label_resolution">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;b&gt;Screen Resolution&lt;/b&gt;</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Frame" id="frame_colour_quality">
<property name="MemberName" />
<property name="LabelXalign">0</property>
<property name="BorderWidth">6</property>
<child>
<widget class="Gtk.Alignment" id="GtkAlignment2">
<property name="MemberName" />
<property name="Xalign">0</property>
<property name="Yalign">0</property>
<property name="LeftPadding">12</property>
<child>
<widget class="Gtk.Table" id="table_colour_quality">
<property name="MemberName" />
<property name="NRows">2</property>
<property name="NColumns">1</property>
<property name="RowSpacing">6</property>
<property name="ColumnSpacing">6</property>
<property name="BorderWidth">6</property>
<child>
<widget class="Gtk.RadioButton" id="radio_16bit">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">16 bit</property>
<property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_colour</property>
</widget>
<packing>
<property name="AutoSize">False</property>
<property name="XOptions">Fill</property>
<property name="YOptions">0</property>
<property name="XExpand">False</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">False</property>
<property name="YShrink">False</property>
</packing>
</child>
<child>
<widget class="Gtk.RadioButton" id="radio_32bit">
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label" translatable="yes">32 bit</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
<property name="Group">group_colour</property>
</widget>
<packing>
<property name="TopAttach">1</property>
<property name="BottomAttach">2</property>
<property name="AutoSize">True</property>
<property name="XOptions">Fill</property>
<property name="YOptions">Fill</property>
<property name="XExpand">False</property>
<property name="XFill">True</property>
<property name="XShrink">False</property>
<property name="YExpand">False</property>
<property name="YFill">True</property>
<property name="YShrink">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="Gtk.Label" id="label_colours">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">&lt;b&gt;Colour Quality&lt;/b&gt;</property>
<property name="UseMarkup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">1</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="Position">0</property>
<property name="AutoSize">False</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
</child>
<child internal-child="ActionArea">
<widget class="Gtk.HButtonBox" id="DemoLib.ScreenResolution_ActionArea">
<property name="MemberName" />
<property name="Events">ButtonPressMask</property>
<property name="Spacing">6</property>
<property name="BorderWidth">5</property>
<property name="Size">2</property>
<property name="LayoutStyle">End</property>
<child>
<widget class="Gtk.Button" id="button_play">
<property name="MemberName" />
<property name="CanDefault">True</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label" translatable="yes">_Play</property>
<property name="UseUnderline">True</property>
<property name="IsDialogButton">True</property>
<property name="ResponseId">-5</property>
</widget>
<packing>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
<child>
<widget class="Gtk.Button" id="button_exit">
<property name="MemberName" />
<property name="CanDefault">True</property>
<property name="CanFocus">True</property>
<property name="UseStock">True</property>
<property name="Type">StockItem</property>
<property name="StockId">gtk-quit</property>
<property name="IsDialogButton">True</property>
<property name="ResponseId">0</property>
<property name="label">gtk-quit</property>
</widget>
<packing>
<property name="Position">1</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</stetic-interface>

3
README Normal file
Просмотреть файл

@ -0,0 +1,3 @@
Just a little fun project I hack on in my spare cycles... aimed at
abstracting out some of my old c graphics demos into reusable c#
classes to make it easier to write new ones.