Added debugging macro for GL calls

Activated octree culling logic as a default
Wide spread bug fixes related to occlusion culling and GPU resource management
Implemented logic to automatically enable alpha blending for materials that do not contain an alpha blending statement but have a material-level opacity value set less than 1.0
Extended the krobject file format to 256 characters for material names.
Added logic to prevent exported krobject files from being corrupted when long material names are used.

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4096
This commit is contained in:
kearwood
2012-09-13 20:09:19 +00:00
parent 763e8b8fe7
commit 917c4221ea
33 changed files with 659 additions and 585 deletions

View File

@@ -35,8 +35,7 @@
#import "KRMesh.h"
#include <assert.h>
KRInstance::KRInstance(KRScene &scene, std::string instance_name, std::string model_name, const KRMat4 modelMatrix, std::string light_map) : KRNode(scene, instance_name) {
m_modelMatrix = modelMatrix;
KRInstance::KRInstance(KRScene &scene, std::string instance_name, std::string model_name, std::string light_map) : KRNode(scene, instance_name) {
m_lightMap = light_map;
m_pLightMap = NULL;
m_pModel = NULL;
@@ -61,6 +60,7 @@ tinyxml2::XMLElement *KRInstance::saveXML( tinyxml2::XMLNode *parent)
KRMat4 &KRInstance::getModelMatrix() {
calcModelMatrix();
return m_modelMatrix;
}
@@ -76,6 +76,8 @@ void KRInstance::loadModel() {
void KRInstance::render(KRCamera *pCamera, KRContext *pContext, KRBoundingVolume &frustrumVolume, KRMat4 &viewMatrix, KRVector3 &cameraPosition, KRVector3 &lightDirection, KRMat4 *pShadowMatrices, GLuint *shadowDepthTextures, int cShadowBuffers, KRNode::RenderPass renderPass) {
calcModelMatrix();
KRNode::render(pCamera, pContext, frustrumVolume, viewMatrix, cameraPosition, lightDirection, pShadowMatrices, shadowDepthTextures, cShadowBuffers, renderPass);
if(renderPass != KRNode::RENDER_PASS_DEFERRED_LIGHTS && (renderPass != KRNode::RENDER_PASS_FORWARD_TRANSPARENT || this->hasTransparency()) && renderPass != KRNode::RENDER_PASS_FLARES) {
@@ -119,6 +121,8 @@ void KRInstance::render(KRCamera *pCamera, KRContext *pContext, KRBoundingVolume
void KRInstance::calcExtents(KRContext *pContext)
{
calcModelMatrix();
KRNode::calcExtents(pContext);
loadModel();
KRMesh *pMesh = m_pModel->getMesh();
@@ -139,6 +143,7 @@ bool KRInstance::hasTransparency() {
}
KRAABB KRInstance::getBounds() {
calcModelMatrix();
loadModel();
KRMesh *pMesh = m_pModel->getMesh();
@@ -182,3 +187,13 @@ KRAABB KRInstance::getBounds() {
return KRAABB(min, max);
}
void KRInstance::calcModelMatrix()
{
m_modelMatrix = KRMat4();
// m_modelMatrix.scale(m_localScale);
// m_modelMatrix.rotate(m_localRotation.x, X_AXIS);
// m_modelMatrix.rotate(m_localRotation.y, Y_AXIS);
// m_modelMatrix.rotate(m_localRotation.z, Z_AXIS);
// m_modelMatrix.translate(m_localTranslation);
}