Research Coding Projects 3D

Cross Platform



During this project I had to refactor and optimize pre-existing code taken from a DirectX and PS3 tutorial.
I had to come up with my own project architecture and make the project as crossplatform as possible using shared methods and variables for both platforms.
By the use of #define and #if defined I was able to create a crossplatform program architecture.
Using a PlayStation 3 DevKit I was able to complete this project.


  • Custom Framework


  • C++
Download Source Download Source Download Source Download Binaries


image carousel

Some Details


This project was one of my favorite projects I did in DAE.
As already mentioned I needed to build a framework that run on Windows and PS3 from scratch.
The hardest part of this exercise was the instancing of the geometry.
I needed to find a way that I could create geometry 1 time but render it on different places on the screen.
I created a geometry package that would hold information about the geometry that needs to be created.

struct GeometryPackage
	GeometryPackage(unsigned int t)
#ifdef WIN32

	unsigned int type;
	VERTEXBUFFER vertexBuffer;

#ifdef WIN32
	ID3D11Buffer* indexBuffer;

	unsigned int LOD;

	unsigned int indexCount;
	unsigned int vertexCount;

#ifdef PS3
	bool operator==(const GeometryPackage& package)
		return (package.type == this->type && package.LOD == this->LOD && package.vertexBuffer == this->vertexBuffer && package.vertexCount == this->vertexCount);

As you can see I used some "#ifndef" do decide if we are building on Windows or PS3.
The most important part of the geometry package is the "Type" variable.
This variable will determine if new geometry will be created or not.
If the users adds geometry a check will be made to see if the type already exists, if not the geometry is created otherwise the method will do nothing.

void Geometry::AddGeometry(unsigned int type, unsigned int LOD)
	std::vector<GeometryPackage>::iterator it = find_if(m_GeometryPackageList.begin(),m_GeometryPackageList.end(),TypeExist(type));
	if(m_GeometryPackageList.end() == it) //Geometry is not found -> create it
		case PRIMITIVE_TYPE_CUBE: InitializeCubeData(type,LOD);	break;
		case PRIMITVE_TYPE_OCTAHEDRON: InitializeOctaHedronData(type,LOD);	break;

Later when the user want to use the geometry he needs to get a geometry package in order to create the geometry.
He well tell the method what type of geometry he wants and also the level of detail of the geometry.

	std::vector<GameObject*> _objlist;
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( -3.0f, 1.0f, 0.0f),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,5)));
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( -3.0f, 4.0f, 0.0),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,4)));
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( 0.0f, 1.0f, 0.0f),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,3)));
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( 0.0f, 4.0f, 0.0f),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,2)));
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( 3.0f, 1.0f, 0.0f),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,1)));
	_objlist.push_back(new Octahedron(OBJECTPOSITIONSET( 3.0f, 4.0f, 0.0f),geometry->GetPackage(PRIMITVE_TYPE_OCTAHEDRON,0)));

	_objlist.push_back(new Cube(OBJECTPOSITIONSET(  -2.0f, -2.0f, 0.0f),geometry->GetPackage(PRIMITIVE_TYPE_CUBE,0)));
	_objlist.push_back(new Cube(OBJECTPOSITIONSET(  2.0f, -2.0f, 0.0f),geometry->GetPackage(PRIMITIVE_TYPE_CUBE,0)));		

As you can see I'm creating 8 objects, 6 octahedrons with a diffrent LOD and 2 Cubes,
but in the screenshots you can see that I only have 7 buffers created in other words the instancing works.