Exemplo n.º 1
0
void GraphicsClass::AddTower(int size, float skin_width)
{
	D3DXVECTOR3 rotation(0.0f, 0.0f, 0.0f);
	const float cubeSize = 1.0f;
	const float spacing = -2.0f * skin_width;
	D3DXVECTOR3 pos(0.0f, cubeSize, 0.0f);
	while(size)
	{
		AddCube(pos, rotation, 1.0f);
		pos.y += (cubeSize * 2.0f + spacing);
		size--;
	}
}
Exemplo n.º 2
0
Cube::Cube(void):
	FourDimensionalObject(8, 18, 5)
{
	float length1 = 100.0f;
	float length2 = 100.0f;
	float length3 = 100.0f;
	float normalY = 1.0f;
	mRadius = Vector4f(length1/2, length2/2, 0, length3/2).length();
	for (int i = -1; i <= 1; i+=2)
		for (int j = -1; j <= 1; j+=2)
			for (int k = -1; k <= 1; k+=2)
				AddVertex(Vector4f(i * length1/2, j * length2/2, 0, k * length3/2));

	AddCube(00, 01, 02, 03, 04, 05, 06, 07, 
		Vector4f(0.0, 0.0, normalY/std::fabs(normalY), 0.0));
}
Exemplo n.º 3
0
Cube::Cube(const Vector4f &center, 
		float length1, float length2, float length3,
		float normalY) :
	FourDimensionalObject(8, 18, 5),
	mCenter(center)
{
	assert(normalY != 0);
	mRadius = Vector4f(length1/2, length2/2, 0, length3/2).length();
	for (int i = -1; i <= 1; i+=2)
		for (int j = -1; j <= 1; j+=2)
			for (int k = -1; k <= 1; k+=2)
				AddVertex(center + Vector4f(i * length1/2, j * length2/2, 0, k * length3/2));

	AddCube(00, 01, 02, 03, 04, 05, 06, 07, 
		Vector4f(0.0, 0.0, normalY/std::fabs(normalY), 0.0));
}
Exemplo n.º 4
0
void GraphicsClass::AddStack(int size, float skin_width)
{
	D3DXVECTOR3 rotation(0.0f, 0.0f, 0.0f);
	const float cubeSize = 1.0f;
	const float spacing = -2.0f * skin_width;
	D3DXVECTOR3 pos(0.0f, cubeSize, 0.0f);
	float offset = -size * (cubeSize * 2.0f + spacing) * 0.5f;
	while(size)
	{
		for(int i = 0; i < size; i++)
		{
			pos.x = offset + (float)i * (cubeSize * 2.0f + spacing);
			AddCube(pos, rotation, 1.0f);
		}
		offset += cubeSize;
		pos.y += (cubeSize * 2.0f + spacing);
		size--;
	}
}
Exemplo n.º 5
0
void Game1::Update(unsigned int time)
{
	KeyboardState cState = Keyboard::GetState();
	MouseState mState = Mouse::GetState();
	world->Step(time * 0.001f, 6, 2);
	if (cState.IsKeyDown(SDLK_y) && !oldState.IsKeyDown(SDLK_y))
	{
		AddCube(mState.X, mState.Y, mState.RelX, mState.RelY);
	}
	if (cState.IsKeyDown(SDLK_x) && !oldState.IsKeyDown(SDLK_x))
	{
		AddCircle(mState.X, mState.Y, mState.RelX * 10, mState.RelY * 10);
	}
	if (cState.IsKeyDown(SDLK_c) && !oldState.IsKeyDown(SDLK_c))
	{
		AddTriangle(mState.X, mState.Y, mState.RelX * 10, mState.RelY * 10);
	}
	if (cState.IsKeyDown(SDLK_v) && !oldState.IsKeyDown(SDLK_v))
	{
		AddRope(mState.X, mState.Y);
	}
	oldState = cState;
}
Exemplo n.º 6
0
void GLMesh::AddCube(std::shared_ptr<GLMesh> mesh, const glm::vec3 center, const float size) {
  AddCube(mesh, center, size, size, size);
}
Exemplo n.º 7
0
void GLMesh::AddCube(std::shared_ptr<GLMesh> mesh, const float width, const float length, const float height) {
  AddCube(mesh, glm::vec3(0, 0, 0), width, length, height);
}
Exemplo n.º 8
0
void GLMesh::AddCube(std::shared_ptr<GLMesh> mesh, const float size) {
  AddCube(mesh, glm::vec3(0, 0, 0), size, size, size);
}