Updated to Xcode 9 Beta
Fixed some warnings
This commit is contained in:
@@ -872,12 +872,11 @@ KRVector2 KRAudioManager::getNearestHRTFSample(const KRVector2 &dir)
|
||||
|
||||
KRVector2 min_direction;
|
||||
bool first = true;
|
||||
float min_distance;
|
||||
float min_distance = 360.0f;
|
||||
for(std::vector<KRVector2>::iterator itr = m_hrtf_sample_locations.begin(); itr != m_hrtf_sample_locations.end(); itr++) {
|
||||
if(first) {
|
||||
first = false;
|
||||
min_direction = (*itr);
|
||||
min_distance = 360.0f;
|
||||
} else if((*itr).x == elevation) {
|
||||
float distance = fabs(dir_deg.y - (*itr).y);
|
||||
if(min_distance > distance) {
|
||||
@@ -1014,7 +1013,7 @@ void KRAudioManager::getHRTFMix(const KRVector2 &dir, KRVector2 &dir1, KRVector2
|
||||
|
||||
void KRAudioManager::initAudio()
|
||||
{
|
||||
if(!m_initialized == NULL) {
|
||||
if(!m_initialized) {
|
||||
m_initialized = true;
|
||||
m_output_sample = KRENGINE_AUDIO_BLOCK_LENGTH;
|
||||
|
||||
@@ -1493,7 +1492,7 @@ void KRAudioManager::startFrame(float deltaTime)
|
||||
|
||||
|
||||
|
||||
if(source->getEnableOcclusion() && false) {
|
||||
if(source->getEnableOcclusion() && /* FINDME!! DISABLES CODE */ (false)) {
|
||||
KRHitInfo hitinfo;
|
||||
if(source->getScene().lineCast(m_listener_position, source_world_position, hitinfo, KRAKEN_COLLIDER_AUDIO)) {
|
||||
gain = 0.0f;
|
||||
|
||||
@@ -671,7 +671,7 @@ void KRCamera::renderPost()
|
||||
GLDEBUG(glDisable(GL_BLEND));
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static const GLfloat squareVerticesShadow[3][8] = {{
|
||||
-1.0f, -1.0f,
|
||||
-0.60f, -1.0f,
|
||||
@@ -688,6 +688,7 @@ void KRCamera::renderPost()
|
||||
0.00f, -0.60f,
|
||||
0.40f, -0.60f,
|
||||
}};
|
||||
*/
|
||||
|
||||
|
||||
GLDEBUG(glViewport(0, 0, m_viewport.getSize().x, m_viewport.getSize().y));
|
||||
@@ -793,7 +794,7 @@ void KRCamera::renderPost()
|
||||
float dScaleX = 2.0 / (1024 / 16);
|
||||
float dScaleY = 2.0 / (768 / 16);
|
||||
float dTexScale = 1.0 / 16.0;
|
||||
int iRow = row_count - 1; iCol = 0, iTab = 0;
|
||||
int iRow = row_count - 1; iCol = 0; iTab = 0;
|
||||
while(*pChar) {
|
||||
char c = *pChar++;
|
||||
if(c == '\n') {
|
||||
|
||||
@@ -44,11 +44,13 @@ int KRDirectionalLight::configureShadowBufferViewports(const KRViewport &viewpor
|
||||
const float KRENGINE_SHADOW_BOUNDS_EXTRA_SCALE = 1.25f; // Scale to apply to view frustrum bounds so that we don't need to refresh shadows on every frame
|
||||
int cShadows = 1;
|
||||
for(int iShadow=0; iShadow < cShadows; iShadow++) {
|
||||
/*
|
||||
GLfloat shadowMinDepths[3][3] = {{0.0f, 0.0f, 0.0f},{0.0f, 0.0f, 0.0f},{0.0f, 0.05f, 0.3f}};
|
||||
GLfloat shadowMaxDepths[3][3] = {{0.0f, 0.0f, 1.0f},{0.1f, 0.0f, 0.0f},{0.1f, 0.3f, 1.0f}};
|
||||
|
||||
float min_depth = 0.0f;
|
||||
float max_depth = 1.0f;
|
||||
*/
|
||||
|
||||
KRAABB worldSpacefrustrumSliceBounds = KRAABB(KRVector3(-1.0f, -1.0f, -1.0f), KRVector3(1.0f, 1.0f, 1.0f), KRMat4::Invert(viewport.getViewProjectionMatrix()));
|
||||
worldSpacefrustrumSliceBounds.scale(KRENGINE_SHADOW_BOUNDS_EXTRA_SCALE);
|
||||
|
||||
@@ -204,7 +204,7 @@ fprintf(stderr, "Error at line number %d, in file %s. alGetError() returned %i f
|
||||
OSStatus e = x; \
|
||||
if( e != noErr) \
|
||||
{ \
|
||||
fprintf(stderr, "Error at line number %d, in file %s. Returned %d for call %s\n",__LINE__, __FILE__, e, #x ); \
|
||||
fprintf(stderr, "Error at line number %d, in file %s. Returned %d for call %s\n",__LINE__, __FILE__, (int)e, #x ); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "KRMaterial.h"
|
||||
#include "KRTextureManager.h"
|
||||
|
||||
#include "KRcontext.h"
|
||||
#include "KRContext.h"
|
||||
|
||||
KRMaterial::KRMaterial(KRContext &context, const char *szName) : KRResource(context, szName) {
|
||||
m_name = szName;
|
||||
|
||||
@@ -1456,7 +1456,7 @@ void KRMesh::convertToIndexed()
|
||||
}
|
||||
}
|
||||
|
||||
delete szKey;
|
||||
delete[] szKey;
|
||||
|
||||
KRContext::Log(KRContext::LOG_LEVEL_INFORMATION, "Convert to indexed, before: %i after: %i (%.2f%% saving)", getHeader()->vertex_count, mi.vertices.size(), ((float)getHeader()->vertex_count - (float)mi.vertices.size()) / (float)getHeader()->vertex_count * 100.0f);
|
||||
|
||||
|
||||
@@ -66,32 +66,31 @@ long KRTexture::getReferencedMemSize() {
|
||||
void KRTexture::resize(int max_dim)
|
||||
{
|
||||
while(m_handle_lock.test_and_set()); // Spin lock
|
||||
{
|
||||
if(m_iHandle == m_iNewHandle) {
|
||||
if(max_dim == 0) {
|
||||
m_iNewHandle = 0;
|
||||
} else {
|
||||
int target_dim = max_dim;
|
||||
if(target_dim < m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
||||
|
||||
if(m_iHandle == m_iNewHandle) {
|
||||
if(max_dim == 0) {
|
||||
m_iNewHandle = 0;
|
||||
} else {
|
||||
int target_dim = max_dim;
|
||||
if(target_dim < m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
||||
|
||||
if(m_new_lod_max_dim != target_dim || (m_iHandle == 0 && m_iNewHandle == 0)) {
|
||||
assert(m_newTextureMemUsed == 0);
|
||||
m_newTextureMemUsed = getMemRequiredForSize(target_dim);
|
||||
|
||||
getContext().getTextureManager()->memoryChanged(m_newTextureMemUsed);
|
||||
getContext().getTextureManager()->addMemoryTransferredThisFrame(m_newTextureMemUsed);
|
||||
|
||||
if(!createGLTexture(target_dim)) {
|
||||
getContext().getTextureManager()->memoryChanged(-m_newTextureMemUsed);
|
||||
m_newTextureMemUsed = 0;
|
||||
assert(false); // Failed to create the texture
|
||||
}
|
||||
if(m_new_lod_max_dim != target_dim || (m_iHandle == 0 && m_iNewHandle == 0)) {
|
||||
assert(m_newTextureMemUsed == 0);
|
||||
m_newTextureMemUsed = getMemRequiredForSize(target_dim);
|
||||
|
||||
getContext().getTextureManager()->memoryChanged(m_newTextureMemUsed);
|
||||
getContext().getTextureManager()->addMemoryTransferredThisFrame(m_newTextureMemUsed);
|
||||
|
||||
if(!createGLTexture(target_dim)) {
|
||||
getContext().getTextureManager()->memoryChanged(-m_newTextureMemUsed);
|
||||
m_newTextureMemUsed = 0;
|
||||
assert(false); // Failed to create the texture
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_handle_lock.clear();
|
||||
}
|
||||
|
||||
m_handle_lock.clear();
|
||||
}
|
||||
|
||||
GLuint KRTexture::getHandle() {
|
||||
|
||||
@@ -148,6 +148,7 @@ KRTexture *KRTextureManager::getTextureCube(const char *szName) {
|
||||
if(itr == m_textures.end()) {
|
||||
|
||||
// Defer resolving the texture cube until its referenced textures are ready
|
||||
/*
|
||||
const GLenum TARGETS[6] = {
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
@@ -156,6 +157,7 @@ KRTexture *KRTextureManager::getTextureCube(const char *szName) {
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
};
|
||||
*/
|
||||
|
||||
const char *SUFFIXES[6] = {
|
||||
"_positive_x",
|
||||
|
||||
@@ -95,12 +95,14 @@ bool KRTextureTGA::uploadTexture(GLenum target, int lod_max_dim, int ¤t_lo
|
||||
m_pData->lock();
|
||||
TGA_HEADER *pHeader = (TGA_HEADER *)m_pData->getStart();
|
||||
unsigned char *pData = (unsigned char *)pHeader + (long)pHeader->idlength + (long)pHeader->colourmaplength * (long)pHeader->colourmaptype + sizeof(TGA_HEADER);
|
||||
|
||||
|
||||
/*
|
||||
#if TARGET_OS_IPHONE
|
||||
GLenum base_internal_format = GL_BGRA;
|
||||
#else
|
||||
GLenum base_internal_format = pHeader->bitsperpixel == 24 ? GL_BGR : GL_BGRA;
|
||||
#endif
|
||||
*/
|
||||
|
||||
GLenum internal_format = GL_RGBA;
|
||||
|
||||
@@ -115,8 +117,6 @@ bool KRTextureTGA::uploadTexture(GLenum target, int lod_max_dim, int ¤t_lo
|
||||
return false; // Mapped colors not supported
|
||||
}
|
||||
|
||||
GLenum err;
|
||||
|
||||
switch(pHeader->imagetype) {
|
||||
case 2: // rgb
|
||||
switch(pHeader->bitsperpixel) {
|
||||
|
||||
@@ -431,7 +431,9 @@ void KRVector3::setXMLAttribute(const std::string &base_name, tinyxml2::XMLEleme
|
||||
|
||||
void KRVector3::getXMLAttribute(const std::string &base_name, tinyxml2::XMLElement *e, const KRVector3 &default_value)
|
||||
{
|
||||
float new_x,new_y,new_z;
|
||||
float new_x = 0.0f;
|
||||
float new_y = 0.0f;
|
||||
float new_z = 0.0f;
|
||||
if(e->QueryFloatAttribute((base_name + "_x").c_str(), &new_x) == tinyxml2::XML_SUCCESS
|
||||
&& e->QueryFloatAttribute((base_name + "_y").c_str(), &new_y) == tinyxml2::XML_SUCCESS
|
||||
&& e->QueryFloatAttribute((base_name + "_z").c_str(), &new_z) == tinyxml2::XML_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user