fix a shitton of warnings

This commit is contained in:
learn_more 2013-09-20 23:03:32 +02:00
parent dab2476020
commit d41b91631f
19 changed files with 91 additions and 90 deletions

View File

@ -203,7 +203,7 @@ namespace spades {
al::qalSourcefv(handle, AL_POSITION, pos);
al::qalSourcefv(handle, AL_VELOCITY, vel);
al::qalSourcei(handle, AL_SOURCE_RELATIVE, local ? AL_TRUE:AL_FALSE);
al::qalSourcei(handle, AL_ROLLOFF_FACTOR, (local || stereo) ? 0.f : 1.f);
al::qalSourcef(handle, AL_ROLLOFF_FACTOR, (local || stereo) ? 0.f : 1.f);
if(internal->useEAX){
al::qalSource3i(handle, AL_AUXILIARY_SEND_FILTER,
internal->reverbFXSlot, 0, AL_FILTER_NULL);
@ -220,7 +220,7 @@ namespace spades {
al::qalSourcefv(handle, AL_POSITION, pos);
al::qalSourcefv(handle, AL_VELOCITY, vel);
al::qalSourcei(handle, AL_SOURCE_RELATIVE, AL_TRUE);
al::qalSourcei(handle, AL_ROLLOFF_FACTOR, 0.f);
al::qalSourcef(handle, AL_ROLLOFF_FACTOR, 0.f);
if(internal->useEAX){
al::qalSource3i(handle, AL_AUXILIARY_SEND_FILTER,
AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL);
@ -569,7 +569,7 @@ namespace spades {
}
// monte-carlo integration
int rayHitCount = 0;
unsigned int rayHitCount = 0;
roomVolume = 0.f;
roomArea = 0.f;
roomSize = 0.f;

View File

@ -403,7 +403,7 @@ namespace spades {
logStream = FileManager::OpenForWriting(fn2.c_str());
SPLog("Netlog Started at '%s'", fn2.c_str());
}catch(const std::exception& ex){
SPLog("Failed to open netlog file '%s'", fn2.c_str());
SPLog("Failed to open netlog file '%s' (%s)", fn2.c_str(), ex.what());
}
}
@ -702,7 +702,7 @@ namespace spades {
hurtSprites.resize(std::max(cnt, 6));
for(size_t i = 0; i < hurtSprites.size(); i++) {
HurtSprite& spr = hurtSprites[i];
spr.angle = GetRandom() * (2.f * M_PI);
spr.angle = GetRandom() * (2.f * static_cast<float>(M_PI));
spr.scale = .2f + GetRandom() * GetRandom() * .7f;
spr.horzShift = GetRandom();
spr.strength = .3f + GetRandom() * .7f;
@ -882,9 +882,9 @@ namespace spades {
}
followYaw -= x * 0.003f;
followPitch -= y * 0.003f;
if(followPitch < -M_PI*.45f) followPitch = -M_PI*.45f;
if(followPitch > M_PI*.45f) followPitch = M_PI * .45f;
followYaw = fmodf(followYaw, M_PI*2.f);
if(followPitch < -static_cast<float>(M_PI)*.45f) followPitch = -static_cast<float>(M_PI)*.45f;
if(followPitch > static_cast<float>(M_PI)*.45f) followPitch = static_cast<float>(M_PI) * .45f;
followYaw = fmodf(followYaw, static_cast<float>(M_PI)*2.f);
}else if(world && world->GetLocalPlayer()){
Player *p = world->GetLocalPlayer();
if(p->IsAlive()){
@ -1497,7 +1497,7 @@ namespace spades {
def.viewAxis[2] = front;
def.fovY = (float)cg_fov * M_PI /180.f;
def.fovY = (float)cg_fov * static_cast<float>(M_PI) /180.f;
def.fovX = atanf(tanf(def.fovY * .5f) *
renderer->ScreenWidth() /
renderer->ScreenHeight()) * 2.f;
@ -1524,7 +1524,7 @@ namespace spades {
def.viewAxis[1] = -Vector3::Cross(front, def.viewAxis[0]).Normalize();
def.viewAxis[2] = front;
def.fovY = (float)cg_fov * M_PI /180.f;
def.fovY = (float)cg_fov * static_cast<float>(M_PI) /180.f;
def.fovX = atanf(tanf(def.fovY * .5f) *
renderer->ScreenWidth() /
renderer->ScreenHeight()) * 2.f;
@ -1544,14 +1544,14 @@ namespace spades {
scale += nextRandom() * 0.04f * localFireVibration;
vibPitch += localFireVibration * (1.f - localFireVibration) * 0.01f;
vibYaw += sinf(localFireVibration * (float)M_PI * 2.f) * 0.001f;
vibYaw += sinf(localFireVibration * static_cast<float>(M_PI) * 2.f) * 0.001f;
// sprint bob
{
float sp = SmoothStep(sprintState);
vibYaw += sinf(player->GetWalkAnimationProgress() * M_PI * 2.f) * 0.01f * sp;
roll -= sinf(player->GetWalkAnimationProgress() * M_PI * 2.f) * 0.005f * (sp);
float p = cosf(player->GetWalkAnimationProgress() * M_PI * 2.f);
vibYaw += sinf(player->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f) * 0.01f * sp;
roll -= sinf(player->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f) * 0.005f * (sp);
float p = cosf(player->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f);
p = p * p; p *= p; p *= p; p *= p;
vibPitch += p * 0.01f * sp;
}
@ -1565,7 +1565,7 @@ namespace spades {
def.viewAxis[1] = up;
def.viewAxis[2] = front;
def.fovY = (float)cg_fov * M_PI /180.f;
def.fovY = (float)cg_fov * static_cast<float>(M_PI) /180.f;
def.fovX = atanf(tanf(def.fovY * .5f) *
renderer->ScreenWidth() /
renderer->ScreenHeight()) * 2.f;
@ -1643,7 +1643,7 @@ namespace spades {
def.viewAxis[1] = MakeVector3(0, 1, 0);
def.viewAxis[2] = MakeVector3(0, 0, 1);
def.fovY = (float)cg_fov * M_PI /180.f;
def.fovY = (float)cg_fov * static_cast<float>(M_PI) /180.f;
def.fovX = atanf(tanf(def.fovY * .5f) *
renderer->ScreenWidth() /
renderer->ScreenHeight()) * 2.f;
@ -1660,7 +1660,7 @@ namespace spades {
def.viewAxis[1] = MakeVector3(0, 0, -1);
def.viewAxis[2] = MakeVector3(0, 0, 1);
def.fovY = (float)cg_fov * M_PI /180.f;
def.fovY = (float)cg_fov * static_cast<float>(M_PI) /180.f;
def.fovX = atanf(tanf(def.fovY * .5f) *
renderer->ScreenWidth() /
renderer->ScreenHeight()) * 2.f;
@ -1779,7 +1779,7 @@ namespace spades {
light.color = MakeVector3(1, .7f, .5f) * 1.5f * brightness;
light.radius = 40.f;
light.type = DynamicLightTypeSpotlight;
light.spotAngle = 30.f * M_PI / 180.f;
light.spotAngle = 30.f * static_cast<float>(M_PI) / 180.f;
light.spotAxis[0] = p->GetRight();
light.spotAxis[1] = p->GetUp();
light.spotAxis[2] = p->GetFront();
@ -1816,8 +1816,8 @@ namespace spades {
float sp = 1.f - aimDownState;
sp *= .3f;
sp *= std::min(1.f, p->GetVelocty().GetLength() * 5.f);
viewWeaponOffset.x += sinf(p->GetWalkAnimationProgress() * M_PI * 2.f) * 0.01f * sp;
float vl = cosf(p->GetWalkAnimationProgress() * M_PI * 2.f);
viewWeaponOffset.x += sinf(p->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f) * 0.01f * sp;
float vl = cosf(p->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f);
vl *= vl;
viewWeaponOffset.z += vl * 0.012f * sp;
}
@ -1970,7 +1970,7 @@ namespace spades {
mat = Matrix4::Translate(MakeVector3(0.1f, -0.4f, -0.05f) * sprint) * mat;
}
mat = Matrix4::Translate(-0.3f - side * .8f,
.8 - bring * .1f,
.8f - bring * .1f,
0.45f - bring * .15f) * mat;
@ -2049,7 +2049,7 @@ namespace spades {
.5f,
0.2f - weapUp) * mat;
mat = Matrix4::Translate(viewWeaponOffset * motion) * mat;
mat = Matrix4::Translate(sinf(vib*M_PI*2.f)*0.008f * motion,
mat = Matrix4::Translate(sinf(vib*static_cast<float>(M_PI)*2.f)*0.008f * motion,
vib*(vib-1.f)*0.14f * motion,
vib*(1.f-vib)*0.03f * motion) * mat;
bool reloading = p->GetWeapon()->IsReloading();
@ -2401,7 +2401,7 @@ namespace spades {
col.y/255.f,
col.z/255.f);
float yaw = atan2(front.y, front.x) + M_PI * .5f;
float yaw = atan2(front.y, front.x) + static_cast<float>(M_PI) * .5f;
float pitch = -atan2(front.z, sqrt(front.x * front.x + front.y * front.y));
// lower axis
@ -2420,7 +2420,7 @@ namespace spades {
Matrix4 leg1 = Matrix4::Translate(-0.25f, 0.2f, -0.1f);
Matrix4 leg2 = Matrix4::Translate( 0.25f, 0.2f, -0.1f);
float ang = sinf(p->GetWalkAnimationProgress() * M_PI * 2.f) * 0.6f;
float ang = sinf(p->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f) * 0.6f;
float walkVel = Vector3::Dot(p->GetVelocty(), p->GetFront2D()) * 4.f;
leg1 = leg1 * Matrix4::Rotate(MakeVector3(1,0,0),
ang * walkVel);
@ -2460,7 +2460,7 @@ namespace spades {
Matrix4 leg1 = Matrix4::Translate(-0.25f, 0.f, -0.1f);
Matrix4 leg2 = Matrix4::Translate( 0.25f, 0.f, -0.1f);
float ang = sinf(p->GetWalkAnimationProgress() * M_PI * 2.f) * 0.6f;
float ang = sinf(p->GetWalkAnimationProgress() * static_cast<float>(M_PI) * 2.f) * 0.6f;
float walkVel = Vector3::Dot(p->GetVelocty(), p->GetFront2D()) * 4.f;
leg1 = leg1 * Matrix4::Rotate(MakeVector3(1,0,0),
ang * walkVel);
@ -2801,7 +2801,7 @@ namespace spades {
}
Vector4 color = {1,1,1,1};
if(blocks.size() > (int)p->GetNumBlocks())
if(blocks.size() > (unsigned int)p->GetNumBlocks())
color = MakeVector4(1,0,0,1);
for(size_t i = 0; i < blocks.size(); i++){
@ -3174,7 +3174,7 @@ namespace spades {
if(clip >= i + 1){
renderer->SetColor(MakeVector4(1,1,1,1));
}else{
renderer->SetColor(MakeVector4(0.4,0.4,0.4,1));
renderer->SetColor(MakeVector4(0.4f,0.4f,0.4f,1));
}
renderer->DrawImage(ammoIcon,
@ -3419,14 +3419,14 @@ namespace spades {
// background
Handle<IImage> img;
float bgSize = std::max(scrWidth, scrHeight);
renderer->SetColor(MakeVector4(1, 1, 1, .4 * fade));
renderer->SetColor(MakeVector4(1, 1, 1, .4f * fade));
img = renderer->RegisterImage("Gfx/CircleGradient.png");
renderer->DrawImage(img, AABB2((scrWidth - bgSize) * .5f,
(scrHeight - bgSize) * .5f,
bgSize, bgSize));
renderer->SetColor(MakeVector4(.1, .1, .1, .8 * fade));
renderer->SetColor(MakeVector4(.1f, .1f, .1f, .8f * fade));
img = renderer->RegisterImage("Gfx/White.tga");
renderer->DrawImage(img, AABB2(0,0,scrWidth,scrHeight));
@ -3445,7 +3445,7 @@ namespace spades {
renderer->DrawImage(img, MakeVector2(wndX, wndY));
renderer->SetColor(MakeVector4(1, 1, 1, .2 * fade));
renderer->SetColor(MakeVector4(1, 1, 1, .2f * fade));
img = renderer->RegisterImage("Gfx/LoadingWindowGlow.png");
renderer->DrawImage(img, AABB2((scrWidth - 512.f) * .5f,
@ -3875,7 +3875,7 @@ namespace spades {
// fragments
Handle<IImage> img = renderer->RegisterImage("Gfx/White.tga");
color = MakeVector4(0.01, 0.03, 0, 1.f);
color = MakeVector4(0.01f, 0.03f, 0, 1.f);
for(int i = 0; i < 42; i++){
ParticleSpriteEntity *ent =
new ParticleSpriteEntity(this, img, color);
@ -4691,7 +4691,7 @@ namespace spades {
Vector3 v = -victim->GetFront();
followYaw = atan2(v.y, v.x);
followPitch = 30.f * M_PI /180.f;
followPitch = 30.f * static_cast<float>(M_PI) /180.f;
}
// emit blood (also for local player)

View File

@ -192,8 +192,8 @@ namespace spades {
std::list<Corpse *> corpses;
Corpse *lastMyCorpse;
float corpseSoftTimeLimit;
int corpseSoftLimit;
int corpseHardLimit;
unsigned int corpseSoftLimit;
unsigned int corpseHardLimit;
int nextScreenShotIndex;

View File

@ -45,7 +45,7 @@ namespace spades {
bool crouch = p->GetInput().crouch;
Vector3 front = p->GetFront();
float yaw = atan2(front.y, front.x) + M_PI * .5f;
float yaw = atan2(front.y, front.x) + static_cast<float>(M_PI) * .5f;
//float pitch = -atan2(front.z, sqrt(front.x * front.x + front.y * front.y));
// lower axis
@ -56,8 +56,8 @@ namespace spades {
Matrix4 torso;
if(crouch){
lower = lower * Matrix4::Translate(0, 0, -0.4);
torso = lower * Matrix4::Translate(0, 0, -0.3);
lower = lower * Matrix4::Translate(0, 0, -0.4f);
torso = lower * Matrix4::Translate(0, 0, -0.3f);
SetNode(Torso1,
torso*MakeVector3(0.4f, -.15f, 0.1f));
@ -189,7 +189,7 @@ namespace spades {
static float MyACos(float v){
SPAssert(!isnan(v));
if(v >= 1.f) return 0.f;
if(v <= -1.f) return M_PI;
if(v <= -1.f) return static_cast<float>(M_PI);
float vv = acosf(v);
if(isnan(vv)){
vv = acosf(v * .9999f);

View File

@ -194,7 +194,7 @@ namespace spades{
Vector2 pos;
pos.x = left + 10.f;
pos.y = top + 10.f;
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4));
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4f));
font->Draw(msg, pos, 1.f, MakeVector4(1, 1, 1, 1));
}
if(selectedTeam != 2){
@ -202,7 +202,7 @@ namespace spades{
Vector2 pos;
pos.x = left + 260.f;
pos.y = top + 10.f;
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4));
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4f));
font->Draw(msg, pos, 1.f, MakeVector4(1, 1, 1, 1));
}
@ -227,7 +227,7 @@ namespace spades{
selected = false;
}
Vector4 fillColor = {0.2, 0.2, 0.2, 0.5};
Vector4 fillColor = {0.2f, 0.2f, 0.2f, 0.5f};
Vector4 ringColor = {0, 0, 0, 0};
if(item.hover){
@ -248,7 +248,7 @@ namespace spades{
Vector2 pos;
pos.x = item.rect.GetMinX() + (item.rect.GetWidth() - size.x) / 2.f + 2.f;
pos.y = item.rect.GetMinY() + (item.rect.GetHeight() - size.y) / 2.f + 2.f;
bFont->Draw(msg, pos + MakeVector2(0, 2), 1.f, MakeVector4(0,0,0,0.4));
bFont->Draw(msg, pos + MakeVector2(0, 2), 1.f, MakeVector4(0,0,0,0.4f));
bFont->Draw(msg, pos, 1.f, MakeVector4(1, 1, 1, 1));
}else{
renderer->DrawImage(menuItemImage, item.rect);
@ -262,7 +262,7 @@ namespace spades{
Vector2 pos;
pos.x = item.rect.GetMinX() + 5.f;
pos.y = item.rect.GetMinY() + (item.rect.GetHeight() - size.y) / 2.f + 2.f;
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4));
font->Draw(msg, pos + MakeVector2(0, 1), 1.f, MakeVector4(0,0,0,0.4f));
font->Draw(msg, pos, 1.f, MakeVector4(1, 1, 1, 1));
}
}

View File

@ -293,7 +293,7 @@ namespace spades {
// draw grid
renderer->SetColor(MakeVector4(0,0,0,0.8*alpha));
renderer->SetColor(MakeVector4(0,0,0,0.8f*alpha));
Handle<IImage> dashLine = renderer->RegisterImage("Gfx/DashLine.tga");
for(float x = 64.f; x < map->Width(); x += 64.f){
float wx = (x - inRect.GetMinX()) / inRect.GetWidth();
@ -317,7 +317,7 @@ namespace spades {
}
// draw grid label
renderer->SetColor(MakeVector4(1,1,1,0.8*alpha));
renderer->SetColor(MakeVector4(1,1,1,0.8f*alpha));
Handle<IImage> mapFont = renderer->RegisterImage("Gfx/Fonts/MapFont.tga");
for(int i = 0; i < 8; i++){
float startX = (float)i * 64.f;
@ -337,8 +337,8 @@ namespace spades {
wx = (wx * outRect.GetWidth()) + outRect.GetMinX();
wx = roundf(wx);
int fntX = (i & 3) * 8;
int fntY = (i >> 2) * 8;
float fntX = static_cast<float>((i & 3) * 8);
float fntY = static_cast<float>((i >> 2) * 8);
renderer->DrawImage(mapFont,
MakeVector2(wx - 4.f, outRect.GetMinY() + 4),
AABB2(fntX, fntY, 8, 8));
@ -386,7 +386,7 @@ namespace spades {
Vector3 front = p->GetFront2D();
float ang = atan2(front.x, -front.y);
if(player->GetTeamId() >= 2){
ang = client->followYaw - M_PI*.5f;
ang = client->followYaw - static_cast<float>(M_PI) * .5f;
}
if(p == world->GetLocalPlayer())

View File

@ -1116,8 +1116,8 @@ namespace spades {
mode->SetCaptureLimit(reader.ReadByte());
int intelFlags = reader.ReadByte();
mt1.hasIntel = (intelFlags & 1);
mt2.hasIntel = (intelFlags & 2);
mt1.hasIntel = (intelFlags & 1) != 0;
mt2.hasIntel = (intelFlags & 2) != 0;
if(mt2.hasIntel){
mt1.carrier = reader.ReadByte();

View File

@ -161,8 +161,8 @@ namespace spades {
float scrW = renderer->ScreenWidth();
float scrH = renderer->ScreenHeight();
for(int phase = 0; phase < 2; phase++){
for(int i = 0; i < colors.size(); i++){
for(size_t phase = 0; phase < 2; phase++){
for(size_t i = 0; i < colors.size(); i++){
if((sel == i) != (phase == 1))
continue;

View File

@ -169,7 +169,7 @@ namespace spades {
IsBlockCursorDragging()){
std::vector<IntVector3> blocks = GetWorld()->CubeLine(blockCursorDragPos,
blockCursorPos, 256);
if(blocks.size() <= (int)blockStocks){
if((int)blocks.size() <= blockStocks){
if(GetWorld()->GetListener() &&
this == world->GetLocalPlayer())
GetWorld()->GetListener()->LocalPlayerCreatedLineBlock(blockCursorDragPos, blockCursorPos);
@ -311,10 +311,10 @@ namespace spades {
lng += longitude;
lat += latitude;
if(lat < -M_PI * .49f)
lat = -M_PI * .49f;
if(lat > M_PI * .49f)
lat = M_PI * .49f;
if(lat < -static_cast<float>(M_PI) * .49f)
lat = -static_cast<float>(M_PI) * .49f;
if(lat > static_cast<float>(M_PI) * .49f)
lat = static_cast<float>(M_PI) * .49f;
o.x = cosf(lng) * cosf(lat);
o.y = sinf(lng) * cosf(lat);
@ -1208,7 +1208,7 @@ namespace spades {
Vector3 front = GetFront();
float yaw = atan2(front.y, front.x) + M_PI * .5f;
float yaw = atan2(front.y, front.x) + static_cast<float>(M_PI) * .5f;
float pitch = -atan2(front.z, sqrt(front.x * front.x + front.y * front.y));
// lower axis
@ -1219,7 +1219,7 @@ namespace spades {
Matrix4 torso;
if(input.crouch){
lower = lower * Matrix4::Translate(0, 0, -0.4);
lower = lower * Matrix4::Translate(0, 0, -0.4f);
// lower
hb.limbs[0] = AABB3(-.4f, -.15f, 0.5f,
0.3f, .3f, 0.5f);
@ -1229,7 +1229,7 @@ namespace spades {
0.3f, .3f, 0.5f);
hb.limbs[1] = lower * hb.limbs[1];
torso = lower * Matrix4::Translate(0, 0, -0.3);
torso = lower * Matrix4::Translate(0, 0, -0.3f);
// torso
hb.torso = AABB3(-.4f, -.15f, 0.1f,
@ -1258,7 +1258,7 @@ namespace spades {
0.3f, .3f, 1.f);
hb.limbs[1] = lower * hb.limbs[1];
torso = lower * Matrix4::Translate(0, 0, -1.1);
torso = lower * Matrix4::Translate(0, 0, -1.1f);
// torso
hb.torso = AABB3(-.4f, -.15f, 0.1f,

View File

@ -134,21 +134,21 @@ namespace spades {
size = font->Measure(buf);
pos.x = scrWidth * .5f - size.x - 16.f;
font->Draw(buf, pos + MakeVector2(0, 1), 1.f,
MakeVector4(0, 0, 0, 0.3));
MakeVector4(0, 0, 0, 0.3f));
font->Draw(buf, pos, 1.f, whiteColor);
sprintf(buf, "%d", GetTeamScore(1));
size = font->Measure(buf);
pos.x = scrWidth * .5f + 16.f;
font->Draw(buf, pos + MakeVector2(0, 1), 1.f,
MakeVector4(0, 0, 0, 0.3));
MakeVector4(0, 0, 0, 0.3f));
font->Draw(buf, pos, 1.f, whiteColor);
sprintf(buf, "-");
size = font->Measure(buf);
pos.x = scrWidth * .5f - size.x * .5f;
font->Draw(buf, pos + MakeVector2(0, 1), 1.f,
MakeVector4(0, 0, 0, 0.3));
MakeVector4(0, 0, 0, 0.3f));
font->Draw(buf, pos, 1.f, whiteColor);
// draw team bar

View File

@ -84,7 +84,7 @@ namespace spades {
IntVector3 v2,
int maxLength);
Player *GetPlayer(int i){
Player *GetPlayer(unsigned int i){
SPAssert(i >= 0);
SPAssert(i < players.size());
return players[i];

View File

@ -320,7 +320,7 @@ namespace spades {
Bitmap *bmp = new Bitmap(columns, rows);
byte *out = (byte *)bmp->GetPixels();
for(int i = 0; i <numPixels; i++)
for(unsigned int i = 0; i <numPixels; i++)
out[i] = targa_rgba[i];
return bmp;

View File

@ -71,7 +71,7 @@ namespace spades {
chunks.resize(chunkW * chunkH * chunkD);
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
c.dirty = true;
c.dirtyMinX = 0;
@ -290,7 +290,7 @@ namespace spades {
int GLAmbientShadowRenderer::GetNumDirtyChunks() {
int cnt = 0;
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(c.dirty) cnt++;
}
@ -309,14 +309,14 @@ namespace spades {
}
int cnt = 0;
for(int i = 0; i < chunks.size(); i++) {
for(size_t i = 0; i < chunks.size(); i++) {
if(!chunks[i].transfered)
cnt++;
}
GLProfiler profiler(device, "Large Ambient Occlusion [>= %d chunk(s)]", cnt);
device->BindTexture(IGLDevice::Texture3D, texture);
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(!c.transfered){
c.transfered = true;
@ -346,7 +346,7 @@ namespace spades {
int eyeY = (int)(eyePos.y) >> ChunkSizeBits;
int eyeZ = (int)(eyePos.z) >> ChunkSizeBits;
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
int dx = (c.cx - eyeX) & (chunkW - 1);
int dy = (c.cy - eyeY) & (chunkH - 1);
@ -367,7 +367,7 @@ namespace spades {
// far chunks
if(numDirtyChunks == 0){
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(c.dirty){
dirtyChunkIds[numDirtyChunks++] = i;

View File

@ -390,8 +390,8 @@ namespace spades {
}
float maxCoc = (float)std::max(w, h) / 100.f;
float cos60 = cosf(M_PI / 3.f);
float sin60 = sinf(M_PI / 3.f);
float cos60 = cosf(static_cast<float>(M_PI) / 3.f);
float sin60 = sinf(static_cast<float>(M_PI) / 3.f);
maxCoc *= .7f + vignetteBlur * 0.5f;

View File

@ -22,6 +22,7 @@
#include "GLFramebufferManager.h"
#include "IGLDevice.h"
#include <stdint.h>
#include <vector>
namespace spades {

View File

@ -110,7 +110,7 @@ namespace spades {
sunScreen.x = sunView.x / (sunView.z * fov.x);
sunScreen.y = sunView.y / (sunView.z * fov.y);
const float sunRadiusTan = tanf(.53f * .5f * M_PI / 180.f);
const float sunRadiusTan = tanf(.53f * .5f * static_cast<float>(M_PI) / 180.f);
Vector2 sunSize = {
sunRadiusTan / fov.x,
sunRadiusTan / fov.y

View File

@ -82,7 +82,7 @@ namespace spades {
chunks.resize(chunkW * chunkH * chunkD);
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
c.dirty = true;
c.dirtyMinX = 0;
@ -227,7 +227,7 @@ namespace spades {
// if true, this is negative-y faced plane
// if false, this is negative-z faced plane
bool isSide = pixel & 0x80;
bool isSide = pixel & 0x80 != 0;
// direction dependent process
Vector3 center; // center of face
@ -281,9 +281,9 @@ namespace spades {
Vector3 normDiff = diff * -invDiffLen;
// extract shadowmap color
float red = (pixel) & 0x3f;
float green = (pixel >> 8) & 0x3f;
float blue = (pixel >> 16) & 0x3f;
float red = static_cast<float>((pixel) & 0x3f);
float green = static_cast<float>((pixel >> 8) & 0x3f);
float blue = static_cast<float>((pixel >> 16) & 0x3f);
Vector3 color = {red, green, blue};
color *= intensity;
@ -375,7 +375,7 @@ namespace spades {
int GLRadiosityRenderer::GetNumDirtyChunks() {
int cnt = 0;
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(c.dirty) cnt++;
}
@ -393,12 +393,12 @@ namespace spades {
dispatch->Start();
}
int cnt = 0;
for(int i = 0; i < chunks.size(); i++) {
for(size_t i = 0; i < chunks.size(); i++) {
if(!chunks[i].transfered)
cnt++;
}
GLProfiler profiler(device, "Radiosity [>= %d chunk(s)]", cnt);
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(!c.transfered){
c.transfered = true;
@ -475,7 +475,7 @@ namespace spades {
int eyeY = (int)(eyePos.y) >> ChunkSizeBits;
int eyeZ = (int)(eyePos.z) >> ChunkSizeBits;
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
int dx = (c.cx - eyeX) & (chunkW - 1);
int dy = (c.cy - eyeY) & (chunkH - 1);
@ -496,7 +496,7 @@ namespace spades {
// far chunks
if(numDirtyChunks == 0){
for(int i = 0; i < chunks.size(); i++){
for(size_t i = 0; i < chunks.size(); i++){
Chunk& c = chunks[i];
if(c.dirty){
dirtyChunkIds[numDirtyChunks++] = i;

View File

@ -469,7 +469,7 @@ namespace spades {
g.tile2 = tile2;
g.firstInstance = NoInstance;
g.lastInstance = NoInstance;
g.lod = -100.f;
g.lod = -100; //lod is an int
g.valid = true;
groups.push_back(g);

View File

@ -473,9 +473,9 @@ namespace spades {
int ox = rand() % (size - 2);
int oy = rand() % (size - 2);
static const float gauss[] = {
0.225610111284052,
0.548779777431897,
0.225610111284052
0.225610111284052f,
0.548779777431897f,
0.225610111284052f
};
float strength = (GetRandom()-GetRandom()) * 0.15f * 100.f;
for(int x = 0; x < 3; x++)
@ -938,7 +938,7 @@ namespace spades {
waveTanks[i]->SetTimeStep(dt * 0.15704f / .08f);
break;
case 2:
waveTanks[i]->SetTimeStep(dt * 0.02344 / .08f);
waveTanks[i]->SetTimeStep(dt * 0.02344f / .08f);
break;
}
waveTanks[i]->Start();