Camera2::Camera2(
	glm::vec3& position,
	glm::vec3& target,
	glm::vec3& up,
	GLfloat near,
	GLfloat far,
	GLfloat fieldOfView,
	const char* cameraName)
	: m_vCameraPosition(position),
	m_vCameraDirection(target),
	m_vCameraUp(up),
	m_fNearClippingPlane(near),
	m_fFarClippingPlane(far),
	m_fFOV(fieldOfView)
{
	m_bFirstUpdate = true;

	m_fYaw = -90.0f;
	m_fPitch = 0.0f;

	CameraName = new char[strlen(cameraName) + 1];
	strcpy_s(CameraName, strlen(cameraName) + 1, cameraName);

	LoadIndentity();
	SetProjection(m_fFOV, WINDOW_WIDTH, WINDOW_HEIGHT, m_fNearClippingPlane, m_fFarClippingPlane);
	SetOrthoProjection(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
}
Example #2
0
void GPC_Canvas::DrawAllBanners(void)
{
	if(!m_bannersEnabled || (m_banners.size() < 1))
		return;
	
	// Save the old rendering parameters.

	CanvasRenderState render_state;
	PushRenderState(render_state);

	// Set up everything for banner display.
	
	// Set up OpenGL matrices 
	SetOrthoProjection();
	// Activate OpenGL settings needed for display of the texture
	::glDisable(GL_LIGHTING);
	::glDisable(GL_DEPTH_TEST);
	::glDisable(GL_FOG);
	::glEnable(GL_TEXTURE_2D);
	::glEnable(GL_BLEND);
	::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	TBannerMap::iterator it = m_banners.begin();
	while (it != m_banners.end()) {
		if (it->second.enabled) {
			DrawBanner(it->second);
		}
		it++;
	}

	PopRenderState(render_state);
}
//***Default camera***
// Position 0.0f, 0.0f, 0.0f
// Target   1.0f, 0.0f, 1.0f
// Up		0.0f, 1.0f, 0.0f
// NearClip 0.1f
// FarClip  3000.0f
// WindowWidth Default
// WindowHeight Default
Camera2::Camera2(const char* cameraName)
	: m_vCameraPosition(0.0f, 0.0f, 50.0f),
	m_vCameraDirection(0.0f, 0.0f, -1.0f),
	m_vCameraUp(0.0f, 1.0f, 0.0f),
	m_fNearClippingPlane(0.1f),
	m_fFarClippingPlane(3000.0f),
	m_fFOV(45.0f)
{
	m_bFirstUpdate = true;

	m_fYaw = -90.0f;
	m_fPitch = 0.0f;

	CameraName = new char[strlen(cameraName) + 1];
	strcpy_s(CameraName, strlen(cameraName) + 1, cameraName);

	LoadIndentity();
	SetProjection(m_fFOV, WINDOW_WIDTH, WINDOW_HEIGHT, m_fNearClippingPlane, m_fFarClippingPlane);
	SetOrthoProjection(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
}