void Mesh_D3D11::Draw(void) { #if 0 // Set vertex buffer unsigned int iOffset = 0; GetApp()->GetContext()->IASetVertexBuffers(0, 1, &m_pVertexBuffer, &m_iVertexSize, &iOffset); // Set index buffer GetApp()->GetContext()->IASetIndexBuffer(m_pIndexBuffer, DXGI_FORMAT_R16_UINT, 0); // Set primitive topology GetApp()->GetContext()->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); // Set the input layout GetApp()->GetContext()->IASetInputLayout(m_pVertexLayout); // Draw GetApp()->GetContext()->DrawIndexed(m_iNumTris * 3, 0, 0); #endif noMat4 tm(worldTM_.rotate_ * worldTM_.scale_, worldTM_.trans_); tm.TransposeSelf(); GetApp()->drawModel(m_rd, ToMat4(tm), ViewMat(), ProjMat()); g_iTrisPerFrame += m_iNumTris; }
void StaticModelEntity::UpdateDerivedValues() { m_transform.orientation.Normalize(); m_model.m_localToWorld = m_transform.ToMat4(); rxAABB_Transform( &m_worldAABB, m_model.m_localAABB, m_transform ); }
int InterAreaPortal::CheckVisible( BaseCamera* c ) { noFrustum f; noMat4 view(c->getViewMatrix()); noMat4 proj(c->getProjectionMatrix()); f.loadFrustum(ToMat4(view) * ToMat4(proj)); int num_points = m_points.size(); int i; Plane p; // check front plane. bool all_front = true; bool all_back = true; for(i=0; i<num_points; ++i) { p = f.getPlane(FRUSTUM_NEAR); vec3 point(m_points[i].ToFloatPtr()); if (p.dist(point) > 0) all_front = false; else { all_back = false; } } if(all_back) { return 0; } for (int j = FRUSTUM_LEFT; j < FRUSTUM_FAR; j++) { bool all_back = true; for(i=0; i < num_points; ++i) { p = f.getPlane(j); vec3 point(m_points[i].ToFloatPtr()); if (p.dist(point) > 0) { all_back = false; break; } } if(all_back) { return 0; } } return (all_front?1:-1); }