Code cleanup: white space and cmake was broken on all platforms

This commit is contained in:
2014-02-03 13:55:26 +11:00
parent 236e468359
commit 1dc1d92dab
16 changed files with 81 additions and 83 deletions

View File

@@ -1043,10 +1043,10 @@ ccl_device_inline float3 curvetangent(float t, float3 p0, float3 p1, float3 p2,
float fc = 0.71f; float fc = 0.71f;
float data[4]; float data[4];
float t2 = t * t; float t2 = t * t;
data[0] = -3.0f * fc * t2 + 4.0f * fc * t - fc; data[0] = -3.0f * fc * t2 + 4.0f * fc * t - fc;
data[1] = 3.0f * (2.0f - fc) * t2 + 2.0f * (fc - 3.0f) * t; data[1] = 3.0f * (2.0f - fc) * t2 + 2.0f * (fc - 3.0f) * t;
data[2] = 3.0f * (fc - 2.0f) * t2 + 2.0f * (3.0f - 2.0f * fc) * t + fc; data[2] = 3.0f * (fc - 2.0f) * t2 + 2.0f * (3.0f - 2.0f * fc) * t + fc;
data[3] = 3.0f * fc * t2 - 2.0f * fc * t; data[3] = 3.0f * fc * t2 - 2.0f * fc * t;
return data[0] * p0 + data[1] * p1 + data[2] * p2 + data[3] * p3; return data[0] * p0 + data[1] * p1 + data[2] * p2 + data[3] * p3;
} }

View File

@@ -250,8 +250,8 @@ ccl_device int subsurface_scatter_multi_step(KernelGlobals *kg, ShaderData *sd,
} }
/* sample point on disk */ /* sample point on disk */
float phi = M_2PI_F * disk_u; float phi = M_2PI_F * disk_u;
float disk_r = disk_v; float disk_r = disk_v;
float disk_height; float disk_height;
bssrdf_sample(sc, disk_r, &disk_r, &disk_height); bssrdf_sample(sc, disk_r, &disk_r, &disk_height);

View File

@@ -99,7 +99,7 @@ RenderTile::RenderTile()
RenderBuffers::RenderBuffers(Device *device_) RenderBuffers::RenderBuffers(Device *device_)
{ {
device = device_; device = device_;
} }
RenderBuffers::~RenderBuffers() RenderBuffers::~RenderBuffers()

View File

@@ -93,7 +93,7 @@ bool string_endswith(const string& s, const char *end)
if(len > s.size()) if(len > s.size())
return 0; return 0;
else else
return strncmp(s.c_str() + s.size() - len, end, len) == 0; return strncmp(s.c_str() + s.size() - len, end, len) == 0;
} }
string string_strip(const string& s) string string_strip(const string& s)

View File

@@ -264,7 +264,7 @@ ccl_device_inline bool transform_uniform_scale(const Transform& tfm, float& scal
/* the epsilon here is quite arbitrary, but this function is only used for /* the epsilon here is quite arbitrary, but this function is only used for
* surface area and bump, where we except it to not be so sensitive */ * surface area and bump, where we except it to not be so sensitive */
Transform ttfm = transform_transpose(tfm); Transform ttfm = transform_transpose(tfm);
float eps = 1e-6f; float eps = 1e-6f;
float sx = len_squared(float4_to_float3(tfm.x)); float sx = len_squared(float4_to_float3(tfm.x));
float sy = len_squared(float4_to_float3(tfm.y)); float sy = len_squared(float4_to_float3(tfm.y));
@@ -275,12 +275,13 @@ ccl_device_inline bool transform_uniform_scale(const Transform& tfm, float& scal
if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps && if(fabsf(sx - sy) < eps && fabsf(sx - sz) < eps &&
fabsf(sx - stx) < eps && fabsf(sx - sty) < eps && fabsf(sx - stx) < eps && fabsf(sx - sty) < eps &&
fabsf(sx - stz) < eps) { fabsf(sx - stz) < eps)
{
scale = sx; scale = sx;
return true; return true;
} }
return false; return false;
} }
ccl_device_inline bool transform_negative_scale(const Transform& tfm) ccl_device_inline bool transform_negative_scale(const Transform& tfm)

View File

