what is the correct way using a pregenerated command list

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

what is the correct way using a pregenerated command list

Post by zoret »

hi guys,

i've simply modified the cube sample to display 120 cubes (each one textured with the same texture)
my first try give me some very poor performance and so i decided to pre generated 2 command lists (one for the texture and another one for the cube)

i must be missing something because i changes nothing to the performance i got !! => 15 fps !!

here is the full code, just replace the main file from the cube sample with this file and it should compile
why is there no performance gain ?

thanks in advance for any help !!

Code: Select all


/*
* PSP Software Development Kit - http://www.pspdev.org
* -----------------------------------------------------------------------
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
*
* Copyright (c) 2005 Jesper Svennevid
*/

#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <pspdebug.h>

#include <time.h>

#include <pspgu.h>
#include <pspgum.h>

#include "../common/callbacks.h"
#include "../common/vram.h"

PSP_MODULE_INFO&#40;"Cube Sample", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER&#41;;

static unsigned int __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; list&#91;262144&#93;;
extern unsigned char logo_start&#91;&#93;;

#define printf	pspDebugScreenPrintf

struct Vertex
&#123;
	float u, v;
	unsigned int color;
	float x,y,z;
&#125;;

struct Vertex __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; vertices&#91;12*3&#93; =
&#123;
	&#123;0, 0, 0xff7f0000,-1,-1, 1&#125;, // 0
	&#123;1, 0, 0xff7f0000,-1, 1, 1&#125;, // 4
	&#123;1, 1, 0xff7f0000, 1, 1, 1&#125;, // 5

	&#123;0, 0, 0xff7f0000,-1,-1, 1&#125;, // 0
	&#123;1, 1, 0xff7f0000, 1, 1, 1&#125;, // 5
	&#123;0, 1, 0xff7f0000, 1,-1, 1&#125;, // 1

	&#123;0, 0, 0xff7f0000,-1,-1,-1&#125;, // 3
	&#123;1, 0, 0xff7f0000, 1,-1,-1&#125;, // 2
	&#123;1, 1, 0xff7f0000, 1, 1,-1&#125;, // 6

	&#123;0, 0, 0xff7f0000,-1,-1,-1&#125;, // 3
	&#123;1, 1, 0xff7f0000, 1, 1,-1&#125;, // 6
	&#123;0, 1, 0xff7f0000,-1, 1,-1&#125;, // 7

	&#123;0, 0, 0xff007f00, 1,-1,-1&#125;, // 0
	&#123;1, 0, 0xff007f00, 1,-1, 1&#125;, // 3
	&#123;1, 1, 0xff007f00, 1, 1, 1&#125;, // 7

	&#123;0, 0, 0xff007f00, 1,-1,-1&#125;, // 0
	&#123;1, 1, 0xff007f00, 1, 1, 1&#125;, // 7
	&#123;0, 1, 0xff007f00, 1, 1,-1&#125;, // 4

	&#123;0, 0, 0xff007f00,-1,-1,-1&#125;, // 0
	&#123;1, 0, 0xff007f00,-1, 1,-1&#125;, // 3
	&#123;1, 1, 0xff007f00,-1, 1, 1&#125;, // 7

	&#123;0, 0, 0xff007f00,-1,-1,-1&#125;, // 0
	&#123;1, 1, 0xff007f00,-1, 1, 1&#125;, // 7
	&#123;0, 1, 0xff007f00,-1,-1, 1&#125;, // 4

	&#123;0, 0, 0xff00007f,-1, 1,-1&#125;, // 0
	&#123;1, 0, 0xff00007f, 1, 1,-1&#125;, // 1
	&#123;1, 1, 0xff00007f, 1, 1, 1&#125;, // 2

	&#123;0, 0, 0xff00007f,-1, 1,-1&#125;, // 0
	&#123;1, 1, 0xff00007f, 1, 1, 1&#125;, // 2
	&#123;0, 1, 0xff00007f,-1, 1, 1&#125;, // 3

	&#123;0, 0, 0xff00007f,-1,-1,-1&#125;, // 4
	&#123;1, 0, 0xff00007f,-1,-1, 1&#125;, // 7
	&#123;1, 1, 0xff00007f, 1,-1, 1&#125;, // 6

	&#123;0, 0, 0xff00007f,-1,-1,-1&#125;, // 4
	&#123;1, 1, 0xff00007f, 1,-1, 1&#125;, // 6
	&#123;0, 1, 0xff00007f, 1,-1,-1&#125;, // 5
