Exemplo n.º 1
0
void BoxCollider::DebugDraw(Matrix view, Matrix projection)
{
	m_DebugMaterial->SetFloat4x4("view", view);
	m_DebugMaterial->SetFloat4x4("projection", projection);

	SetModelMatrix(p_Transform->GetWorldMatrix());

	float scale = m_HalfWidth.x;
	if (m_HalfWidth.y > scale)
		scale = m_HalfWidth.y;
	if (m_HalfWidth.z > scale)
		scale = m_HalfWidth.z;

	m_DebugMaterial->SetFloat4x4("model", Matrix::CreateScale(scale * 1.2f) *
		Matrix::CreateTranslation(m_OCenter));

	m_DebugMaterial->Bind();
	m_DebugOuterMesh->Draw();

	m_DebugMaterial->SetFloat4x4("model", Matrix::CreateFromQuaternion(p_Transform->GetWorldRotation()) *
		Matrix::CreateScale(m_HalfWidth) *
		Matrix::CreateTranslation(p_Transform->GetWorldPosition()));

	m_DebugMesh->Draw();

	m_DebugMaterial->SetColor("tint", Color::Green);
}
Exemplo n.º 2
0
void HexMapTest::SetRotation(float deltaRotation)
{
	rotation = rotation_initial + deltaRotation;
	while (rotation >= 360.0f)
		rotation -= 360.0f;
	while (rotation < 0.0f)
		rotation += 360.0f;
	SetModelMatrix();
}
void proRenderBuffer::OnRenderPass(eRenderPass renderPass, tRenderToken *pToken)
{
	SetModelMatrix(renderPass, pToken->m_renderMat);

	if(pToken->m_pShaderChain && pToken->m_pVertBuff)
	{
		pToken->m_pShaderChain->AddVertHeader(pToken->m_pVertBuff->GetHeader());
		pToken->m_pShaderChain->Set(pToken->m_pVertBuff->GetHeader(), pToken->m_pVertBuff, pToken->m_pShdVarStore, pToken->m_pTextureChain);
	}

	//HACK to set the shadow texture
	proITex *pTex = proRenderBuffer::Instance()->GetLight(proRenderBuffer::kLightSlot_Global).m_pShadowBuffer;
	pToken->m_pShaderChain->SetTex(pTex, proRenderBuffer::kTexture_Shadow);

	if(pToken->m_pTextureChain && pToken->m_pShaderChain)
	{
		//this will set the textures to each of the shader programs
		pToken->m_pTextureChain->PushTexChain(pToken->m_pShaderChain);
	}

	if(pToken->m_pVertBuff)
	{
		pToken->m_pVertBuff->Render();
	}

	if(pToken->m_pShaderChain && pToken->m_pVertBuff)
	{
		if(pToken->m_minVertBound == 0 && pToken->m_maxVertBound == 0)
		{
			if(pToken->m_pVertBuff->IsIndexed())
			{
				pToken->m_pShaderChain->Use(pToken->m_pVertBuff->GetIndexCount(), 0, TRUE);
			}
			else
			{
				pToken->m_pShaderChain->Use(pToken->m_pVertBuff->GetPrimitiveCount());
			}
		}
		else
		{
			pToken->m_pShaderChain->Use(pToken->m_maxVertBound-pToken->m_minVertBound, pToken->m_minVertBound);
		}
	}

	if(pToken->m_pVertBuff)
	{
		pToken->m_pVertBuff->PostRender();
	}
}
Exemplo n.º 4
0
void HexMapTest::SetZoom(float deltaZoom, int multiplier)
{
	if (deltaZoom >= 1)
		deltaZoom = (deltaZoom-1)*multiplier+1;
	else
		deltaZoom = (deltaZoom-1)+1;
	if (multiplier != 1 && deltaZoom > float(multiplier))
		deltaZoom = float(multiplier);
	if (multiplier != 1 && deltaZoom < 1.0f/multiplier)
		deltaZoom = 1.0f/multiplier;
	zoom = zoom_initial * deltaZoom;
	screenTranslationX = int16(screenTranslationX_initial*zoom/zoom_initial);
	screenTranslationY = int16(screenTranslationY_initial*zoom/zoom_initial);
	SetModelMatrix();
}
Exemplo n.º 5
0
void HexMapTest::SetTranslation()
{
	int16 sprite1_pos_x,sprite1_pos_y,sprite1_pos_x_initial,sprite1_pos_y_initial;
	if (g_Input.finger1MovedTo(sprite1_pos_x, sprite1_pos_y)) {
		g_Input.finger1Initial(sprite1_pos_x_initial, sprite1_pos_y_initial);
	}
	iwfixed sinTheta = IwGeomSin(IW_ANGLE_FROM_DEGREES(rotation));
	iwfixed cosTheta = IwGeomCos(IW_ANGLE_FROM_DEGREES(rotation));

	int odx = sprite1_pos_x_initial - sprite1_pos_x;
	int ody = sprite1_pos_y_initial - sprite1_pos_y;

	int dx = (IW_FIXED_MUL(odx, cosTheta) - IW_FIXED_MUL(ody, sinTheta));
	int dy = (IW_FIXED_MUL(odx, sinTheta) + IW_FIXED_MUL(ody, cosTheta));

	screenTranslationX = screenTranslationX_initial + dx;
	screenTranslationY = screenTranslationY_initial + dy;
	SetModelMatrix();
}
Exemplo n.º 6
0
//--- Non Standard Singleton Methods
void MyBOManager::AddObject(String a_sName)
{
	std::vector<vector3> lVertex = m_pMeshMngr->GetVertexList(a_sName);
	AddObject(lVertex, a_sName);
	SetModelMatrix(m_pMeshMngr->GetModelMatrix(a_sName), a_sName);
}
Exemplo n.º 7
0
 Camera::Camera() : m_Orientation(ObjQuat(cos(M_PI/6), sin(M_PI/6), 0.0f, 0.0f)) {
      m_Position = ObjPos(0.0f, 0.0f, 0.0f);
      SetModelMatrix();
 };