More simple fixes to cleanup warnings and what not:

extern/bullet/BulletDynamics/ConstraintSolver/SimpleConstraintSolver.h
        added newline at end of file.
 intern/boolop/intern/BOP_Face2Face.cpp
        fixed indentation and had nested declarations of a varible i used
                for multiple for loops, changed it to just one declaration.
 source/blender/blenkernel/bad_level_call_stubs/stubs.c
        added prototypes and a couple other fixes.
 source/blender/include/BDR_drawobject.h
 source/blender/include/BSE_node.h
 source/blender/include/butspace.h
 source/blender/render/extern/include/RE_shader_ext.h
        added struct definitions
 source/blender/src/editmesh_mods.c
 source/gameengine/Ketsji/KX_BlenderMaterial.cpp
 source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
 source/gameengine/Ketsji/KX_RaySensor.cpp
        removed unused variables;
 source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
        changed format of case statements to avoid warnings in gcc.

Kent
This commit is contained in:
Kent Mein 2006-01-30 19:59:33 +00:00
parent ed81ff405f
commit 8e9222ec21
12 changed files with 199 additions and 182 deletions

@ -28,7 +28,5 @@ public:
};
#endif //SIMPLE_CONSTRAINT_SOLVER_H
#endif //SIMPLE_CONSTRAINT_SOLVER_H