@@ -40,62 +40,58 @@
#include "MyGlutMouseHandler.h" #include "MyGlutMouseHandler.h"
#include "MyGlutKeyHandler.h" #include "MyGlutKeyHandler.h"
#include "ChainDrawer.h" #include "ChainDrawer.h"
void void init(MT_Vector3 min,MT_Vector3 max)
init(MT_Vector3 min,MT_Vector3 max)
{ {
GLfloat light_diffuse0[] = {1.0, 0.0, 0.0, 1.0}; /* Red diffuse light. */ GLfloat light_diffuse0[] = {1.0, 0.0, 0.0, 1.0}; /* Red diffuse light. */
GLfloat light_position0[] = {1.0, 1.0, 1.0, 0.0}; /* Infinite light location. */ GLfloat light_position0[] = {1.0, 1.0, 1.0, 0.0}; /* Infinite light location. */
GLfloat light_diffuse1[] = {1.0, 1.0, 1.0, 1.0}; /* Red diffuse light. */ GLfloat light_diffuse1[] = {1.0, 1.0, 1.0, 1.0}; /* Red diffuse light. */
GLfloat light_position1[] = {1.0, 0, 0, 0.0}; /* Infinite light location. */ GLfloat light_position1[] = {1.0, 0, 0, 0.0}; /* Infinite light location. */
/* Enable a single OpenGL light. */ /* Enable a single OpenGL light. */
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse0); glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse0);
glLightfv(GL_LIGHT0, GL_POSITION, light_position0); glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse1); glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
glLightfv(GL_LIGHT1, GL_POSITION, light_position1); glLightfv(GL_LIGHT1, GL_POSITION, light_position1);
glEnable(GL_LIGHT0); glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1); glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
/* Use depth buffering for hidden surface elimination. */ /* Use depth buffering for hidden surface elimination. */
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
/* Setup the view of the cube. */ /* Setup the view of the cube. */
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
// center of the box + 3* depth of box // center of the box + 3* depth of box
MT_Vector3 center = (min + max) * 0.5; MT_Vector3 center = (min + max) * 0.5;
MT_Vector3 diag = max - min; MT_Vector3 diag = max - min;
float depth = diag.length(); float depth = diag.length();
float distance = 2; float distance = 2;
gluPerspective( gluPerspective(/* field of view in degree */ 40.0,
/* field of view in degree */ 40.0, /* aspect ratio */ 1.0,
/* aspect ratio */ 1.0, /* Z near */ 1.0,
/* Z near */ 1.0, /* Z far */ distance * depth * 2
/* Z far */ distance * depth * 2 );
); glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_MODELVIEW);
gluLookAt( gluLookAt(center.x(), center.y(), center.z() + distance*depth, /* eye is at (0,0,5) */
center.x(), center.y(), center.z() + distance*depth, /* eye is at (0,0,5) */ center.x(), center.y(), center.z(), /* center is at (0,0,0) */
center.x(), center.y(), center.z(), /* center is at (0,0,0) */ 0.0, 1.0, 0.); /* up is in positive Y direction */
0.0, 1.0, 0.); /* up is in positive Y direction */
glPushMatrix();
glPushMatrix();
} }
int
main(int argc, char **argv) int main(int argc, char **argv)
{ {

View File

@@ -2659,23 +2659,23 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us
void BKE_object_empty_draw_type_set(Object *ob, const int value) void BKE_object_empty_draw_type_set(Object *ob, const int value)
{ {
ob->empty_drawtype = value; ob->empty_drawtype = value;
if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
if (!ob->iuser) { if (!ob->iuser) {
ob->iuser = MEM_callocN(sizeof(ImageUser), "image user"); ob->iuser = MEM_callocN(sizeof(ImageUser), "image user");
ob->iuser->ok = 1; ob->iuser->ok = 1;
ob->iuser->frames = 100; ob->iuser->frames = 100;
ob->iuser->sfra = 1; ob->iuser->sfra = 1;
ob->iuser->fie_ima = 2; ob->iuser->fie_ima = 2;
} }
} }
else { else {
if (ob->iuser) { if (ob->iuser) {
MEM_freeN(ob->iuser); MEM_freeN(ob->iuser);
ob->iuser = NULL; ob->iuser = NULL;
} }
} }
} }
bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden) bool BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)

View File

