forked from bartvdbraak/blender
skip calling BKE_editmesh_tessface_calc() from BKE_bmbvh_new(), also quiet float/double warnings.
This commit is contained in:
parent
c429349054
commit
fe4305ef82
@ -58,7 +58,6 @@ struct BMBVHTree {
|
|||||||
int curtag, flag;
|
int curtag, flag;
|
||||||
|
|
||||||
Object *ob;
|
Object *ob;
|
||||||
struct Scene *scene;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void cage_mapped_verts_callback(void *userData, int index, const float co[3],
|
static void cage_mapped_verts_callback(void *userData, int index, const float co[3],
|
||||||
@ -77,6 +76,7 @@ static void cage_mapped_verts_callback(void *userData, int index, const float co
|
|||||||
|
|
||||||
BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
||||||
{
|
{
|
||||||
|
struct BMLoop *(*looptris)[3] = em->looptris;
|
||||||
BMBVHTree *tree = MEM_callocN(sizeof(*tree), "BMBVHTree");
|
BMBVHTree *tree = MEM_callocN(sizeof(*tree), "BMBVHTree");
|
||||||
DerivedMesh *cage, *final;
|
DerivedMesh *cage, *final;
|
||||||
SmallHash shash;
|
SmallHash shash;
|
||||||
@ -84,14 +84,14 @@ BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
|||||||
int i;
|
int i;
|
||||||
int tottri;
|
int tottri;
|
||||||
|
|
||||||
|
/* BKE_editmesh_tessface_calc() must be called already */
|
||||||
|
BLI_assert(em->tottri != 0 || em->bm->totface == 0);
|
||||||
|
|
||||||
/* when initializing cage verts, we only want the first cage coordinate for each vertex,
|
/* when initializing cage verts, we only want the first cage coordinate for each vertex,
|
||||||
* so that e.g. mirror or array use original vertex coordinates and not mirrored or duplicate */
|
* so that e.g. mirror or array use original vertex coordinates and not mirrored or duplicate */
|
||||||
BLI_smallhash_init(&shash);
|
BLI_smallhash_init(&shash);
|
||||||
|
|
||||||
BKE_editmesh_tessface_calc(em);
|
|
||||||
|
|
||||||
tree->ob = em->ob;
|
tree->ob = em->ob;
|
||||||
tree->scene = scene;
|
|
||||||
tree->em = em;
|
tree->em = em;
|
||||||
tree->bm = em->bm;
|
tree->bm = em->bm;
|
||||||
tree->epsilon = FLT_EPSILON * 2.0f;
|
tree->epsilon = FLT_EPSILON * 2.0f;
|
||||||
@ -100,7 +100,7 @@ BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
|||||||
if (flag & (BMBVH_RESPECT_SELECT)) {
|
if (flag & (BMBVH_RESPECT_SELECT)) {
|
||||||
tottri = 0;
|
tottri = 0;
|
||||||
for (i = 0; i < em->tottri; i++) {
|
for (i = 0; i < em->tottri; i++) {
|
||||||
if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_SELECT)) {
|
if (BM_elem_flag_test(looptris[i][0]->f, BM_ELEM_SELECT)) {
|
||||||
tottri++;
|
tottri++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
|||||||
else if (flag & (BMBVH_RESPECT_HIDDEN)) {
|
else if (flag & (BMBVH_RESPECT_HIDDEN)) {
|
||||||
tottri = 0;
|
tottri = 0;
|
||||||
for (i = 0; i < em->tottri; i++) {
|
for (i = 0; i < em->tottri; i++) {
|
||||||
if (!BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) {
|
if (!BM_elem_flag_test(looptris[i][0]->f, BM_ELEM_HIDDEN)) {
|
||||||
tottri++;
|
tottri++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,20 +155,20 @@ BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene)
|
|||||||
}
|
}
|
||||||
else if (flag & BMBVH_RESPECT_HIDDEN) {
|
else if (flag & BMBVH_RESPECT_HIDDEN) {
|
||||||
/* note, the arrays wont align now! take care */
|
/* note, the arrays wont align now! take care */
|
||||||
if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) {
|
if (BM_elem_flag_test(looptris[i][0]->f, BM_ELEM_HIDDEN)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag & BMBVH_USE_CAGE) {
|
if (flag & BMBVH_USE_CAGE) {
|
||||||
copy_v3_v3(cos[0], cagecos[BM_elem_index_get(em->looptris[i][0]->v)]);
|
copy_v3_v3(cos[0], cagecos[BM_elem_index_get(looptris[i][0]->v)]);
|
||||||
copy_v3_v3(cos[1], cagecos[BM_elem_index_get(em->looptris[i][1]->v)]);
|
copy_v3_v3(cos[1], cagecos[BM_elem_index_get(looptris[i][1]->v)]);
|
||||||
copy_v3_v3(cos[2], cagecos[BM_elem_index_get(em->looptris[i][2]->v)]);
|
copy_v3_v3(cos[2], cagecos[BM_elem_index_get(looptris[i][2]->v)]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copy_v3_v3(cos[0], em->looptris[i][0]->v->co);
|
copy_v3_v3(cos[0], looptris[i][0]->v->co);
|
||||||
copy_v3_v3(cos[1], em->looptris[i][1]->v->co);
|
copy_v3_v3(cos[1], looptris[i][1]->v->co);
|
||||||
copy_v3_v3(cos[2], em->looptris[i][2]->v->co);
|
copy_v3_v3(cos[2], looptris[i][2]->v->co);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_bvhtree_insert(tree->tree, i, (float *)cos, 3);
|
BLI_bvhtree_insert(tree->tree, i, (float *)cos, 3);
|
||||||
@ -246,16 +246,16 @@ BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3
|
|||||||
if (hit.dist != FLT_MAX && hit.index != -1) {
|
if (hit.dist != FLT_MAX && hit.index != -1) {
|
||||||
if (r_hitout) {
|
if (r_hitout) {
|
||||||
if (tree->flag & BMBVH_RETURN_ORIG) {
|
if (tree->flag & BMBVH_RETURN_ORIG) {
|
||||||
BMVert *v1, *v2, *v3;
|
const float *co1, *co2, *co3;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
v1 = tree->em->looptris[hit.index][0]->v;
|
co1 = tree->em->looptris[hit.index][0]->v->co;
|
||||||
v2 = tree->em->looptris[hit.index][1]->v;
|
co2 = tree->em->looptris[hit.index][1]->v->co;
|
||||||
v3 = tree->em->looptris[hit.index][2]->v;
|
co3 = tree->em->looptris[hit.index][2]->v->co;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
|
r_hitout[i] = co1[i] + ((co2[i] - co1[i]) * tree->uv[0]) +
|
||||||
((v3->co[i] - v1->co[i]) * tree->uv[1]);
|
((co3[i] - co1[i]) * tree->uv[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -304,8 +304,8 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf)
|
|||||||
for (info = ibuf->metadata; info; info = info->next)
|
for (info = ibuf->metadata; info; info = info->next)
|
||||||
header->insert(info->key, StringAttribute(info->value));
|
header->insert(info->key, StringAttribute(info->value));
|
||||||
|
|
||||||
if (ibuf->ppm[0] > 0.0f)
|
if (ibuf->ppm[0] > 0.0)
|
||||||
addXDensity(*header, ibuf->ppm[0] / 39.3700787f); /* 1 meter = 39.3700787 inches */
|
addXDensity(*header, ibuf->ppm[0] / 39.3700787); /* 1 meter = 39.3700787 inches */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags)
|
static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags)
|
||||||
@ -1169,7 +1169,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char
|
|||||||
|
|
||||||
if (hasXDensity(file->header())) {
|
if (hasXDensity(file->header())) {
|
||||||
ibuf->ppm[0] = xDensity(file->header()) * 39.3700787f;
|
ibuf->ppm[0] = xDensity(file->header()) * 39.3700787f;
|
||||||
ibuf->ppm[1] = ibuf->ppm[0] * file->header().pixelAspectRatio();
|
ibuf->ppm[1] = ibuf->ppm[0] * (double)file->header().pixelAspectRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
ibuf->ftype = OPENEXR;
|
ibuf->ftype = OPENEXR;
|
||||||
|
Loading…
Reference in New Issue
Block a user