&#125;;

#define BUF_WIDTH &#40;512&#41;
#define SCR_WIDTH &#40;480&#41;
#define SCR_HEIGHT &#40;272&#41;

#define SET_TEXTURE&#40;&#41;			sceGuCallList&#40;smallList1&#41;;	
#define DISPLAY_CUBE&#40;&#41;	SET_TEXTURE&#40;&#41;; sceGumUpdateMatrix&#40;&#41;; sceGuCallList&#40;smallList2&#41;;	

static unsigned int __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; smallList1&#91;1024&#93;;
static unsigned int __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; smallList2&#91;1024&#93;;

int main&#40;int argc, char* argv&#91;&#93;&#41;
&#123;
	pspDebugScreenInit&#40;&#41;;
	setupCallbacks&#40;&#41;;

	// setup GU

	void* fbp0 = getStaticVramBuffer&#40;BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888&#41;;
	void* fbp1 = getStaticVramBuffer&#40;BUF_WIDTH,SCR_HEIGHT,GU_PSM_8888&#41;;
	void* zbp = getStaticVramBuffer&#40;BUF_WIDTH,SCR_HEIGHT,GU_PSM_4444&#41;;

	sceGuInit&#40;&#41;;

	sceGuStart&#40;GU_DIRECT,list&#41;;
	sceGuDrawBuffer&#40;GU_PSM_8888,fbp0,BUF_WIDTH&#41;;
	sceGuDispBuffer&#40;SCR_WIDTH,SCR_HEIGHT,fbp1,BUF_WIDTH&#41;;
	sceGuDepthBuffer&#40;zbp,BUF_WIDTH&#41;;
	sceGuOffset&#40;2048 - &#40;SCR_WIDTH/2&#41;,2048 - &#40;SCR_HEIGHT/2&#41;&#41;;
	sceGuViewport&#40;2048,2048,SCR_WIDTH,SCR_HEIGHT&#41;;
	sceGuDepthRange&#40;65535,0&#41;;
	sceGuScissor&#40;0,0,SCR_WIDTH,SCR_HEIGHT&#41;;
	sceGuEnable&#40;GU_SCISSOR_TEST&#41;;
	sceGuDepthFunc&#40;GU_GEQUAL&#41;;
	sceGuEnable&#40;GU_DEPTH_TEST&#41;;
	sceGuFrontFace&#40;GU_CW&#41;;
	sceGuShadeModel&#40;GU_SMOOTH&#41;;
	sceGuEnable&#40;GU_CULL_FACE&#41;;
	sceGuEnable&#40;GU_TEXTURE_2D&#41;;
	sceGuEnable&#40;GU_CLIP_PLANES&#41;;
	sceGuFinish&#40;&#41;;
	sceGuSync&#40;0,0&#41;;

	sceDisplayWaitVblankStart&#40;&#41;;
	sceGuDisplay&#40;GU_TRUE&#41;;

	// run sample

	int val = 0;
	long oldMS, curMS;

	struct timeval tval;
	gettimeofday&#40;&tval,0&#41;;

	oldMS = tval.tv_sec * 1000 + tval.tv_usec;


	// generate callable command-list for cube rendering
	&#123;
		sceGuStart&#40;GU_CALL, smallList2&#41;;

		// draw cube
		sceGumDrawArray&#40;GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,12*3,0,vertices&#41;;

		sceGuFinish&#40;&#41;;
		sceGuSync&#40;0,0&#41;;
	&#125;

	&#123;
		sceGuStart&#40;GU_CALL, smallList1&#41;;
	
		sceGuTexMode&#40;GU_PSM_4444,0,0,0&#41;;				
		sceGuTexImage&#40;0,64,64,64,logo_start&#41;;			
		sceGuTexFunc&#40;GU_TFX_ADD,GU_TCC_RGB&#41;;			
		sceGuTexEnvColor&#40;0xffff00&#41;;						
		sceGuTexFilter&#40;GU_LINEAR,GU_LINEAR&#41;;			
		sceGuTexScale&#40;1.0f,1.0f&#41;;						
		sceGuTexOffset&#40;0.0f,0.0f&#41;;						
		sceGuAmbientColor&#40;0xffffffff&#41;;

		sceGuFinish&#40;&#41;;
		sceGuSync&#40;0,0&#41;;
	&#125;



	

	while&#40;running&#40;&#41;&#41;
	&#123;
		pspDebugScreenSetXY&#40;1, 1&#41;;

		struct timeval tval;
		gettimeofday&#40;&tval,0&#41;;

		curMS = tval.tv_sec * 1000000 + tval.tv_usec;
		long diff = curMS - oldMS;
		
		float fff = 1000000.f / diff;

		printf&#40;"%d %d %f\n", tval.tv_sec, tval.tv_usec, fff&#41;;

		oldMS = curMS;

		sceGuStart&#40;GU_DIRECT,list&#41;;

		// clear screen

		sceGuClearColor&#40;0xff554433&#41;;
		sceGuClearDepth&#40;0&#41;;
		sceGuClear&#40;GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT&#41;;

		// setup matrices for cube

		sceGumMatrixMode&#40;GU_PROJECTION&#41;;
		sceGumLoadIdentity&#40;&#41;;
		sceGumPerspective&#40;75.0f,16.0f/9.0f,0.5f,1000.0f&#41;;

		sceGumMatrixMode&#40;GU_VIEW&#41;;
		sceGumLoadIdentity&#40;&#41;;

		// setup texture

		float Y = 2;
		float Z = -7.5f;
		int IMAX = 4;
		int i;

		for &#40;i = 0; i < IMAX; ++i&#41;
		&#123;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			Y = 4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = 0;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -2;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			Z = -10.0f;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			Y = 4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = 0;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -2;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Z = -12.5f;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			Y = 4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = 0;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -2;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;



			Z = -15.0f;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			Y = 4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = 0;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -2;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;


			Y = -4;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -2, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -4, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; 6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;

			sceGumMatrixMode&#40;GU_MODEL&#41;;
			sceGumLoadIdentity&#40;&#41;;
			&#123;
				ScePspFVector3 pos = &#123; -6, Y, Z &#125;;
				ScePspFVector3 rot = &#123; val * 0.79f * &#40;GU_PI/180.0f&#41;, val * 0.98f * &#40;GU_PI/180.0f&#41;, val * 1.32f * &#40;GU_PI/180.0f&#41; &#125;;
				sceGumTranslate&#40;&pos&#41;;
				sceGumRotateXYZ&#40;&rot&#41;;
			&#125;
			// draw cube
			DISPLAY_CUBE&#40;&#41;;
		&#125;


		sceGuFinish&#40;&#41;;
		sceGuSync&#40;0,0&#41;;

		sceDisplayWaitVblankStart&#40;&#41;;
		sceGuSwapBuffers&#40;&#41;;

		val++;
	&#125;

	sceGuTerm&#40;&#41;;

	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;


