VerticalScrollingLayer::VerticalScrollingLayer(ImageResource* image, float scrollSpeed, float translucency, float x, float y)
	{
		SetPosition(x, y);
		SetScrollSpeed(scrollSpeed);
		SetTranslucency(translucency);
		SetImage(image);
	}
	VerticalScrollingLayer::VerticalScrollingLayer(const char* imageFileName, float scrollSpeed, float translucency, float x, float y)
	{
		SetPosition(x, y);
		SetScrollSpeed(scrollSpeed);
		SetTranslucency(translucency);
		SetImage(imageFileName);
	}
Beispiel #3
0
CubeTileMesh::CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color)
{
	m_faces = faces;

	SetOpaque(opaqueSides);
	SetAlpha(alpha);
	SetColor(color);
	SetTranslucency(translucency);
	SetLight(lightValue);

	m_topFaceVertexOffset = 0;
	m_bottomFaceVertexOffset = 0;
	m_frontFaceVertexOffset = 0;
	m_backFaceVertexOffset = 0;
	m_leftFaceVertexOffset = 0;
	m_rightFaceVertexOffset = 0;

	uint numVertices = 0;

	if (HasFace(SIDE_TOP))
	{
		m_topFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	if (HasFace(SIDE_BOTTOM))
	{
		m_bottomFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	if (HasFace(SIDE_FRONT))
	{
		m_frontFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	if (HasFace(SIDE_BACK))
	{
		m_backFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	if (HasFace(SIDE_LEFT))
	{
		m_leftFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	if (HasFace(SIDE_RIGHT))
	{
		m_rightFaceVertexOffset = numVertices;
		numVertices += CUBE_VERTICES_PER_FACE;
	}
	
	VERTEX_ATTRIBS attribs[] = {
		VERTEX_POS_3D,
		VERTEX_NORMAL,
		VERTEX_COLOR,
		VERTEX_TEXCOORD
	};

	m_vertices = new VertexBuffer();
	ASSERT(m_vertices != NULL);
	m_vertices->Initialize(attribs, 4, numVertices, BUFFEROBJECT_USAGE_STATIC);

	SetupFaceVertices(textureAtlasTileBoundaries);
	SetupCollisionVertices();
}