Fixing warnings
This commit is contained in:
@@ -242,15 +242,14 @@ bool KRAABB::intersectsRay(const KRVector3 &v1, const KRVector3 &dir) const
|
||||
}
|
||||
|
||||
/* Ray v1 inside bounding box */
|
||||
if(inside) {
|
||||
if (inside) {
|
||||
coord = v1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Calculate T distances to candidate planes */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (quadrant[i] != MIDDLE && dir[i] !=0.) {
|
||||
if (quadrant[i] != MIDDLE && dir[i] != 0.0f) {
|
||||
maxT.c[i] = (candidatePlane[i]-v1.c[i]) / dir[i];
|
||||
} else {
|
||||
maxT.c[i] = -1.0f;
|
||||
@@ -266,13 +265,17 @@ bool KRAABB::intersectsRay(const KRVector3 &v1, const KRVector3 &dir) const
|
||||
}
|
||||
|
||||
/* Check final candidate actually inside box */
|
||||
if (maxT.c[whichPlane] < 0.0f) return false;
|
||||
if (maxT.c[whichPlane] < 0.0f) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (whichPlane != i) {
|
||||
coord[i] = v1.c[i] + maxT.c[whichPlane] *dir[i];
|
||||
if (coord[i] < min.c[i] || coord[i] > max.c[i])
|
||||
if (coord[i] < min.c[i] || coord[i] > max.c[i]) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
assert(quadrant[i] != MIDDLE); // This should not be possible
|
||||
coord[i] = candidatePlane[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ void KRCamera::renderFrame(GLint defaultFBO, GLint renderBufferWidth, GLint rend
|
||||
// ----====---- Record timing information for measuring FPS ----====----
|
||||
uint64_t current_time = m_pContext->getAbsoluteTimeMilliseconds();
|
||||
if(m_last_frame_start != 0) {
|
||||
m_frame_times[m_pContext->getCurrentFrame() % KRAKEN_FPS_AVERAGE_FRAME_COUNT] = (current_time - m_last_frame_start);
|
||||
m_frame_times[m_pContext->getCurrentFrame() % KRAKEN_FPS_AVERAGE_FRAME_COUNT] = (int)(current_time - m_last_frame_start);
|
||||
if(m_frame_times_filled < KRAKEN_FPS_AVERAGE_FRAME_COUNT) m_frame_times_filled++;
|
||||
}
|
||||
m_last_frame_start = current_time;
|
||||
@@ -914,9 +914,8 @@ std::string KRCamera::getDebugText()
|
||||
for(int i=0; i < KRAKEN_FPS_AVERAGE_FRAME_COUNT; i++) {
|
||||
fps += m_frame_times[i];
|
||||
}
|
||||
}
|
||||
|
||||
fps = 1000000 / (fps / KRAKEN_FPS_AVERAGE_FRAME_COUNT); // Order of division chosen to prevent overflow
|
||||
}
|
||||
|
||||
switch(settings.debug_display) {
|
||||
case KRRenderSettings::KRENGINE_DEBUG_DISPLAY_NONE: // ----====---- No debug display ----====----
|
||||
|
||||
@@ -351,13 +351,13 @@ void KRContext::getMemoryStats(long &free_memory)
|
||||
mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
|
||||
vm_size_t pagesize = 0;
|
||||
vm_statistics_data_t vm_stat;
|
||||
int total_ram = 256 * 1024 * 1024;
|
||||
// int total_ram = 256 * 1024 * 1024;
|
||||
if(host_page_size(host_port, &pagesize) != KERN_SUCCESS) {
|
||||
KRContext::Log(KRContext::LOG_LEVEL_ERROR, "Could not get VM page size.");
|
||||
} else if(host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {
|
||||
KRContext::Log(KRContext::LOG_LEVEL_ERROR, "Could not get VM stats.");
|
||||
} else {
|
||||
total_ram = (vm_stat.wire_count + vm_stat.active_count + vm_stat.inactive_count + vm_stat.free_count) * pagesize;
|
||||
// total_ram = (vm_stat.wire_count + vm_stat.active_count + vm_stat.inactive_count + vm_stat.free_count) * pagesize;
|
||||
|
||||
free_memory = (vm_stat.free_count + vm_stat.inactive_count) * pagesize;
|
||||
}
|
||||
|
||||
@@ -39,16 +39,22 @@ void KRLODSet::loadXML(tinyxml2::XMLElement *e)
|
||||
void KRLODSet::updateLODVisibility(const KRViewport &viewport)
|
||||
{
|
||||
if(m_lod_visible >= LOD_VISIBILITY_PRESTREAM) {
|
||||
/*
|
||||
// FINDME, TODO, HACK - Disabled streamer delayed LOD load due to performance issues:
|
||||
KRLODGroup *new_active_lod_group = NULL;
|
||||
*/
|
||||
|
||||
// Upgrade and downgrade LOD groups as needed
|
||||
for(std::set<KRNode *>::iterator itr=m_childNodes.begin(); itr != m_childNodes.end(); ++itr) {
|
||||
KRLODGroup *lod_group = dynamic_cast<KRLODGroup *>(*itr);
|
||||
assert(lod_group != NULL);
|
||||
LodVisibility group_lod_visibility = KRMIN(lod_group->calcLODVisibility(viewport), m_lod_visible);
|
||||
/*
|
||||
// FINDME, TODO, HACK - Disabled streamer delayed LOD load due to performance issues:
|
||||
if(group_lod_visibility == LOD_VISIBILITY_VISIBLE) {
|
||||
new_active_lod_group = lod_group;
|
||||
}
|
||||
*/
|
||||
lod_group->setLODVisibility(group_lod_visibility);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ std::vector<KRResource *> KRResource::LoadObj(KRContext &context, const std::str
|
||||
|
||||
// -----=====----- Populate vertexes and faces -----=====-----
|
||||
|
||||
int *pFaces = (int *)malloc(sizeof(int *) * (cFaces + 1));
|
||||
int *pFaces = (int *)malloc(sizeof(int) * (cFaces + 1));
|
||||
assert(pFaces != NULL);
|
||||
|
||||
std::vector<KRVector3> indexed_vertices;
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
#endif
|
||||
|
||||
GLDEBUG(glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer));
|
||||
BOOL success = [self.context presentRenderbuffer:GL_RENDERBUFFER];
|
||||
[self.context presentRenderbuffer:GL_RENDERBUFFER];
|
||||
|
||||
if (self.delegate && delegateRespondsTo.postRender) {
|
||||
[self.delegate postRender:context withDeltaTime:deltaTime];
|
||||
|
||||
Reference in New Issue
Block a user