Beispiel #1
0
	/*
	=====================
	GameNode::BatchDraw
	=====================
	*/
	void GameNode::BatchDraw() {
		glPushMatrix();
		Vec2 fac = GameControl::GetSingleton()->GetCoordinateFactor();

		glTranslatef(position.x / fac.x, position.y / fac.y, 0.f);
		glRotatef(rotation, 0.f, 0.f, 1.f);

		if (shadowShape && dbgShadowShape) {
			glPushMatrix();

			fac = GameControl::GetSingleton()->GetWindowScale();
			glScalef(fac.x, fac.y, 1.f);

			shadowShape->DebugDraw();

			glPopMatrix();
		}

		OrderChildren();

		for (unsigned int i=0; i<children.size(); i++) {
			// This is the only difference from GameNode::draw(): batchDraw is called
			// on the node's children.
			children[i]->BatchDraw();
		}

		glPopMatrix();
	}
Beispiel #2
0
	/*
	=====================
	GameNode::Draw
	=====================
	*/
	void GameNode::Draw() {
		glPushMatrix();
		Vec2 fac = GameControl::GetSingleton()->GetCoordinateFactor();

		glTranslatef(position.x / fac.x, position.y / fac.y, 0.f);
		glRotatef(rotation, 0.f, 0.f, 1.f);

		if (shadowShape && dbgShadowShape) {
			glPushMatrix();

			fac = GameControl::GetSingleton()->GetWindowScale();
			glScalef(fac.x, fac.y, 1.f);

			shadowShape->DebugDraw();

			glPopMatrix();
		}

		OrderChildren();

		for (unsigned int i=0; i<children.size(); i++) {
			children[i]->Draw();
		}

		glPopMatrix();
	}
Beispiel #3
0
	/*
	=====================
	Layer::Layer
	=====================
	*/
	void Layer::Draw() {
		PrepareRT();

		glPushMatrix();

		if (immovable) {
			glLoadIdentity();
		}

		// Update position
		Vec2 fac = GameControl::GetSingleton()->GetCoordinateFactor();

		glTranslatef(position.x / fac.x, position.y / fac.y, 0.f);
		glRotatef(rotation, 0.f, 0.f, 1.f);

		fac = GameControl::GetSingleton()->GetWindowScale();
		glScalef(scale.x, scale.y, 1.f);

		OrderChildren();

		if (lightSys) {
			lightSys->UpdateShaderUniforms();
		}

		for (unsigned int i=0; i<children.size(); i++) {
			children[i]->Draw();
		}

		if (lightSys) {
			lightSys->RenderLightTexture();
		}

		glPopMatrix();

		RenderRT();
	}