@ -501,173 +501,174 @@ void BOP_getPoints(BOP_Mesh* mesh,
* @param invertA indicates if points of same relative face had been exchanged
*/
void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bool &invertA, bool &invertB) {
MT_Point3 sortedPoints[4];
unsigned int sortedFaces[4], position[4];
unsigned int i;
if (size == 2) {
MT_Point3 sortedPoints[4];
unsigned int sortedFaces[4], position[4];
unsigned int i;
if (size == 2) {
// Trivial case, only test the merge ...
if (BOP_comp(0,points[0].distance(points[1]))==0) {
face[0] = 3;
size--;
}
}
else {
// size is 3 or 4
// Get segment extreme points
MT_Scalar maxDistance = -1;
for(i=0;i<size-1;i++){
for(unsigned int j=i+1;j<size;j++){
MT_Scalar distance = points[i].distance(points[j]);
if (distance > maxDistance){
maxDistance = distance;
position[0] = i;
position[size-1] = j;
}
}
}
// Trivial case, only test the merge ...
if (BOP_comp(0,points[0].distance(points[1]))==0) {
face[0] = 3;
size--;
}
}
else {
// size is 3 or 4
// Get segment extreme points
MT_Scalar maxDistance = -1;
for(i=0;i<size-1;i++){
for(unsigned int j=i+1;j<size;j++){
MT_Scalar distance = points[i].distance(points[j]);
if (distance > maxDistance){
maxDistance = distance;
position[0] = i;
position[size-1] = j;
}
}
}
// Get segment inner points
position[1] = position[2] = size;
for(i=0;i<size;i++){
if ((i != position[0]) && (i != position[size-1])){
if (position[1] == size) position[1] = i;
else position[2] = i;
}
}
// Get segment inner points
position[1] = position[2] = size;
for(i=0;i<size;i++){
if ((i != position[0]) && (i != position[size-1])){
if (position[1] == size) position[1] = i;
else position[2] = i;
}
}
// Get inner points
if (position[2] < size) {
MT_Scalar d1 = points[position[1]].distance(points[position[0]]);
MT_Scalar d2 = points[position[2]].distance(points[position[0]]);
if (d1 > d2) {
unsigned int aux = position[1];
position[1] = position[2];
position[2] = aux;
}
}
// Get inner points
if (position[2] < size) {
MT_Scalar d1 = points[position[1]].distance(points[position[0]]);
MT_Scalar d2 = points[position[2]].distance(points[position[0]]);
if (d1 > d2) {
unsigned int aux = position[1];
position[1] = position[2];
position[2] = aux;
}
}
// Sort data
for(i=0;i<size;i++) {
sortedPoints[i] = points[position[i]];
sortedFaces[i] = face[position[i]];
}
// Sort data
for(i=0;i<size;i++) {
sortedPoints[i] = points[position[i]];
sortedFaces[i] = face[position[i]];
}
// invertA, invertB ¿?
invertA = false;
invertB = false;
if (face[1] == 1) {
// invertA¿?
for(i=0;i<size;i++) {
if (position[i] == 1) {
invertA = true;
break;
}
else if (position[i] == 0) break;
}
// invertB¿?
if (size == 4) {
for(unsigned int i=0;i<size;i++) {
if (position[i] == 3) {
invertB = true;
break;
}
else if (position[i] == 2) break;
}
}
}
else if (face[1] == 2) {
// invertB¿?
for(unsigned int i=0;i<size;i++) {
if (position[i] == 2) {
invertB = true;
break;
}
else if (position[i] == 1) break;
}
}
invertA = false;
invertB = false;
if (face[1] == 1) {
// invertA¿?
for(i=0;i<size;i++) {
if (position[i] == 1) {
invertA = true;
break;
}
else if (position[i] == 0) break;
}
// invertB¿?
if (size == 4) {
for(i=0;i<size;i++) {
if (position[i] == 3) {
invertB = true;
break;
}
else if (position[i] == 2) break;
}
}
}
else if (face[1] == 2) {
// invertB¿?
for(i=0;i<size;i++) {
if (position[i] == 2) {
invertB = true;
break;
}
else if (position[i] == 1) break;
}
}
// Merge data
MT_Scalar d1 = sortedPoints[1].distance(sortedPoints[0]);
MT_Scalar d2 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[0]) {
if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
if (d1 < d2) {
// merge 0 and 1
sortedFaces[0] = 3;
for(unsigned int i = 1; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
if (size == 3) {
// merge 1 and 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
}
}
}
else {
// merge 1 and 2
sortedFaces[1] = 3;
for(unsigned int i = 2; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
}
}
else {
// merge 0 and 1
sortedFaces[0] = 3;
for(unsigned int i = 1; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
if (size == 3) {
// merge 1 i 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
}
}
}
}
else {
if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge 1 and 2
sortedFaces[1] = 3;
for(unsigned int i = 2; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
}
else if (size == 4) {
d1 = sortedPoints[2].distance(sortedPoints[3]);
if (BOP_comp(0,d1)==0 && sortedFaces[2] != sortedFaces[3]) {
// merge 2 and 3
sortedFaces[2] = 3;
size--;
}
}
}
// Merge data
MT_Scalar d1 = sortedPoints[1].distance(sortedPoints[0]);
MT_Scalar d2 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[0]) {
if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
if (d1 < d2) {
// merge 0 and 1
sortedFaces[0] = 3;
for(i = 1; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
if (size == 3) {
// merge 1 and 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
}
}
}
else {
// merge 1 and 2
sortedFaces[1] = 3;
for(i = 2; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
}
}
else {
// merge 0 and 1
sortedFaces[0] = 3;
for(i = 1; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
if (size == 3) {
// merge 1 i 2 ???
d1 = sortedPoints[1].distance(sortedPoints[2]);
if (BOP_comp(0,d1)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge!
sortedFaces[1] = 3;
size--;
}
}
}
}
else {
if (BOP_comp(0,d2)==0 && sortedFaces[1] != sortedFaces[2]) {
// merge 1 and 2
sortedFaces[1] = 3;
for(i = 2; i<size-1;i++) {
sortedPoints[i] = sortedPoints[i+1];
sortedFaces[i] = sortedFaces[i+1];
}
size--;
}
else if (size == 4) {
d1 = sortedPoints[2].distance(sortedPoints[3]);
if (BOP_comp(0,d1)==0 && sortedFaces[2] != sortedFaces[3]) {
// merge 2 and 3
sortedFaces[2] = 3;
size--;
}
}
}
// Merge initial points ...
for(i=0;i<size;i++) {
points[i] = sortedPoints[i];
face[i] = sortedFaces[i];
}
// Merge initial points ...
for(i=0;i<size;i++) {
points[i] = sortedPoints[i];
face[i] = sortedFaces[i];
}
}
}
}
}
/**

@ -32,6 +32,7 @@
* BKE_bad_level_calls function stubs
*/
#include <stdlib.h>
#include "BKE_bad_level_calls.h"
#include "BLI_blenlib.h"
@ -40,9 +41,6 @@
#include "DNA_material_types.h"
#include "DNA_scene_types.h"
#include "RE_render_ext.h"
#include "RE_shader_ext.h"
#include "RE_pipeline.h"
@ -51,6 +49,17 @@ int winqueue_break= 0;
char bprogname[1];
struct IpoCurve;
struct FluidsimSettings;
struct Render;
struct RenderResult;
char *getIpoCurveName( struct IpoCurve * icu );
void insert_vert_ipo(struct IpoCurve *icu, float x, float y);
struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e);
void elbeemDebugOut(char *msg);
void fluidsimSettingsFree(struct FluidsimSettings* sb);
/* readfile.c */
/* struct PluginSeq; */
@ -206,5 +215,5 @@ void fluidsimSettingsFree(struct FluidsimSettings* sb) {}
/*new render funcs */
void externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta) {}
int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres) {return 0;}
Render *RE_GetRender(const char *name) {}
RenderResult *RE_GetResult(Render *re) {}
struct Render *RE_GetRender(const char *name) {return (struct Render *)NULL;}
struct RenderResult *RE_GetResult(Render *re) {return (struct RenderResult *)NULL;}

