aboutsummaryrefslogtreecommitdiff
path: root/addons/visualization.vortex/resources/Presets/ChessMania.vtx
diff options
context:
space:
mode:
Diffstat (limited to 'addons/visualization.vortex/resources/Presets/ChessMania.vtx')
-rw-r--r--addons/visualization.vortex/resources/Presets/ChessMania.vtx90
1 files changed, 90 insertions, 0 deletions
diff --git a/addons/visualization.vortex/resources/Presets/ChessMania.vtx b/addons/visualization.vortex/resources/Presets/ChessMania.vtx
new file mode 100644
index 0000000000..278d36c612
--- /dev/null
+++ b/addons/visualization.vortex/resources/Presets/ChessMania.vtx
@@ -0,0 +1,90 @@
+// ChessMania.vtx
+// Author - MrC
+// Based on Rovastar - Chessmania.r4 by John Baker
+
+Texture checker;
+Texture tex1;
+Texture tex2;
+
+float[] cubeRot(3*3);
+float[] cubePos(3*3);
+
+void Init()
+{
+ checker.LoadTexture("checker.png");
+ tex1.CreateTexture();
+ tex2.CreateTexture();
+
+ for (int i=0; i<9;i++)
+ {
+ cubePos[i] = 0.0f;
+ cubeRot[i] = 0.0f;
+ }
+
+}
+
+void RenderCube(int cube, float dist)
+{
+ gfxPushMatrix();
+ gfxTranslate(0, 0, dist);
+
+ gfxRotate(cubePos[0+cube*3],1,0,0);
+ gfxRotate(cubePos[1+cube*3],0,0,1);
+ gfxRotate(cubePos[2+cube*3],0,1,0);
+
+ gfxCube(-0.25f, -0.25f, -0.25f, 0.25f, 0.25f, 0.25f);
+ gfxPopMatrix();
+}
+
+void Render()
+{
+ gfxSetTexture(checker);
+
+ gfxTranslate(0,0,2.414);
+
+ for (int i=0; i<9;i++)
+ {
+ cubePos[i] = cubePos[i] + cubeRot[i];
+ cubeRot[i] = cubeRot[i] * 0.95;
+ if (cubeRot[i] > 1)
+ cubeRot[i] = 1;
+ if (cubeRot[i] < -1)
+ cubeRot[i] = -1;
+ }
+
+ cubeRot[0] += BASS;
+ cubeRot[1] += MIDDLE;
+ cubeRot[2] += TREBLE;
+
+ cubeRot[4] += BASS;
+ cubeRot[5] += MIDDLE;
+ cubeRot[3] += TREBLE;
+
+ cubeRot[8] += BASS;
+ cubeRot[6] += MIDDLE;
+ cubeRot[7] += TREBLE;
+
+ gfxSetRenderTarget(tex1);
+ gfxClear(0);
+ gfxSetTexture(checker);
+ gfxSetAspect(0);
+ gfxTexRect(-1, -1, 1, 1);
+ RenderCube(2, -1.0);
+
+ gfxSetRenderTarget(tex2);
+ gfxClear(0);
+ gfxSetTexture(checker);
+ gfxSetAspect(0);
+ gfxTexRect(-1, -1, 1, 1);
+ gfxSetTexture(tex1);
+ RenderCube(1, -1.0);
+
+ gfxSetRenderTarget(TEXTURE_FRAMEBUFFER);
+ gfxSetTexture(checker);
+ gfxSetAspect(0);
+ gfxTexRect(-1, -1, 1, 1);
+ gfxSetTexture(tex2);
+ gfxSetAspect(1);
+ RenderCube(0, -1.15);
+
+} \ No newline at end of file