From 9a997093d7b75d09fc3e939e5799292ffb51d9ce Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Sat, 26 Mar 2011 00:28:10 +0000 Subject: [PATCH] scon fixes --- source/blender/bmesh/intern/bmesh_interp.c | 90 +- source/blender/makesrna/intern/rna_mesh.c | 4 +- source/blender/python/intern/bpy_array.c | 606 --------- source/blender/python/intern/bpy_rna.h | 1 + .../render/intern/source/rayobject_blibvh.c | 169 --- .../render/intern/source/rayobject_instance.c | 207 ---- .../render/intern/source/rayobject_octree.c | 1080 ----------------- .../intern/source/rayobject_raycounter.c | 87 -- source/gameengine/Ketsji/KX_PythonInit.cpp | 4 - .../RAS_OpenGLRasterizer.cpp | 4 - 10 files changed, 92 insertions(+), 2160 deletions(-) delete mode 100644 source/blender/python/intern/bpy_array.c delete mode 100644 source/blender/render/intern/source/rayobject_blibvh.c delete mode 100644 source/blender/render/intern/source/rayobject_instance.c delete mode 100644 source/blender/render/intern/source/rayobject_octree.c delete mode 100644 source/blender/render/intern/source/rayobject_raycounter.c diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 6fea3054f14..cd945d3cc22 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -175,8 +175,6 @@ void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex, } } - - /** * BM_data_interp_from_face * @@ -218,6 +216,94 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) BLI_array_free(blocks); } +#if 0 +static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3], float e1[3], float e2[3]) +{ + float cent[3]; + BMLoop *l2; + + /*computer center*/ + l2 = bm_firstfaceloop(l->f); + do { + add_v3_v3(v4, l2->v->co); + l2 = l2->next; + } whlie (l2 != bm_firstfaceloop(l->f)); + + mul_v3_fl(v4, 1.0/(float)l->f->len); + + copy_v3_v3(v1, l->prev->v->co); + copy_v3_v3(v2, l->v->co); + copy_v3_v3(v3, l->next->v->co); + + sub_v3_v3v3(e1, v1, v4); + sub_v3_v3v3(e2, v2, v3); +} + +/*tl is loop to project onto, sl is loop whose internal displacement, co, is being + projected. x and y are location in loop's mdisps grid of co.*/ +static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float co, int *x, int *y) +{ + float v1[3], v2[3], v3[3], v4[3], e1[3], e2[3]; + float dir[3], uv[3], hit[3]; + float eps = FLT_EPSILON*7; + + computer_mdisp_quad(tl, v1, v2, v3, v4, e1, e2); + copy_v3_v3(dir, l->f->no); + + /*four tests, two per triangle, once again normal, once along -normal*/ + ret = isect_ray_tri_epsilon_v3(co, dir, v1, v2, v3, &l, uv, eps); + ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v3, v4, &l, uv, eps); + if (!ret) { + negate_v3(dir); + ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v2, v3, &l, uv, eps); + ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v3, v4, &l, uv, eps); + } + if (!ret) + return 0; + + mul_v3_fl(dir, l); + add_v3_v3v3(hit, co, dir); + +} + +static void bmesh_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) +{ + MDisps *mdisps; + BMLoop *l2; + float x, y, d, v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3], e3[3], e4[3]; + int i; + + if (!CustomData_has_layer(&bm->ldata, CD_MDISPS)) + return; + + mdisps = CustomData_bmesh_get(&bm->ldata, CD_MDISPS); + + computer_mdisp_quad(target, v1, v2, v3, v4, e1, e2); + + d = 1.0f/sqrt(mdisps->totdisp); + for (x=0.0f; x<1.0f; x += d) { + for (y=0.0f; y<1.0f; y+= d) { + float co1[3], co2[3], co[3]; + + copy_v3_v3v3(co1, e1); + mul_v3_fl(co1, y); + copy_v3_v3v3(co1, e2); + mul_v3_fl(co1, y); + + sub_v3_v3v3(co, co2, co1); + mul_v3_fl(co, x); + add_v3_v3v3(co, co1); + + l2 = bm_firstfaceloop(target->f); + do { + l2 = l2->next; + } while (l2 != bm_firstfaceloop(target->f)); + } + } + //for (i=0; ildata, CD_MDISPS); i++) { + //} +} +#endif void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source) { BMLoop *l; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index f667f72906b..dd072ba99c0 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -55,6 +55,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_mesh.h" + static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id= ptr->id.data; @@ -1013,7 +1015,7 @@ static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext CustomDataLayer *cdl= NULL; int index; - if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) { + if(ED_mesh_uv_texture_add(C, me, name, FALSE)) { pdata= rna_mesh_pdata(me); index= CustomData_get_named_layer_index(pdata, CD_MTEXPOLY, name); cdl= (index == -1)? NULL: &pdata->layers[index]; diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c deleted file mode 100644 index 1afd54b3607..00000000000 --- a/source/blender/python/intern/bpy_array.c +++ /dev/null @@ -1,606 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Arystanbek Dyussenov - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "bpy_rna.h" -#include "BKE_global.h" -#include "MEM_guardedalloc.h" - -#define MAX_ARRAY_DIMENSION 10 - -typedef void (*ItemConvertFunc)(PyObject *, char *); -typedef int (*ItemTypeCheckFunc)(PyObject *); -typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *); -typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *); - -/* - arr[3][4][5] - 0 1 2 <- dimension index -*/ - -/* - arr[2] = x - - py_to_array_index(arraydim=0, arrayoffset=0, index=2) - validate_array(lvalue_dim=0) - ... make real index ... -*/ - -/* arr[3]=x, self->arraydim is 0, lvalue_dim is 1 */ -/* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */ -static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[], - ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix) -{ - int i; - - /* not the last dimension */ - if (dim + 1 < totdim) { - /* check that a sequence contains dimsize[dim] items */ - - for (i= 0; i < PySequence_Length(seq); i++) { - PyObject *item; - int ok= 1; - item= PySequence_GetItem(seq, i); - - if (!PySequence_Check(item)) { - /* BLI_snprintf(error_str, error_str_size, "expected a sequence of %s", item_type_str); */ - PyErr_Format(PyExc_TypeError, "%s expected a sequence of %s", error_prefix, item_type_str); - ok= 0; - } - /* arr[3][4][5] - dimsize[1]=4 - dimsize[2]=5 - - dim=0 */ - else if (PySequence_Length(item) != dimsize[dim + 1]) { - /* BLI_snprintf(error_str, error_str_size, "sequences of dimension %d should contain %d items", (int)dim + 1, (int)dimsize[dim + 1]); */ - PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items", error_prefix, (int)dim + 1, (int)dimsize[dim + 1]); - ok= 0; - } - else if (!validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix)) { - ok= 0; - } - - Py_DECREF(item); - - if (!ok) - return 0; - } - } - else { - /* check that items are of correct type */ - for (i= 0; i < PySequence_Length(seq); i++) { - PyObject *item= PySequence_GetItem(seq, i); - - if (!check_item_type(item)) { - Py_DECREF(item); - - /* BLI_snprintf(error_str, error_str_size, "sequence items should be of type %s", item_type_str); */ - PyErr_Format(PyExc_TypeError, "sequence items should be of type %s", item_type_str); - return 0; - } - - Py_DECREF(item); - } - } - - return 1; -} - -/* Returns the number of items in a single- or multi-dimensional sequence. */ -static int count_items(PyObject *seq) -{ - int totitem= 0; - - if (PySequence_Check(seq)) { - int i; - for (i= 0; i < PySequence_Length(seq); i++) { - PyObject *item= PySequence_GetItem(seq, i); - totitem += count_items(item); - Py_DECREF(item); - } - } - else - totitem= 1; - - return totitem; -} - -/* Modifies property array length if needed and PROP_DYNAMIC flag is set. */ -static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int *totitem, const char *error_prefix) -{ - int dimsize[MAX_ARRAY_DIMENSION]; - int tot, totdim, len; - - tot= count_items(rvalue); - totdim= RNA_property_array_dimension(ptr, prop, dimsize); - - if ((RNA_property_flag(prop) & PROP_DYNAMIC) && lvalue_dim == 0) { - if (RNA_property_array_length(ptr, prop) != tot) { -#if 0 - /* length is flexible */ - if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) { - /* BLI_snprintf(error_str, error_str_size, "%s.%s: array length cannot be changed to %d", RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */ - PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); - return 0; - } -#else - *totitem= tot; - return 1; - -#endif - } - - len= tot; - } - else { - /* length is a constraint */ - if (!lvalue_dim) { - len= RNA_property_array_length(ptr, prop); - } - /* array item assignment */ - else { - int i; - - len= 1; - - /* arr[3][4][5] - - arr[2] = x - dimsize={4, 5} - dimsize[1] = 4 - dimsize[2] = 5 - lvalue_dim=0, totdim=3 - - arr[2][3] = x - lvalue_dim=1 - - arr[2][3][4] = x - lvalue_dim=2 */ - for (i= lvalue_dim; i < totdim; i++) - len *= dimsize[i]; - } - - if (tot != len) { - /* BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len); */ - PyErr_Format(PyExc_ValueError, "%s sequence must have %d items total", error_prefix, len); - return 0; - } - } - - *totitem= len; - - return 1; -} - -static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, ItemTypeCheckFunc check_item_type, const char *item_type_str, int *totitem, const char *error_prefix) -{ - int dimsize[MAX_ARRAY_DIMENSION]; - int totdim= RNA_property_array_dimension(ptr, prop, dimsize); - - /* validate type first because length validation may modify property array length */ - - if (!validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix)) - return 0; - - return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix); -} - -static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int dim, char *data, unsigned int item_size, int *index, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index) -{ - unsigned int i; - int totdim= RNA_property_array_dimension(ptr, prop, NULL); - - for (i= 0; i < PySequence_Length(seq); i++) { - PyObject *item= PySequence_GetItem(seq, i); - - if (dim + 1 < totdim) { - data= copy_values(item, ptr, prop, dim + 1, data, item_size, index, convert_item, rna_set_index); - } - else { - if (!data) { - char value[sizeof(int)]; - - convert_item(item, value); - rna_set_index(ptr, prop, *index, value); - *index = *index + 1; - } - else { - convert_item(item, data); - data += item_size; - } - } - - Py_DECREF(item); - } - - return data; -} - -static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) -{ - int totdim, dim_size[MAX_ARRAY_DIMENSION]; - int totitem; - char *data= NULL; - - totdim= RNA_property_array_dimension(ptr, prop, dim_size); - - if (!validate_array(py, ptr, prop, 0, check_item_type, item_type_str, &totitem, error_prefix)) { - return 0; - } - - if (totitem) { - /* note: this code is confusing */ - if(param_data && RNA_property_flag(prop) & PROP_DYNAMIC) { - /* not freeing allocated mem, RNA_parameter_list_free() will do this */ - ParameterDynAlloc *param_alloc= (ParameterDynAlloc *)param_data; - param_alloc->array_tot= (int)totitem; - param_alloc->array= MEM_callocN(item_size * totitem, "py_to_array dyn"); /* freeing param list will free */ - - data= param_alloc->array; - } - else if (param_data) { - data= param_data; - } - else { - data= PyMem_MALLOC(item_size * totitem); - } - - copy_values(py, ptr, prop, 0, data, item_size, NULL, convert_item, NULL); - - if (param_data==NULL) { - /* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */ - rna_set_array(ptr, prop, data); - PyMem_FREE(data); - } - } - - return 1; -} - -static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int arrayoffset, int index, ItemTypeCheckFunc check_item_type, const char *item_type_str, ItemConvertFunc convert_item, RNA_SetIndexFunc rna_set_index, const char *error_prefix) -{ - int totdim, dimsize[MAX_ARRAY_DIMENSION]; - int totitem, i; - - totdim= RNA_property_array_dimension(ptr, prop, dimsize); - - /* convert index */ - - /* arr[3][4][5] - - arr[2] = x - lvalue_dim=0, index = 0 + 2 * 4 * 5 - - arr[2][3] = x - lvalue_dim=1, index = 40 + 3 * 5 */ - - lvalue_dim++; - - for (i= lvalue_dim; i < totdim; i++) - index *= dimsize[i]; - - index += arrayoffset; - - if (!validate_array(py, ptr, prop, lvalue_dim, check_item_type, item_type_str, &totitem, error_prefix)) - return 0; - - if (totitem) - copy_values(py, ptr, prop, lvalue_dim, NULL, 0, &index, convert_item, rna_set_index); - - return 1; -} - -static void py_to_float(PyObject *py, char *data) -{ - *(float*)data= (float)PyFloat_AsDouble(py); -} - -static void py_to_int(PyObject *py, char *data) -{ - *(int*)data= (int)PyLong_AsSsize_t(py); -} - -static void py_to_bool(PyObject *py, char *data) -{ - *(int*)data= (int)PyObject_IsTrue(py); -} - -static int py_float_check(PyObject *py) -{ - /* accept both floats and integers */ - return PyFloat_Check(py) || PyLong_Check(py); -} - -static int py_int_check(PyObject *py) -{ - /* accept only integers */ - return PyLong_Check(py); -} - -static int py_bool_check(PyObject *py) -{ - return PyBool_Check(py); -} - -static void float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value) -{ - RNA_property_float_set_index(ptr, prop, index, *(float*)value); -} - -static void int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value) -{ - RNA_property_int_set_index(ptr, prop, index, *(int*)value); -} - -static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value) -{ - RNA_property_boolean_set_index(ptr, prop, index, *(int*)value); -} - -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix) -{ - int ret; - switch (RNA_property_type(prop)) { - case PROP_FLOAT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); - break; - case PROP_INT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); - break; - case PROP_BOOLEAN: - ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); - break; - default: - PyErr_SetString(PyExc_TypeError, "not an array type"); - ret= 0; - } - - return ret; -} - -int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix) -{ - int ret; - switch (RNA_property_type(prop)) { - case PROP_FLOAT: - ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index, py_float_check, "float", py_to_float, float_set_index, error_prefix); - break; - case PROP_INT: - ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index, py_int_check, "int", py_to_int, int_set_index, error_prefix); - break; - case PROP_BOOLEAN: - ret= py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index, py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix); - break; - default: - PyErr_SetString(PyExc_TypeError, "not an array type"); - ret= 0; - } - - return ret; -} - -static PyObject *pyrna_array_item(PointerRNA *ptr, PropertyRNA *prop, int index) -{ - PyObject *item; - - switch (RNA_property_type(prop)) { - case PROP_FLOAT: - item= PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index)); - break; - case PROP_BOOLEAN: - item= PyBool_FromLong(RNA_property_boolean_get_index(ptr, prop, index)); - break; - case PROP_INT: - item= PyLong_FromSsize_t(RNA_property_int_get_index(ptr, prop, index)); - break; - default: - PyErr_SetString(PyExc_TypeError, "not an array type"); - item= NULL; - } - - return item; -} - -#if 0 -/* XXX this is not used (and never will?) */ -/* Given an array property, creates an N-dimensional tuple of values. */ -static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop, int dim, int *index) -{ - PyObject *tuple; - int i, len; - int totdim= RNA_property_array_dimension(ptr, prop, NULL); - - len= RNA_property_multi_array_length(ptr, prop, dim); - - tuple= PyTuple_New(len); - - for (i= 0; i < len; i++) { - PyObject *item; - - if (dim + 1 < totdim) - item= pyrna_py_from_array_internal(ptr, prop, dim + 1, index); - else { - item= pyrna_array_item(ptr, prop, *index); - *index= *index + 1; - } - - if (!item) { - Py_DECREF(tuple); - return NULL; - } - - PyTuple_SetItem(tuple, i, item); - } - - return tuple; -} -#endif - -PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index) -{ - int totdim, arraydim, arrayoffset, dimsize[MAX_ARRAY_DIMENSION], i, len; - BPy_PropertyArrayRNA *ret= NULL; - - arraydim= self ? self->arraydim : 0; - arrayoffset = self ? self->arrayoffset : 0; - - /* just in case check */ - len= RNA_property_multi_array_length(ptr, prop, arraydim); - if (index >= len || index < 0) { - /* this shouldn't happen because higher level funcs must check for invalid index */ - if (G.f & G_DEBUG) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len); - - PyErr_SetString(PyExc_IndexError, "out of range"); - return NULL; - } - - totdim= RNA_property_array_dimension(ptr, prop, dimsize); - - if (arraydim + 1 < totdim) { - ret= (BPy_PropertyArrayRNA*)pyrna_prop_CreatePyObject(ptr, prop); - ret->arraydim= arraydim + 1; - - /* arr[3][4][5] - - x = arr[2] - index = 0 + 2 * 4 * 5 - - x = arr[2][3] - index = offset + 3 * 5 */ - - for (i= arraydim + 1; i < totdim; i++) - index *= dimsize[i]; - - ret->arrayoffset= arrayoffset + index; - } - else { - index = arrayoffset + index; - ret= (BPy_PropertyArrayRNA *)pyrna_array_item(ptr, prop, index); - } - - return (PyObject*)ret; -} - -PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop) -{ - PyObject *ret; - - ret= pyrna_math_object_from_array(ptr, prop); - - /* is this a maths object? */ - if (ret) return ret; - - return pyrna_prop_CreatePyObject(ptr, prop); -} - -/* TODO, multi-dimensional arrays */ -int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) -{ - int len= RNA_property_array_length(ptr, prop); - int type; - int i; - - if(len==0) /* possible with dynamic arrays */ - return 0; - - if (RNA_property_array_dimension(ptr, prop, NULL) > 1) { - PyErr_SetString(PyExc_TypeError, "PropertyRNA - multi dimensional arrays not supported yet"); - return -1; - } - - type= RNA_property_type(prop); - - switch (type) { - case PROP_FLOAT: - { - float value_f= PyFloat_AsDouble(value); - if(value_f==-1 && PyErr_Occurred()) { - PyErr_Clear(); - return 0; - } - else { - float tmp[32]; - float *tmp_arr; - - if(len * sizeof(float) > sizeof(tmp)) { - tmp_arr= PyMem_MALLOC(len * sizeof(float)); - } - else { - tmp_arr= tmp; - } - - RNA_property_float_get_array(ptr, prop, tmp_arr); - - for(i=0; i sizeof(tmp)) { - tmp_arr= PyMem_MALLOC(len * sizeof(int)); - } - else { - tmp_arr= tmp; - } - - if(type==PROP_BOOLEAN) - RNA_property_boolean_get_array(ptr, prop, tmp_arr); - else - RNA_property_int_get_array(ptr, prop, tmp_arr); - - for(i=0; i extern PyTypeObject pyrna_struct_meta_idprop_Type; extern PyTypeObject pyrna_struct_Type; diff --git a/source/blender/render/intern/source/rayobject_blibvh.c b/source/blender/render/intern/source/rayobject_blibvh.c deleted file mode 100644 index 16c2dcb83d8..00000000000 --- a/source/blender/render/intern/source/rayobject_blibvh.c +++ /dev/null @@ -1,169 +0,0 @@ -/** - * $Id: rayobject_blibvh.c 23649 2009-10-06 02:56:11Z jaguarandi $ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): André Pinto. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include - -#include "MEM_guardedalloc.h" -#include "BKE_utildefines.h" -#include "BLI_kdopbvh.h" -#include "BLI_math.h" -#include "RE_raytrace.h" -#include "render_types.h" -#include "rayobject.h" - -static int RE_rayobject_blibvh_intersect(RayObject *o, Isect *isec); -static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob); -static void RE_rayobject_blibvh_done(RayObject *o); -static void RE_rayobject_blibvh_free(RayObject *o); -static void RE_rayobject_blibvh_bb(RayObject *o, float *min, float *max); - -static float RE_rayobject_blibvh_cost(RayObject *o) -{ - //TODO calculate the expected cost to raycast on this structure - return 1.0; -} - -static void RE_rayobject_blibvh_hint_bb(RayObject *o, RayHint *hint, float *min, float *max) -{ - return; -} - -static RayObjectAPI bvh_api = -{ - RE_rayobject_blibvh_intersect, - RE_rayobject_blibvh_add, - RE_rayobject_blibvh_done, - RE_rayobject_blibvh_free, - RE_rayobject_blibvh_bb, - RE_rayobject_blibvh_cost, - RE_rayobject_blibvh_hint_bb -}; - -typedef struct BVHObject -{ - RayObject rayobj; - RayObject **leafs, **next_leaf; - BVHTree *bvh; - float bb[2][3]; - -} BVHObject; - - -RayObject *RE_rayobject_blibvh_create(int size) -{ - BVHObject *obj= (BVHObject*)MEM_callocN(sizeof(BVHObject), "BVHObject"); - assert( RE_rayobject_isAligned(obj) ); /* RayObject API assumes real data to be 4-byte aligned */ - - obj->rayobj.api = &bvh_api; - obj->bvh = BLI_bvhtree_new(size, 0.0, 4, 6); - obj->next_leaf = obj->leafs = (RayObject**)MEM_callocN(size*sizeof(RayObject*), "BVHObject leafs"); - - INIT_MINMAX(obj->bb[0], obj->bb[1]); - return RE_rayobject_unalignRayAPI((RayObject*) obj); -} - -struct BVHCallbackUserData -{ - Isect *isec; - RayObject **leafs; -}; - -static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) -{ - struct BVHCallbackUserData *data = (struct BVHCallbackUserData*)userdata; - Isect *isec = data->isec; - RayObject *face = data->leafs[index]; - - if(RE_rayobject_intersect(face,isec)) - { - hit->index = index; - - if(isec->mode == RE_RAY_SHADOW) - hit->dist = 0; - else - hit->dist = isec->labda*isec->dist; - } -} - -static int RE_rayobject_blibvh_intersect(RayObject *o, Isect *isec) -{ - BVHObject *obj = (BVHObject*)o; - BVHTreeRayHit hit; - float dir[3]; - struct BVHCallbackUserData data; - data.isec = isec; - data.leafs = obj->leafs; - - VECCOPY(dir, isec->vec); - normalize_v3(dir); - - hit.index = 0; - hit.dist = isec->labda*isec->dist; - - return BLI_bvhtree_ray_cast(obj->bvh, isec->start, dir, 0.0, &hit, bvh_callback, (void*)&data); -} - -static void RE_rayobject_blibvh_add(RayObject *o, RayObject *ob) -{ - BVHObject *obj = (BVHObject*)o; - float min_max[6]; - INIT_MINMAX(min_max, min_max+3); - RE_rayobject_merge_bb(ob, min_max, min_max+3); - - DO_MIN(min_max , obj->bb[0]); - DO_MAX(min_max+3, obj->bb[1]); - - BLI_bvhtree_insert(obj->bvh, obj->next_leaf - obj->leafs, min_max, 2 ); - *(obj->next_leaf++) = ob; -} - -static void RE_rayobject_blibvh_done(RayObject *o) -{ - BVHObject *obj = (BVHObject*)o; - BLI_bvhtree_balance(obj->bvh); -} - -static void RE_rayobject_blibvh_free(RayObject *o) -{ - BVHObject *obj = (BVHObject*)o; - - if(obj->bvh) - BLI_bvhtree_free(obj->bvh); - - if(obj->leafs) - MEM_freeN(obj->leafs); - - MEM_freeN(obj); -} - -static void RE_rayobject_blibvh_bb(RayObject *o, float *min, float *max) -{ - BVHObject *obj = (BVHObject*)o; - DO_MIN( obj->bb[0], min ); - DO_MAX( obj->bb[1], max ); -} diff --git a/source/blender/render/intern/source/rayobject_instance.c b/source/blender/render/intern/source/rayobject_instance.c deleted file mode 100644 index a3e062c01c6..00000000000 --- a/source/blender/render/intern/source/rayobject_instance.c +++ /dev/null @@ -1,207 +0,0 @@ -/** - * $Id: rayobject_instance.c 23763 2009-10-10 18:42:20Z jaguarandi $ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): André Pinto. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include - -#include "MEM_guardedalloc.h" -#include "BKE_utildefines.h" -#include "BLI_math.h" -#include "RE_raytrace.h" -#include "rayobject.h" - -#define RE_COST_INSTANCE (1.0f) - -static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec); -static void RE_rayobject_instance_free(RayObject *o); -static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max); -static float RE_rayobject_instance_cost(RayObject *o); - -static void RE_rayobject_instance_hint_bb(RayObject *o, RayHint *hint, float *min, float *max) -{} - -static RayObjectAPI instance_api = -{ - RE_rayobject_instance_intersect, - NULL, //static void RE_rayobject_instance_add(RayObject *o, RayObject *ob); - NULL, //static void RE_rayobject_instance_done(RayObject *o); - RE_rayobject_instance_free, - RE_rayobject_instance_bb, - RE_rayobject_instance_cost, - RE_rayobject_instance_hint_bb -}; - -typedef struct InstanceRayObject -{ - RayObject rayobj; - RayObject *target; - - void *ob; //Object represented by this instance - void *target_ob; //Object represented by the inner RayObject, needed to handle self-intersection - - float global2target[4][4]; - float target2global[4][4]; - -} InstanceRayObject; - - -RayObject *RE_rayobject_instance_create(RayObject *target, float transform[][4], void *ob, void *target_ob) -{ - InstanceRayObject *obj= (InstanceRayObject*)MEM_callocN(sizeof(InstanceRayObject), "InstanceRayObject"); - assert( RE_rayobject_isAligned(obj) ); /* RayObject API assumes real data to be 4-byte aligned */ - - obj->rayobj.api = &instance_api; - obj->target = target; - obj->ob = ob; - obj->target_ob = target_ob; - - copy_m4_m4(obj->target2global, transform); - invert_m4_m4(obj->global2target, obj->target2global); - - return RE_rayobject_unalignRayAPI((RayObject*) obj); -} - -static int RE_rayobject_instance_intersect(RayObject *o, Isect *isec) -{ - //TODO - // *there is probably a faster way to convert between coordinates - - InstanceRayObject *obj = (InstanceRayObject*)o; - int res; - float start[3], vec[3], labda, dist; - int changed = 0, i; - - //TODO - this is disabling self intersection on instances - if(isec->orig.ob == obj->ob && obj->ob) - { - changed = 1; - isec->orig.ob = obj->target_ob; - } - - - VECCOPY( start, isec->start ); - VECCOPY( vec , isec->vec ); - labda = isec->labda; - dist = isec->dist; - - //Transform to target coordinates system - VECADD( isec->vec, isec->vec, isec->start ); - - mul_m4_v3(obj->global2target, isec->start); - mul_m4_v3(obj->global2target, isec->vec ); - - isec->dist = len_v3v3( isec->start, isec->vec ); - VECSUB( isec->vec, isec->vec, isec->start ); - - isec->labda *= isec->dist / dist; - - //Update idot_axis and bv_index - for(i=0; i<3; i++) - { - isec->idot_axis[i] = 1.0f / isec->vec[i]; - - isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0; - isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i]; - - isec->bv_index[2*i] = i+3*isec->bv_index[2*i]; - isec->bv_index[2*i+1] = i+3*isec->bv_index[2*i+1]; - } - - //Raycast - res = RE_rayobject_intersect(obj->target, isec); - - //Restore coordinate space coords - if(res == 0) - { - isec->labda = labda; - } - else - { - isec->labda *= dist / isec->dist; - isec->hit.ob = obj->ob; - -#ifdef RT_USE_LAST_HIT - // TODO support for last hit optimization in instances that can jump - // directly to the last hit face. - // For now it jumps directly to the last-hit instance root node. - isec->last_hit = RE_rayobject_unalignRayAPI((RayObject*) obj); -#endif - } - isec->dist = dist; - VECCOPY( isec->start, start ); - VECCOPY( isec->vec, vec ); - - if(changed) - isec->orig.ob = obj->ob; - - //Update idot_axis and bv_index - for(i=0; i<3; i++) - { - isec->idot_axis[i] = 1.0f / isec->vec[i]; - - isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ? 1 : 0; - isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i]; - - isec->bv_index[2*i] = i+3*isec->bv_index[2*i]; - isec->bv_index[2*i+1] = i+3*isec->bv_index[2*i+1]; - } - - return res; -} - -static void RE_rayobject_instance_free(RayObject *o) -{ - InstanceRayObject *obj = (InstanceRayObject*)o; - MEM_freeN(obj); -} - -static float RE_rayobject_instance_cost(RayObject *o) -{ - InstanceRayObject *obj = (InstanceRayObject*)o; - return RE_rayobject_cost(obj->target) + RE_COST_INSTANCE; -} - -static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max) -{ - //TODO: - // *better bb.. calculated without rotations of bb - // *maybe cache that better-fitted-BB at the InstanceRayObject - InstanceRayObject *obj = (InstanceRayObject*)o; - - float m[3], M[3], t[3]; - int i, j; - INIT_MINMAX(m, M); - RE_rayobject_merge_bb(obj->target, m, M); - - //There must be a faster way than rotating all the 8 vertexs of the BB - for(i=0; i<8; i++) - { - for(j=0; j<3; j++) t[j] = i&(1<target2global, t); - DO_MINMAX(t, min, max); - } -} diff --git a/source/blender/render/intern/source/rayobject_octree.c b/source/blender/render/intern/source/rayobject_octree.c deleted file mode 100644 index 98265d166d0..00000000000 --- a/source/blender/render/intern/source/rayobject_octree.c +++ /dev/null @@ -1,1080 +0,0 @@ -/** - * $Id: rayobject_octree.c 23649 2009-10-06 02:56:11Z jaguarandi $ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 1990-1998 NeoGeo BV. - * All rights reserved. - * - * Contributors: 2004/2005 Blender Foundation, full recode - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/* IMPORTANT NOTE: this code must be independent of any other render code - to use it outside the renderer! */ - -#include -#include -#include -#include -#include - -#include "MEM_guardedalloc.h" - -#include "DNA_material_types.h" - -#include "BKE_utildefines.h" - -#include "BLI_math.h" - -#include "rayobject.h" - -/* ********** structs *************** */ -#define BRANCH_ARRAY 1024 -#define NODE_ARRAY 4096 - -typedef struct Branch -{ - struct Branch *b[8]; -} Branch; - -typedef struct OcVal -{ - short ocx, ocy, ocz; -} OcVal; - -typedef struct Node -{ - struct RayFace *v[8]; - struct OcVal ov[8]; - struct Node *next; -} Node; - -typedef struct Octree { - RayObject rayobj; - - struct Branch **adrbranch; - struct Node **adrnode; - float ocsize; /* ocsize: mult factor, max size octree */ - float ocfacx,ocfacy,ocfacz; - float min[3], max[3]; - int ocres; - int branchcount, nodecount; - - /* during building only */ - char *ocface; - - RayFace **ro_nodes; - int ro_nodes_size, ro_nodes_used; - -} Octree; - -static int RE_rayobject_octree_intersect(RayObject *o, Isect *isec); -static void RE_rayobject_octree_add(RayObject *o, RayObject *ob); -static void RE_rayobject_octree_done(RayObject *o); -static void RE_rayobject_octree_free(RayObject *o); -static void RE_rayobject_octree_bb(RayObject *o, float *min, float *max); - -/* - * This function is not expected to be called by current code state. - */ -static float RE_rayobject_octree_cost(RayObject *o) -{ - return 1.0; -} - -static void RE_rayobject_octree_hint_bb(RayObject *o, RayHint *hint, float *min, float *max) -{ - return; -} - -static RayObjectAPI octree_api = -{ - RE_rayobject_octree_intersect, - RE_rayobject_octree_add, - RE_rayobject_octree_done, - RE_rayobject_octree_free, - RE_rayobject_octree_bb, - RE_rayobject_octree_cost, - RE_rayobject_octree_hint_bb -}; - -/* **************** ocval method ******************* */ -/* within one octree node, a set of 3x15 bits defines a 'boundbox' to OR with */ - -#define OCVALRES 15 -#define BROW16(min, max) (((max)>=OCVALRES? 0xFFFF: (1<<(max+1))-1) - ((min>0)? ((1<<(min))-1):0) ) - -static void calc_ocval_face(float *v1, float *v2, float *v3, float *v4, short x, short y, short z, OcVal *ov) -{ - float min[3], max[3]; - int ocmin, ocmax; - - VECCOPY(min, v1); - VECCOPY(max, v1); - DO_MINMAX(v2, min, max); - DO_MINMAX(v3, min, max); - if(v4) { - DO_MINMAX(v4, min, max); - } - - ocmin= OCVALRES*(min[0]-x); - ocmax= OCVALRES*(max[0]-x); - ov->ocx= BROW16(ocmin, ocmax); - - ocmin= OCVALRES*(min[1]-y); - ocmax= OCVALRES*(max[1]-y); - ov->ocy= BROW16(ocmin, ocmax); - - ocmin= OCVALRES*(min[2]-z); - ocmax= OCVALRES*(max[2]-z); - ov->ocz= BROW16(ocmin, ocmax); - -} - -static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1, float *vec2) -{ - int ocmin, ocmax; - - if(vec1[0]ocx= BROW16(ocmin, ocmax); - - if(vec1[1]ocy= BROW16(ocmin, ocmax); - - if(vec1[2]ocz= BROW16(ocmin, ocmax); -} - -/* ************* octree ************** */ - -static Branch *addbranch(Octree *oc, Branch *br, short ocb) -{ - int index; - - if(br->b[ocb]) return br->b[ocb]; - - oc->branchcount++; - index= oc->branchcount>>12; - - if(oc->adrbranch[index]==NULL) - oc->adrbranch[index]= MEM_callocN(4096*sizeof(Branch), "new oc branch"); - - if(oc->branchcount>= BRANCH_ARRAY*4096) { - printf("error; octree branches full\n"); - oc->branchcount=0; - } - - return br->b[ocb]= oc->adrbranch[index]+(oc->branchcount & 4095); -} - -static Node *addnode(Octree *oc) -{ - int index; - - oc->nodecount++; - index= oc->nodecount>>12; - - if(oc->adrnode[index]==NULL) - oc->adrnode[index]= MEM_callocN(4096*sizeof(Node),"addnode"); - - if(oc->nodecount> NODE_ARRAY*NODE_ARRAY) { - printf("error; octree nodes full\n"); - oc->nodecount=0; - } - - return oc->adrnode[index]+(oc->nodecount & 4095); -} - -static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]) -{ - static float nor[3], d; - float fx, fy, fz; - - // init static vars - if(face) { - normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]); - d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2]; - return 0; - } - - fx= x; - fy= y; - fz= z; - - if((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) { - if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d < 0.0f) return 1; - - if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1; - } - else { - if((fx+1)*nor[0] + (fy )*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz )*nor[2] + d > 0.0f) return 1; - - if((fx )*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1; - } - - return 0; -} - -static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[][3]) -{ - Branch *br; - Node *no; - short a, oc0, oc1, oc2, oc3, oc4, oc5; - - x<<=2; - y<<=1; - - br= oc->adrbranch[0]; - - if(oc->ocres==512) { - oc0= ((x & 1024)+(y & 512)+(z & 256))>>8; - br= addbranch(oc, br, oc0); - } - if(oc->ocres>=256) { - oc0= ((x & 512)+(y & 256)+(z & 128))>>7; - br= addbranch(oc, br, oc0); - } - if(oc->ocres>=128) { - oc0= ((x & 256)+(y & 128)+(z & 64))>>6; - br= addbranch(oc, br, oc0); - } - - oc0= ((x & 128)+(y & 64)+(z & 32))>>5; - oc1= ((x & 64)+(y & 32)+(z & 16))>>4; - oc2= ((x & 32)+(y & 16)+(z & 8))>>3; - oc3= ((x & 16)+(y & 8)+(z & 4))>>2; - oc4= ((x & 8)+(y & 4)+(z & 2))>>1; - oc5= ((x & 4)+(y & 2)+(z & 1)); - - br= addbranch(oc, br,oc0); - br= addbranch(oc, br,oc1); - br= addbranch(oc, br,oc2); - br= addbranch(oc, br,oc3); - br= addbranch(oc, br,oc4); - no= (Node *)br->b[oc5]; - if(no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc)); - - while(no->next) no= no->next; - - a= 0; - if(no->v[7]) { /* node full */ - no->next= addnode(oc); - no= no->next; - } - else { - while(no->v[a]!=NULL) a++; - } - - no->v[a]= (RayFace*) RE_rayobject_align(face); - - if(quad) - calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x>>2, y>>1, z, &no->ov[a]); - else - calc_ocval_face(rtf[0], rtf[1], rtf[2], NULL, x>>2, y>>1, z, &no->ov[a]); -} - -static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocface, short rts[][3], float rtf[][3]) -{ - int ocx1,ocx2,ocy1,ocy2; - int x,y,dx=0,dy=0; - float ox1,ox2,oy1,oy2; - float labda,labdao,labdax,labday,ldx,ldy; - - ocx1= rts[b1][c1]; - ocy1= rts[b1][c2]; - ocx2= rts[b2][c1]; - ocy2= rts[b2][c2]; - - if(ocx1==ocx2 && ocy1==ocy2) { - ocface[oc->ocres*ocx1+ocy1]= 1; - return; - } - - ox1= rtf[b1][c1]; - oy1= rtf[b1][c2]; - ox2= rtf[b2][c1]; - oy2= rtf[b2][c2]; - - if(ox1!=ox2) { - if(ox2-ox1>0.0f) { - labdax= (ox1-ocx1-1.0f)/(ox1-ox2); - ldx= -1.0f/(ox1-ox2); - dx= 1; - } else { - labdax= (ox1-ocx1)/(ox1-ox2); - ldx= 1.0f/(ox1-ox2); - dx= -1; - } - } else { - labdax=1.0f; - ldx=0; - } - - if(oy1!=oy2) { - if(oy2-oy1>0.0f) { - labday= (oy1-ocy1-1.0f)/(oy1-oy2); - ldy= -1.0f/(oy1-oy2); - dy= 1; - } else { - labday= (oy1-ocy1)/(oy1-oy2); - ldy= 1.0f/(oy1-oy2); - dy= -1; - } - } else { - labday=1.0f; - ldy=0; - } - - x=ocx1; y=ocy1; - labda= MIN2(labdax, labday); - - while(TRUE) { - - if(x<0 || y<0 || x>=oc->ocres || y>=oc->ocres); - else ocface[oc->ocres*x+y]= 1; - - labdao=labda; - if(labdax==labday) { - labdax+=ldx; - x+=dx; - labday+=ldy; - y+=dy; - } else { - if(labdax=1.0f) break; - } - ocface[oc->ocres*ocx2+ocy2]=1; -} - -static void filltriangle(Octree *oc, short c1, short c2, char *ocface, short *ocmin, short *ocmax) -{ - int a, x, y, y1, y2; - - for(x=ocmin[c1];x<=ocmax[c1];x++) { - a= oc->ocres*x; - for(y=ocmin[c2];y<=ocmax[c2];y++) { - if(ocface[a+y]) { - y++; - while(ocface[a+y] && y!=ocmax[c2]) y++; - for(y1=ocmax[c2];y1>y;y1--) { - if(ocface[a+y1]) { - for(y2=y;y2<=y1;y2++) ocface[a+y2]=1; - y1=0; - } - } - y=ocmax[c2]; - } - } - } -} - -static void RE_rayobject_octree_free(RayObject *tree) -{ - Octree *oc= (Octree*)tree; - -#if 0 - printf("branches %d nodes %d\n", oc->branchcount, oc->nodecount); - printf("raycount %d \n", raycount); - printf("ray coherent %d \n", coherent_ray); - printf("accepted %d rejected %d\n", accepted, rejected); -#endif - if(oc->ocface) - MEM_freeN(oc->ocface); - - if(oc->adrbranch) { - int a= 0; - while(oc->adrbranch[a]) { - MEM_freeN(oc->adrbranch[a]); - oc->adrbranch[a]= NULL; - a++; - } - MEM_freeN(oc->adrbranch); - oc->adrbranch= NULL; - } - oc->branchcount= 0; - - if(oc->adrnode) { - int a= 0; - while(oc->adrnode[a]) { - MEM_freeN(oc->adrnode[a]); - oc->adrnode[a]= NULL; - a++; - } - MEM_freeN(oc->adrnode); - oc->adrnode= NULL; - } - oc->nodecount= 0; - - MEM_freeN(oc); -} - - -RayObject *RE_rayobject_octree_create(int ocres, int size) -{ - Octree *oc= MEM_callocN(sizeof(Octree), "Octree"); - assert( RE_rayobject_isAligned(oc) ); /* RayObject API assumes real data to be 4-byte aligned */ - - oc->rayobj.api = &octree_api; - - oc->ocres = ocres; - - oc->ro_nodes = (RayFace**)MEM_callocN(sizeof(RayFace*)*size, "octree rayobject nodes"); - oc->ro_nodes_size = size; - oc->ro_nodes_used = 0; - - - return RE_rayobject_unalignRayAPI((RayObject*) oc); -} - - -static void RE_rayobject_octree_add(RayObject *tree, RayObject *node) -{ - Octree *oc = (Octree*)tree; - - assert( RE_rayobject_isRayFace(node) ); - assert( oc->ro_nodes_used < oc->ro_nodes_size ); - oc->ro_nodes[ oc->ro_nodes_used++ ] = (RayFace*)RE_rayobject_align(node); -} - -static void octree_fill_rayface(Octree *oc, RayFace *face) -{ - float ocfac[3], rtf[4][3]; - float co1[3], co2[3], co3[3], co4[3]; - short rts[4][3]; - short ocmin[3], ocmax[3]; - char *ocface= oc->ocface; // front, top, size view of face, to fill in - int a, b, c, oc1, oc2, oc3, oc4, x, y, z, ocres2; - - ocfac[0]= oc->ocfacx; - ocfac[1]= oc->ocfacy; - ocfac[2]= oc->ocfacz; - - ocres2= oc->ocres*oc->ocres; - - VECCOPY(co1, face->v1); - VECCOPY(co2, face->v2); - VECCOPY(co3, face->v3); - if(face->v4) - VECCOPY(co4, face->v4); - - for(c=0;c<3;c++) { - rtf[0][c]= (co1[c]-oc->min[c])*ocfac[c] ; - rts[0][c]= (short)rtf[0][c]; - rtf[1][c]= (co2[c]-oc->min[c])*ocfac[c] ; - rts[1][c]= (short)rtf[1][c]; - rtf[2][c]= (co3[c]-oc->min[c])*ocfac[c] ; - rts[2][c]= (short)rtf[2][c]; - if(RE_rayface_isQuad(face)) { - rtf[3][c]= (co4[c]-oc->min[c])*ocfac[c] ; - rts[3][c]= (short)rtf[3][c]; - } - } - - for(c=0;c<3;c++) { - oc1= rts[0][c]; - oc2= rts[1][c]; - oc3= rts[2][c]; - if(!RE_rayface_isQuad(face)) { - ocmin[c]= MIN3(oc1,oc2,oc3); - ocmax[c]= MAX3(oc1,oc2,oc3); - } - else { - oc4= rts[3][c]; - ocmin[c]= MIN4(oc1,oc2,oc3,oc4); - ocmax[c]= MAX4(oc1,oc2,oc3,oc4); - } - if(ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1; - if(ocmin[c]<0) ocmin[c]=0; - } - - if(ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) { - ocwrite(oc, face, RE_rayface_isQuad(face), ocmin[0], ocmin[1], ocmin[2], rtf); - } - else { - - d2dda(oc, 0,1,0,1,ocface+ocres2,rts,rtf); - d2dda(oc, 0,1,0,2,ocface,rts,rtf); - d2dda(oc, 0,1,1,2,ocface+2*ocres2,rts,rtf); - d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf); - d2dda(oc, 1,2,0,2,ocface,rts,rtf); - d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf); - if(!RE_rayface_isQuad(face)) { - d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf); - d2dda(oc, 2,0,0,2,ocface,rts,rtf); - d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf); - } - else { - d2dda(oc, 2,3,0,1,ocface+ocres2,rts,rtf); - d2dda(oc, 2,3,0,2,ocface,rts,rtf); - d2dda(oc, 2,3,1,2,ocface+2*ocres2,rts,rtf); - d2dda(oc, 3,0,0,1,ocface+ocres2,rts,rtf); - d2dda(oc, 3,0,0,2,ocface,rts,rtf); - d2dda(oc, 3,0,1,2,ocface+2*ocres2,rts,rtf); - } - /* nothing todo with triangle..., just fills :) */ - filltriangle(oc, 0,1,ocface+ocres2,ocmin,ocmax); - filltriangle(oc, 0,2,ocface,ocmin,ocmax); - filltriangle(oc, 1,2,ocface+2*ocres2,ocmin,ocmax); - - /* init static vars here */ - face_in_node(face, 0,0,0, rtf); - - for(x=ocmin[0];x<=ocmax[0];x++) { - a= oc->ocres*x; - for(y=ocmin[1];y<=ocmax[1];y++) { - if(ocface[a+y+ocres2]) { - b= oc->ocres*y+2*ocres2; - for(z=ocmin[2];z<=ocmax[2];z++) { - if(ocface[b+z] && ocface[a+z]) { - if(face_in_node(NULL, x, y, z, rtf)) - ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf); - } - } - } - } - } - - /* same loops to clear octree, doubt it can be done smarter */ - for(x=ocmin[0];x<=ocmax[0];x++) { - a= oc->ocres*x; - for(y=ocmin[1];y<=ocmax[1];y++) { - /* x-y */ - ocface[a+y+ocres2]= 0; - - b= oc->ocres*y + 2*ocres2; - for(z=ocmin[2];z<=ocmax[2];z++) { - /* y-z */ - ocface[b+z]= 0; - /* x-z */ - ocface[a+z]= 0; - } - } - } - } -} - -static void RE_rayobject_octree_done(RayObject *tree) -{ - Octree *oc = (Octree*)tree; - int c; - float t00, t01, t02; - int ocres2 = oc->ocres*oc->ocres; - - INIT_MINMAX(oc->min, oc->max); - - /* Calculate Bounding Box */ - for(c=0; cro_nodes_used; c++) - RE_rayobject_merge_bb( RE_rayobject_unalignRayFace(oc->ro_nodes[c]), oc->min, oc->max); - - /* Alloc memory */ - oc->adrbranch= MEM_callocN(sizeof(void *)*BRANCH_ARRAY, "octree branches"); - oc->adrnode= MEM_callocN(sizeof(void *)*NODE_ARRAY, "octree nodes"); - - oc->adrbranch[0]=(Branch *)MEM_callocN(4096*sizeof(Branch), "makeoctree"); - - /* the lookup table, per face, for which nodes to fill in */ - oc->ocface= MEM_callocN( 3*ocres2 + 8, "ocface"); - memset(oc->ocface, 0, 3*ocres2); - - for(c=0;c<3;c++) { /* octree enlarge, still needed? */ - oc->min[c]-= 0.01f; - oc->max[c]+= 0.01f; - } - - t00= oc->max[0]-oc->min[0]; - t01= oc->max[1]-oc->min[1]; - t02= oc->max[2]-oc->min[2]; - - /* this minus 0.1 is old safety... seems to be needed? */ - oc->ocfacx= (oc->ocres-0.1)/t00; - oc->ocfacy= (oc->ocres-0.1)/t01; - oc->ocfacz= (oc->ocres-0.1)/t02; - - oc->ocsize= sqrt(t00*t00+t01*t01+t02*t02); /* global, max size octree */ - - for(c=0; cro_nodes_used; c++) - { - octree_fill_rayface(oc, oc->ro_nodes[c]); - } - - MEM_freeN(oc->ocface); - oc->ocface = NULL; - MEM_freeN(oc->ro_nodes); - oc->ro_nodes = NULL; - - printf("%f %f - %f\n", oc->min[0], oc->max[0], oc->ocfacx ); - printf("%f %f - %f\n", oc->min[1], oc->max[1], oc->ocfacy ); - printf("%f %f - %f\n", oc->min[2], oc->max[2], oc->ocfacz ); -} - -static void RE_rayobject_octree_bb(RayObject *tree, float *min, float *max) -{ - Octree *oc = (Octree*)tree; - DO_MINMAX(oc->min, min, max); - DO_MINMAX(oc->max, min, max); -} - -/* check all faces in this node */ -static int testnode(Octree *oc, Isect *is, Node *no, OcVal ocval) -{ - short nr=0; - - /* return on any first hit */ - if(is->mode==RE_RAY_SHADOW) { - - for(; no; no = no->next) - for(nr=0; nr<8; nr++) - { - RayFace *face = no->v[nr]; - OcVal *ov = no->ov+nr; - - if(!face) break; - - if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) - { - if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) - return 1; - } - } - } - else - { /* else mirror or glass or shadowtra, return closest face */ - int found= 0; - - for(; no; no = no->next) - for(nr=0; nr<8; nr++) - { - RayFace *face = no->v[nr]; - OcVal *ov = no->ov+nr; - - if(!face) break; - - if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) - { - if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) ) - found= 1; - } - } - - return found; - } - - return 0; -} - -/* find the Node for the octree coord x y z */ -static Node *ocread(Octree *oc, int x, int y, int z) -{ - Branch *br; - int oc1; - - x<<=2; - y<<=1; - - br= oc->adrbranch[0]; - - if(oc->ocres==512) { - oc1= ((x & 1024)+(y & 512)+(z & 256))>>8; - br= br->b[oc1]; - if(br==NULL) { - return NULL; - } - } - if(oc->ocres>=256) { - oc1= ((x & 512)+(y & 256)+(z & 128))>>7; - br= br->b[oc1]; - if(br==NULL) { - return NULL; - } - } - if(oc->ocres>=128) { - oc1= ((x & 256)+(y & 128)+(z & 64))>>6; - br= br->b[oc1]; - if(br==NULL) { - return NULL; - } - } - - oc1= ((x & 128)+(y & 64)+(z & 32))>>5; - br= br->b[oc1]; - if(br) { - oc1= ((x & 64)+(y & 32)+(z & 16))>>4; - br= br->b[oc1]; - if(br) { - oc1= ((x & 32)+(y & 16)+(z & 8))>>3; - br= br->b[oc1]; - if(br) { - oc1= ((x & 16)+(y & 8)+(z & 4))>>2; - br= br->b[oc1]; - if(br) { - oc1= ((x & 8)+(y & 4)+(z & 2))>>1; - br= br->b[oc1]; - if(br) { - oc1= ((x & 4)+(y & 2)+(z & 1)); - return (Node *)br->b[oc1]; - } - } - } - } - } - - return NULL; -} - -static int cliptest(float p, float q, float *u1, float *u2) -{ - float r; - - if(p<0.0f) { - if(q*u2) return 0; - else if(r>*u1) *u1=r; - } - } - else { - if(p>0.0f) { - if(q<0.0f) return 0; - else if(qorig.face */ -static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) -{ - Octree *oc= (Octree*)tree; - Node *no; - OcVal ocval; - float vec1[3], vec2[3], start[3], end[3]; - float u1,u2,ox1,ox2,oy1,oy2,oz1,oz2; - float labdao,labdax,ldx,labday,ldy,labdaz,ldz, ddalabda; - float olabda = 0; - int dx,dy,dz; - int xo,yo,zo,c1=0; - int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2; - - /* clip with octree */ - if(oc->branchcount==0) return 0; - - /* do this before intersect calls */ -#if 0 - is->facecontr= NULL; /* to check shared edge */ - is->obcontr= 0; - is->faceisect= is->isect= 0; /* shared edge, quad half flag */ - is->userdata= oc->userdata; -#endif - - VECCOPY( start, is->start ); - VECADDFAC( end, is->start, is->vec, is->labda ); - ldx= is->vec[0]*is->labda; - olabda = is->labda; - u1= 0.0f; - u2= 1.0f; - - /* clip with octree cube */ - if(cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) { - if(cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) { - ldy= is->vec[1]*is->labda; - if(cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) { - if(cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) { - ldz = is->vec[2]*is->labda; - if(cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) { - if(cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) { - c1=1; - if(u2<1.0f) { - end[0] = start[0]+u2*ldx; - end[1] = start[1]+u2*ldy; - end[2] = start[2]+u2*ldz; - } - - if(u1>0.0f) { - start[0] += u1*ldx; - start[1] += u1*ldy; - start[2] += u1*ldz; - } - } - } - } - } - } - } - - if(c1==0) return 0; - - /* reset static variables in ocread */ - //ocread(oc, oc->ocres, 0, 0); - - /* setup 3dda to traverse octree */ - ox1= (start[0]-oc->min[0])*oc->ocfacx; - oy1= (start[1]-oc->min[1])*oc->ocfacy; - oz1= (start[2]-oc->min[2])*oc->ocfacz; - ox2= (end[0]-oc->min[0])*oc->ocfacx; - oy2= (end[1]-oc->min[1])*oc->ocfacy; - oz2= (end[2]-oc->min[2])*oc->ocfacz; - - ocx1= (int)ox1; - ocy1= (int)oy1; - ocz1= (int)oz1; - ocx2= (int)ox2; - ocy2= (int)oy2; - ocz2= (int)oz2; - - if(ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) { - no= ocread(oc, ocx1, ocy1, ocz1); - if(no) { - /* exact intersection with node */ - vec1[0]= ox1; vec1[1]= oy1; vec1[2]= oz1; - vec2[0]= ox2; vec2[1]= oy2; vec2[2]= oz2; - calc_ocval_ray(&ocval, (float)ocx1, (float)ocy1, (float)ocz1, vec1, vec2); - if( testnode(oc, is, no, ocval) ) return 1; - } - } - else { - int found = 0; - //static int coh_ocx1,coh_ocx2,coh_ocy1, coh_ocy2,coh_ocz1,coh_ocz2; - float dox, doy, doz; - int eqval; - - /* calc labda en ld */ - dox= ox1-ox2; - doy= oy1-oy2; - doz= oz1-oz2; - - if(dox<-FLT_EPSILON) { - ldx= -1.0f/dox; - labdax= (ocx1-ox1+1.0f)*ldx; - dx= 1; - } else if(dox>FLT_EPSILON) { - ldx= 1.0f/dox; - labdax= (ox1-ocx1)*ldx; - dx= -1; - } else { - labdax=1.0f; - ldx=0; - dx= 0; - } - - if(doy<-FLT_EPSILON) { - ldy= -1.0f/doy; - labday= (ocy1-oy1+1.0f)*ldy; - dy= 1; - } else if(doy>FLT_EPSILON) { - ldy= 1.0f/doy; - labday= (oy1-ocy1)*ldy; - dy= -1; - } else { - labday=1.0f; - ldy=0; - dy= 0; - } - - if(doz<-FLT_EPSILON) { - ldz= -1.0f/doz; - labdaz= (ocz1-oz1+1.0f)*ldz; - dz= 1; - } else if(doz>FLT_EPSILON) { - ldz= 1.0f/doz; - labdaz= (oz1-ocz1)*ldz; - dz= -1; - } else { - labdaz=1.0f; - ldz=0; - dz= 0; - } - - xo=ocx1; yo=ocy1; zo=ocz1; - labdao= ddalabda= MIN3(labdax,labday,labdaz); - - vec2[0]= ox1; - vec2[1]= oy1; - vec2[2]= oz1; - - /* this loop has been constructed to make sure the first and last node of ray - are always included, even when ddalabda==1.0f or larger */ - - while(TRUE) { - - no= ocread(oc, xo, yo, zo); - if(no) { - - /* calculate ray intersection with octree node */ - VECCOPY(vec1, vec2); - // dox,y,z is negative - vec2[0]= ox1-ddalabda*dox; - vec2[1]= oy1-ddalabda*doy; - vec2[2]= oz1-ddalabda*doz; - calc_ocval_ray(&ocval, (float)xo, (float)yo, (float)zo, vec1, vec2); - - //is->labda = (u1+ddalabda*(u2-u1))*olabda; - if( testnode(oc, is, no, ocval) ) - found = 1; - - if(is->labda < (u1+ddalabda*(u2-u1))*olabda) - return found; - } - - - labdao= ddalabda; - - /* traversing ocree nodes need careful detection of smallest values, with proper - exceptions for equal labdas */ - eqval= (labdax==labday); - if(labday==labdaz) eqval += 2; - if(labdax==labdaz) eqval += 4; - - if(eqval) { // only 4 cases exist! - if(eqval==7) { // x=y=z - xo+=dx; labdax+=ldx; - yo+=dy; labday+=ldy; - zo+=dz; labdaz+=ldz; - } - else if(eqval==1) { // x=y - if(labday < labdaz) { - xo+=dx; labdax+=ldx; - yo+=dy; labday+=ldy; - } - else { - zo+=dz; labdaz+=ldz; - } - } - else if(eqval==2) { // y=z - if(labdax < labday) { - xo+=dx; labdax+=ldx; - } - else { - yo+=dy; labday+=ldy; - zo+=dz; labdaz+=ldz; - } - } - else { // x=z - if(labday < labdax) { - yo+=dy; labday+=ldy; - } - else { - xo+=dx; labdax+=ldx; - zo+=dz; labdaz+=ldz; - } - } - } - else { // all three different, just three cases exist - eqval= (labdax=1.0f) break; - } - } - - /* reached end, no intersections found */ - return 0; -} - - - diff --git a/source/blender/render/intern/source/rayobject_raycounter.c b/source/blender/render/intern/source/rayobject_raycounter.c deleted file mode 100644 index 4e5a5ddb844..00000000000 --- a/source/blender/render/intern/source/rayobject_raycounter.c +++ /dev/null @@ -1,87 +0,0 @@ -/** - * $Id: rayobject_raycounter.c 23649 2009-10-06 02:56:11Z jaguarandi $ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): André Pinto. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#include "rayobject.h" -#include "raycounter.h" - -#ifdef RE_RAYCOUNTER - -void RE_RC_INFO(RayCounter *info) -{ - printf("----------- Raycast counter --------\n"); - printf("Rays total: %llu\n", info->raycast.test ); - printf("Rays hit: %llu\n", info->raycast.hit ); - printf("\n"); - printf("BB tests: %llu\n", info->bb.test ); - printf("BB hits: %llu\n", info->bb.hit ); - printf("\n"); - printf("SIMD BB tests: %llu\n", info->simd_bb.test ); - printf("SIMD BB hits: %llu\n", info->simd_bb.hit ); - printf("\n"); - printf("Primitives tests: %llu\n", info->faces.test ); - printf("Primitives hits: %llu\n", info->faces.hit ); - printf("------------------------------------\n"); - printf("Shadow last-hit tests per ray: %f\n", info->rayshadow_last_hit.test / ((float)info->raycast.test) ); - printf("Shadow last-hit hits per ray: %f\n", info->rayshadow_last_hit.hit / ((float)info->raycast.test) ); - printf("\n"); - printf("Hint tests per ray: %f\n", info->raytrace_hint.test / ((float)info->raycast.test) ); - printf("Hint hits per ray: %f\n", info->raytrace_hint.hit / ((float)info->raycast.test) ); - printf("\n"); - printf("BB tests per ray: %f\n", info->bb.test / ((float)info->raycast.test) ); - printf("BB hits per ray: %f\n", info->bb.hit / ((float)info->raycast.test) ); - printf("\n"); - printf("SIMD tests per ray: %f\n", info->simd_bb.test / ((float)info->raycast.test) ); - printf("SIMD hits per ray: %f\n", info->simd_bb.hit / ((float)info->raycast.test) ); - printf("\n"); - printf("Primitives tests per ray: %f\n", info->faces.test / ((float)info->raycast.test) ); - printf("Primitives hits per ray: %f\n", info->faces.hit / ((float)info->raycast.test) ); - printf("------------------------------------\n"); -} - -void RE_RC_MERGE(RayCounter *dest, RayCounter *tmp) -{ - dest->faces.test += tmp->faces.test; - dest->faces.hit += tmp->faces.hit; - - dest->bb.test += tmp->bb.test; - dest->bb.hit += tmp->bb.hit; - - dest->simd_bb.test += tmp->simd_bb.test; - dest->simd_bb.hit += tmp->simd_bb.hit; - - dest->raycast.test += tmp->raycast.test; - dest->raycast.hit += tmp->raycast.hit; - - dest->rayshadow_last_hit.test += tmp->rayshadow_last_hit.test; - dest->rayshadow_last_hit.hit += tmp->rayshadow_last_hit.hit; - - dest->raytrace_hint.test += tmp->raytrace_hint.test; - dest->raytrace_hint.hit += tmp->raytrace_hint.hit; -} - -#endif diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 9bb7fd0ecc2..60ee86c52c4 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2036,11 +2036,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * initVideoTexture(); /* could be done a lot more nicely, but for now a quick way to get bge.* working */ -<<<<<<< .working - PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')});"); -======= PyRun_SimpleString("sys = __import__('sys');mod = sys.modules['bge'] = type(sys)('bge');mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes'), 'texture':__import__('VideoTexture')});"); ->>>>>>> .merge-right.r35190 } static struct PyModuleDef Rasterizer_module_def = { diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 09aa1c02c76..597cec17c61 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -819,9 +819,6 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) current_ms = &ms; current_mesh = ms.m_mesh; current_wireframe = wireframe; -<<<<<<< .working - MCol *mcol = (MCol*)ms.m_pDerivedMesh->getTessFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); -======= // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */ // handle two-side @@ -830,7 +827,6 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) else this->SetCullFace(true); ->>>>>>> .merge-right.r35190 if (current_polymat->GetFlag() & RAS_BLENDERGLSL) { // GetMaterialIndex return the original mface material index, // increment by 1 to match what derived mesh is doing