@@ -2135,7 +2135,7 @@ static VMesh *make_cube_corner_straight(MemArena *mem_arena, int nseg)
float co[3]; float co[3];
int i, j, k, ns2; int i, j, k, ns2;
ns2 = nseg / 2; ns2 = nseg / 2;
vm = new_adj_vmesh(mem_arena, 3, nseg, NULL); vm = new_adj_vmesh(mem_arena, 3, nseg, NULL);
vm->count = 0; // reset, so following loop will end up with correct count vm->count = 0; // reset, so following loop will end up with correct count
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {

View File

@@ -103,7 +103,7 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
int maxx = x + this->m_rad; // UNUSED int maxx = x + this->m_rad; // UNUSED
miny = max(miny, inputBuffer->getRect()->ymin); miny = max(miny, inputBuffer->getRect()->ymin);
minx = max(minx, inputBuffer->getRect()->xmin); minx = max(minx, inputBuffer->getRect()->xmin);
maxx = min(maxx, inputBuffer->getRect()->xmax -1); maxx = min(maxx, inputBuffer->getRect()->xmax -1);
/* *** this is the main part which is different to 'GaussianXBlurOperation' *** */ /* *** this is the main part which is different to 'GaussianXBlurOperation' *** */

View File

@@ -222,7 +222,7 @@ static void info_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__ #ifdef __APPLE__
WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
#endif #endif
} }

View File

@@ -102,9 +102,9 @@ static int AdjacencyIterator_init(BPy_AdjacencyIterator *self, PyObject *args, P
static PyObject *AdjacencyIterator_iter(BPy_AdjacencyIterator *self) static PyObject *AdjacencyIterator_iter(BPy_AdjacencyIterator *self)
{ {
Py_INCREF(self); Py_INCREF(self);
self->at_start = true; self->at_start = true;
return (PyObject *) self; return (PyObject *) self;
} }
static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self)

View File

@@ -65,7 +65,7 @@ static char UnaryFunction0DUnsigned___doc__[] =
"\n" "\n"
".. method:: __init__()\n" ".. method:: __init__()\n"
"\n" "\n"
" Default constructor.\n"; " Default constructor.\n";
static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds)
{ {

View File

@@ -55,18 +55,18 @@ namespace Freestyle {
class LIB_STROKE_EXPORT TextStrokeRenderer : public StrokeRenderer class LIB_STROKE_EXPORT TextStrokeRenderer : public StrokeRenderer
{ {
public: public:
TextStrokeRenderer(const char *iFileName = NULL); TextStrokeRenderer(const char *iFileName = NULL);
virtual ~TextStrokeRenderer(); virtual ~TextStrokeRenderer();
/*! Renders a stroke rep */ /*! Renders a stroke rep */
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const;
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const;
/*! Closes the output file */ /*! Closes the output file */
void Close(); void Close();
protected: protected:
mutable ofstream _ofstream; mutable ofstream _ofstream;
}; };
} /* namespace Freestyle */ } /* namespace Freestyle */

View File

@@ -488,9 +488,9 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point
static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value) static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value)
{ {
Object *ob = (Object *)ptr->data; Object *ob = (Object *)ptr->data;
BKE_object_empty_draw_type_set(ob, value); BKE_object_empty_draw_type_set(ob, value);
} }
static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr,

View File

@@ -538,12 +538,12 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
bool RAS_MeshObject::HasColliderPolygon() bool RAS_MeshObject::HasColliderPolygon()
{ {
int numpolys= NumPolygons(); int numpolys= NumPolygons();
for (int p=0; p<numpolys; p++) for (int p=0; p<numpolys; p++)
if (m_Polygons[p]->IsCollider()) if (m_Polygons[p]->IsCollider())
return true; return true;
return false; return false;
} }
void RAS_MeshObject::SchedulePolygons(int drawingmode) void RAS_MeshObject::SchedulePolygons(int drawingmode)

View File

@@ -39,6 +39,7 @@ if(APPLE)
set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/$(CONFIGURATION)/blender.app/Contents/MacOS/blender) set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/$(CONFIGURATION)/blender.app/Contents/MacOS/blender)
else() else()
set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/blender.app/Contents/MacOS/blender) set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/blender.app/Contents/MacOS/blender)
endif()
else() else()
set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/blender) set(TEST_BLENDER_EXE ${EXECUTABLE_OUTPUT_PATH}/blender)
endif() endif()