@ -48,6 +48,7 @@ struct BPoint;
struct BezTriple;
struct EditVert;
struct EditFace;
struct EditEdge;
void mesh_foreachScreenVert(void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
void mesh_foreachScreenEdge(void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);

@ -66,6 +66,8 @@ int node_has_hidden_sockets(struct bNode *node);
struct bNode *node_add_node(struct SpaceNode *snode, int type, float locx, float locy);
/* ************* drawnode.c *************** */
struct SpaceNode;
struct bNodeLink;
void node_draw_link(struct SpaceNode *snode, struct bNodeLink *link);
void init_node_butfuncs(void);

@ -131,6 +131,7 @@ void test_imapoin_but(char *name, ID **idpp);
void test_idbutton_cb(void *namev, void *arg2_unused);
struct CurveMapping;
void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char labeltype, short event, short redraw, struct rctf *rect);
/* -------------- internal event defines ------------ */

@ -100,7 +100,8 @@ typedef struct ShadeInput
/* node shaders... */
int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
struct Tex;
int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
#endif /* RE_SHADER_EXT_H */

@ -2518,7 +2518,7 @@ void editmesh_align_view_to_selected(View3D *v3d, int axis)
Mat4Mul3Vecfl(G.obedit->obmat, norm);
view3d_align_axis_to_vector(v3d, axis, norm);
} else if (nselverts==1) { /* Align view to vert normal */
EditVert *eve, *leve= NULL;
EditVert *eve;
for (eve= em->verts.first; eve; eve= eve->next) {
if (eve->f & SELECT) {

@ -79,12 +79,24 @@ void SCA_Joystick::HandleEvents()
{
switch(m_private->m_event.type)
{
case SDL_JOYAXISMOTION: {HANDLE_AXISMOTION(OnAxisMotion);break;}
case SDL_JOYHATMOTION: {HANDLE_HATMOTION(OnHatMotion); break;}
case SDL_JOYBUTTONUP: {HANDLE_BUTTONUP(OnButtonUp); break;}
case SDL_JOYBUTTONDOWN: {HANDLE_BUTTONDOWN(OnButtonDown);break;}
case SDL_JOYBALLMOTION: {HANDLE_BALLMOTION(OnBallMotion);break;}
default: {HANDLE_NOEVENT(OnNothing); break;}
case SDL_JOYAXISMOTION:
HANDLE_AXISMOTION(OnAxisMotion);
break;
case SDL_JOYHATMOTION:
HANDLE_HATMOTION(OnHatMotion);
break;
case SDL_JOYBUTTONUP:
HANDLE_BUTTONUP(OnButtonUp);
break;
case SDL_JOYBUTTONDOWN:
HANDLE_BUTTONDOWN(OnButtonDown);
break;
case SDL_JOYBALLMOTION:
HANDLE_BALLMOTION(OnBallMotion);
break;
default:
HANDLE_NOEVENT(OnNothing);
break;
}
}
}

@ -351,8 +351,6 @@ void KX_BlenderMaterial::setTexData( bool enable )
return;
}
int lastblend = 0;
// for each enabled unit
for(i=0; (i<mMaterial->num_enabled); i++) {
if( !mTextures[i].Ok() ) continue;

@ -692,7 +692,6 @@ static CollisionShape* CreateBulletShapeFromMesh(RAS_MeshObject* meshobj, bool p
//see if there is any polygons, if not, bail out.
int numUsedPolygons = 0;
int numPoints = 0;
SimdVector3* points = 0;
@ -1044,11 +1043,7 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
if (meshobj)
materialname = meshobj->GetMaterialName(0);
const char* matname = materialname.ReadPtr();
physicscontroller->SetObject(gameobj->GetSGNode());
}

@ -214,7 +214,6 @@ bool KX_RaySensor::Evaluate(CValue* event)
MT_Point3 topoint = frompoint + (m_distance) * todir;
MT_Point3 resultpoint;
MT_Vector3 resultnormal;
bool ready = false;
PHY_IPhysicsEnvironment* pe = m_scene->GetPhysicsEnvironment();
if (!pe)