i know i could have used a loop to display my 120 cubes but i'm a bit loafer ;)
starman2049
Posts: 75
Joined: Mon Sep 19, 2005 5:41 am

Post by starman2049 »

There are no silver bullets on PSP, just a whole lot of little things that all add up to a bigger performance improvement.

Off the top of my head it looks like you are doing 120 texture sets per frame, and to boot they are from system ram, not vram, and they are not swizzled.

I try to keep the number of textures for a scene to under 20 - but that's also a function of the size of each, and how flexible your artists are.

You want to load textures into VRAM with sceGuCopyImage() and then draw triangles with them. You also will get a big boost if you swizzle them (look elsewhere for swizzle info).

Feel freee to ask more...
zoret
Posts: 22
Joined: Sun Mar 19, 2006 7:57 pm

Post by zoret »

ok it sound logical
i will optimize the texture transfer later
for now i've tester with only one SET_TEXTURE, at the beginnning of the frame
all the cubes using the same texture
with that i only multiply the FPS by 2 (15 => 30 FPS)
i will try without the sceDisplayWaitVblankStart() to have a more precise FPS

is that normal 30 FPS to display 480 cubes (not 120, i had forget my hacked loop (int IMAX) ?
480 cubes with 36 vertices by cube => 17280 vertices at 30 FPS

what are the optimisations i can put on the cubes transfert ?

thanks
starman2049
Posts: 75
Joined: Mon Sep 19, 2005 5:41 am

Post by starman2049 »

You can optimize your vertex format. Right now you are using floats for everything (UV, COLOR, XYZ). An easy fix would be to convert your UV from float to 16bit. You can convert the others too, but thats going to require some special transforms.

Drawing 480 cubes on top of each other is a lot of overdraw, and my guess is they are close up to the screen and are big. (I didn't look at your code in detail). For more realistic case, try creating an array of 480 cubes that are offset in x,z so none overlap and then back the camera off so you can see them all (and hence each is smaller).

Yes, taking vsync off will get you a more accurate fps reading.
Post Reply