Fix [#21294] Bad object drawing and crash when rendering

Reported and patched by Shane Ambler.

Took the opportunity to silence warnings in readfile.c. For Windows in SCons I enabled /WX
for blenloader. This means that all enabled warnings will throw errors from now on.
This commit is contained in:
Nathan Letwory 2010-10-19 22:17:34 +00:00
parent 56f89d2375
commit b741740ffa
2 changed files with 52 additions and 39 deletions

@ -11,4 +11,7 @@ incs += ' ' + env['BF_ZLIB_INC']
defs = []
env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30] )
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30], cc_compileflags=['/WX'] )
else:
env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30] )

@ -831,8 +831,8 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int
static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int size)
{
// don't read more bytes then there are available in the buffer
int readsize = MIN2(size, filedata->buffersize - filedata->seek);
// don't read more bytes then there are available in the buffer
int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek));
memcpy(buffer, filedata->buffer + filedata->seek, readsize);
filedata->seek += readsize;
@ -3252,10 +3252,21 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte
for(i = 0; i < count; ++i) {
mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
/* this does swap for data written at write_mdisps() - readfile.c */
int x;
float *tmpdisps= *mdisps[i].disps;
for(x=0;x<mdisps[i].totdisp*3;x++) {
SWITCH_INT(*tmpdisps);
tmpdisps++;
}
}
if(!external && !mdisps[i].disps)
mdisps[i].totdisp = 0;
}
}
}
}
static void direct_link_customdata(FileData *fd, CustomData *data, int count)
@ -6505,23 +6516,23 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
for (con=lb->first; con; con=con->next) {
if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *data = con->data;
data->axX *= M_PI/180.0;
data->axY *= M_PI/180.0;
data->axZ *= M_PI/180.0;
data->axX *= (float)(M_PI/180.0);
data->axY *= (float)(M_PI/180.0);
data->axZ *= (float)(M_PI/180.0);
}
else if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = con->data;
data->poleangle *= M_PI/180.0;
data->poleangle *= (float)(M_PI/180.0);
}
else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) {
bRotLimitConstraint *data = con->data;
data->xmin *= M_PI/180.0;
data->xmax *= M_PI/180.0;
data->ymin *= M_PI/180.0;
data->ymax *= M_PI/180.0;
data->zmin *= M_PI/180.0;
data->zmax *= M_PI/180.0;
data->xmin *= (float)(M_PI/180.0);
data->xmax *= (float)(M_PI/180.0);
data->ymin *= (float)(M_PI/180.0);
data->ymax *= (float)(M_PI/180.0);
data->zmin *= (float)(M_PI/180.0);
data->zmax *= (float)(M_PI/180.0);
}
}
}
@ -9546,7 +9557,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* Adjustments needed after Bullets update */
for(ob = main->object.first; ob; ob= ob->id.next) {
ob->damping *= 0.635f;
ob->rdamping = 0.1 + (0.8f * ob->rdamping);
ob->rdamping = 0.1f + (0.8f * ob->rdamping);
}
}
@ -9626,8 +9637,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
seq->strip->proxy->size
= sce->r.size;
} else {
seq->strip->proxy->size
= 25.0;
seq->strip->proxy->size = 25;
}
seq->strip->proxy->quality =90;
}
@ -10077,14 +10087,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(sce= main->scene.first; sce; sce= sce->id.next)
{
if(sce->audio.main == 0.0)
sce->audio.main = 1.0;
if(sce->audio.main == 0.0f)
sce->audio.main = 1.0f;
sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
sce->r.ffcodecdata.audio_volume = sce->audio.main;
sce->audio.distance_model = 2.0;
sce->audio.doppler_factor = 1.0;
sce->audio.speed_of_sound = 343.3;
sce->audio.distance_model = 2;
sce->audio.doppler_factor = 1.0f;
sce->audio.speed_of_sound = 343.3f;
}
/* Add default gravity to scenes */
@ -10110,11 +10120,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(md= ob->modifiers.first; md; md= md->next) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
if(clmd)
clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81;
clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
}
if(ob->soft)
ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81;
ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
}
/* Normal wind shape is plane */
@ -10499,7 +10509,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* game engine changes */
for(sce = main->scene.first; sce; sce = sce->id.next) {
sce->gm.eyeseparation = 0.10;
sce->gm.eyeseparation = 0.10f;
}
/* anim viz changes */
@ -10604,12 +10614,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (ob->pose) {
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
pchan->limitmin[0] *= M_PI/180.0;
pchan->limitmin[1] *= M_PI/180.0;
pchan->limitmin[2] *= M_PI/180.0;
pchan->limitmax[0] *= M_PI/180.0;
pchan->limitmax[1] *= M_PI/180.0;
pchan->limitmax[2] *= M_PI/180.0;
pchan->limitmin[0] *= (float)(M_PI/180.0);
pchan->limitmin[1] *= (float)(M_PI/180.0);
pchan->limitmin[2] *= (float)(M_PI/180.0);
pchan->limitmax[0] *= (float)(M_PI/180.0);
pchan->limitmax[1] *= (float)(M_PI/180.0);
pchan->limitmax[2] *= (float)(M_PI/180.0);
do_version_constraints_radians_degrees_250(&pchan->constraints);
}
@ -10708,7 +10718,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
int a;
for(a=0; a<PE_TOT_BRUSH; a++)
pset->brush[a].strength /= 100.0;
pset->brush[a].strength /= 100.0f;
}
for(ma = main->mat.first; ma; ma=ma->id.next)
@ -10989,7 +10999,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
// bad radius
if (brush->unprojected_radius == 0)
brush->unprojected_radius = 0.125;
brush->unprojected_radius = 0.125f;
// unusable size
if (brush->size == 0)
@ -11031,18 +11041,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
brush->add_col[1] == 0 &&
brush->add_col[2] == 0)
{
brush->add_col[0] = 1.00;
brush->add_col[1] = 0.39;
brush->add_col[2] = 0.39;
brush->add_col[0] = 1.00f;
brush->add_col[1] = 0.39f;
brush->add_col[2] = 0.39f;
}
if (brush->sub_col[0] == 0 &&
brush->sub_col[1] == 0 &&
brush->sub_col[2] == 0)
{
brush->sub_col[0] = 0.39;
brush->sub_col[1] = 0.39;
brush->sub_col[2] = 1.00;
brush->sub_col[0] = 0.39f;
brush->sub_col[1] = 0.39f;
brush->sub_col[2] = 1.00f;
}
}
}