gmio_stl: rename gmio_stl_triangle::normal -> gmio_stl_triangle::n
This commit is contained in:
parent
62715a3822
commit
523cd028b8
@ -206,7 +206,7 @@ static void add_triangle(
|
|||||||
aiVector3D* vp = &pMesh->mVertices[tri_id * 3];
|
aiVector3D* vp = &pMesh->mVertices[tri_id * 3];
|
||||||
aiVector3D* vn = &pMesh->mNormals[tri_id * 3];
|
aiVector3D* vn = &pMesh->mNormals[tri_id * 3];
|
||||||
|
|
||||||
copy_gmio_stl_coords(vn, triangle->normal);
|
copy_gmio_stl_coords(vn, triangle->n);
|
||||||
*(vn+1) = *vn;
|
*(vn+1) = *vn;
|
||||||
*(vn+2) = *vn;
|
*(vn+2) = *vn;
|
||||||
|
|
||||||
@ -273,9 +273,9 @@ static void get_triangle(
|
|||||||
}
|
}
|
||||||
nor.Normalize();
|
nor.Normalize();
|
||||||
}
|
}
|
||||||
copy_aiVector3D(&triangle->normal, nor);
|
copy_aiVector3D(&triangle->n, nor);
|
||||||
#if 0
|
#if 0
|
||||||
copy_aiVector3D(&triangle->normal, mesh->mNormals[f.mIndices[0]]);
|
copy_aiVector3D(&triangle->n, mesh->mNormals[f.mIndices[0]]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
copy_aiVector3D(&triangle->v1, mesh->mVertices[f.mIndices[0]]);
|
copy_aiVector3D(&triangle->v1, mesh->mVertices[f.mIndices[0]]);
|
||||||
|
@ -207,7 +207,7 @@ int gmio_stla_write(struct gmio_stl_write_args* args)
|
|||||||
func_mesh_get_triangle(mesh_cookie, ibuffer_facet, &tri);
|
func_mesh_get_triangle(mesh_cookie, ibuffer_facet, &tri);
|
||||||
|
|
||||||
buffpos = gmio_write_rawstr(buffpos, "facet normal ");
|
buffpos = gmio_write_rawstr(buffpos, "facet normal ");
|
||||||
buffpos = gmio_write_coords(buffpos, coords_format_str, &tri.normal);
|
buffpos = gmio_write_coords(buffpos, coords_format_str, &tri.n);
|
||||||
|
|
||||||
buffpos = gmio_write_rawstr(buffpos, "\nouter loop");
|
buffpos = gmio_write_rawstr(buffpos, "\nouter loop");
|
||||||
buffpos = gmio_write_rawstr(buffpos, "\n vertex ");
|
buffpos = gmio_write_rawstr(buffpos, "\n vertex ");
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
void gmio_stl_triangle_bswap(struct gmio_stl_triangle* triangle)
|
void gmio_stl_triangle_bswap(struct gmio_stl_triangle* triangle)
|
||||||
{
|
{
|
||||||
uint32_t* uintcoord_ptr = (uint32_t*)&(triangle->normal.x);
|
uint32_t* uintcoord_ptr = (uint32_t*)&(triangle->n.x);
|
||||||
const uint16_t attr_byte_count = triangle->attribute_byte_count;
|
const uint16_t attr_byte_count = triangle->attribute_byte_count;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static enum gmio_stl_format gmio_stlb_format(
|
|||||||
memcpy(&tri,
|
memcpy(&tri,
|
||||||
buff + GMIO_STLB_HEADER_SIZE + 4,
|
buff + GMIO_STLB_HEADER_SIZE + 4,
|
||||||
GMIO_STLB_TRIANGLE_RAWSIZE);
|
GMIO_STLB_TRIANGLE_RAWSIZE);
|
||||||
if (gmio_float32_ulp_equals(gmio_sqrlen(&tri.normal), 1.f, 100)) {
|
if (gmio_float32_ulp_equals(gmio_sqrlen(&tri.n), 1.f, 100)) {
|
||||||
#ifdef GMIO_HOST_IS_BIG_ENDIAN
|
#ifdef GMIO_HOST_IS_BIG_ENDIAN
|
||||||
return GMIO_STL_FORMAT_BINARY_BE;
|
return GMIO_STL_FORMAT_BINARY_BE;
|
||||||
#else
|
#else
|
||||||
@ -86,7 +86,7 @@ static enum gmio_stl_format gmio_stlb_format(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
gmio_stl_triangle_bswap(&tri);
|
gmio_stl_triangle_bswap(&tri);
|
||||||
if (gmio_float32_ulp_equals(gmio_sqrlen(&tri.normal), 1.f, 100)) {
|
if (gmio_float32_ulp_equals(gmio_sqrlen(&tri.n), 1.f, 100)) {
|
||||||
#ifdef GMIO_HOST_IS_BIG_ENDIAN
|
#ifdef GMIO_HOST_IS_BIG_ENDIAN
|
||||||
return GMIO_STL_FORMAT_BINARY_LE;
|
return GMIO_STL_FORMAT_BINARY_LE;
|
||||||
#else
|
#else
|
||||||
|
@ -38,7 +38,7 @@ struct gmio_stl_coords
|
|||||||
* orientation(normal) */
|
* orientation(normal) */
|
||||||
struct gmio_stl_triangle
|
struct gmio_stl_triangle
|
||||||
{
|
{
|
||||||
struct gmio_stl_coords normal; /*!< Normal vector */
|
struct gmio_stl_coords n; /*!< Normal vector */
|
||||||
struct gmio_stl_coords v1; /*!< Vertex 1 */
|
struct gmio_stl_coords v1; /*!< Vertex 1 */
|
||||||
struct gmio_stl_coords v2; /*!< Vertex 2 */
|
struct gmio_stl_coords v2; /*!< Vertex 2 */
|
||||||
struct gmio_stl_coords v3; /*!< Vertex 3 */
|
struct gmio_stl_coords v3; /*!< Vertex 3 */
|
||||||
|
@ -663,7 +663,7 @@ int parse_facet(
|
|||||||
errc += stla_eat_next_token_inplace(data, FACET_token);
|
errc += stla_eat_next_token_inplace(data, FACET_token);
|
||||||
|
|
||||||
errc += stla_eat_next_token_inplace(data, NORMAL_token);
|
errc += stla_eat_next_token_inplace(data, NORMAL_token);
|
||||||
parse_xyz_coords(data, &facet->normal);
|
parse_xyz_coords(data, &facet->n);
|
||||||
|
|
||||||
errc += stla_eat_next_token_inplace(data, OUTER_token);
|
errc += stla_eat_next_token_inplace(data, OUTER_token);
|
||||||
errc += stla_eat_next_token_inplace(data, LOOP_token);
|
errc += stla_eat_next_token_inplace(data, LOOP_token);
|
||||||
|
@ -39,7 +39,7 @@ static void occmesh_add_triangle(
|
|||||||
const gmio_stl_coords& v1 = tri->v1;
|
const gmio_stl_coords& v1 = tri->v1;
|
||||||
const gmio_stl_coords& v2 = tri->v2;
|
const gmio_stl_coords& v2 = tri->v2;
|
||||||
const gmio_stl_coords& v3 = tri->v3;
|
const gmio_stl_coords& v3 = tri->v3;
|
||||||
const gmio_stl_coords& n = tri->normal;
|
const gmio_stl_coords& n = tri->n;
|
||||||
mesh->AddTriangle(mesh->AddOnlyNewVertex(v1.x, v1.y, v1.z),
|
mesh->AddTriangle(mesh->AddOnlyNewVertex(v1.x, v1.y, v1.z),
|
||||||
mesh->AddOnlyNewVertex(v2.x, v2.y, v2.z),
|
mesh->AddOnlyNewVertex(v2.x, v2.y, v2.z),
|
||||||
mesh->AddOnlyNewVertex(v3.x, v3.y, v3.z),
|
mesh->AddOnlyNewVertex(v3.x, v3.y, v3.z),
|
||||||
@ -60,7 +60,7 @@ static void occmesh_get_triangle(
|
|||||||
double yN;
|
double yN;
|
||||||
double zN;
|
double zN;
|
||||||
occTri->GetVertexAndOrientation(idV1, idV2, idV3, xN, yN, zN);
|
occTri->GetVertexAndOrientation(idV1, idV2, idV3, xN, yN, zN);
|
||||||
gmio_stl_coords& n = tri->normal;
|
gmio_stl_coords& n = tri->n;
|
||||||
n.x = static_cast<float>(xN);
|
n.x = static_cast<float>(xN);
|
||||||
n.y = static_cast<float>(yN);
|
n.y = static_cast<float>(yN);
|
||||||
n.z = static_cast<float>(zN);
|
n.z = static_cast<float>(zN);
|
||||||
|
@ -130,7 +130,7 @@ gmio_bool_t gmio_stl_triangle_equal(
|
|||||||
const struct gmio_stl_triangle *rhs,
|
const struct gmio_stl_triangle *rhs,
|
||||||
uint32_t max_ulp_diff)
|
uint32_t max_ulp_diff)
|
||||||
{
|
{
|
||||||
return gmio_stl_coords_equal(&lhs->normal, &rhs->normal, max_ulp_diff)
|
return gmio_stl_coords_equal(&lhs->n, &rhs->n, max_ulp_diff)
|
||||||
&& gmio_stl_coords_equal(&lhs->v1, &rhs->v1, max_ulp_diff)
|
&& gmio_stl_coords_equal(&lhs->v1, &rhs->v1, max_ulp_diff)
|
||||||
&& gmio_stl_coords_equal(&lhs->v2, &rhs->v2, max_ulp_diff)
|
&& gmio_stl_coords_equal(&lhs->v2, &rhs->v2, max_ulp_diff)
|
||||||
&& gmio_stl_coords_equal(&lhs->v3, &rhs->v3, max_ulp_diff)
|
&& gmio_stl_coords_equal(&lhs->v3, &rhs->v3, max_ulp_diff)
|
||||||
|
@ -33,7 +33,7 @@ const char* test_platform__alignment()
|
|||||||
UTEST_ASSERT(offsetof(struct gmio_stl_coords, z) == 8);
|
UTEST_ASSERT(offsetof(struct gmio_stl_coords, z) == 8);
|
||||||
UTEST_ASSERT(sizeof(struct gmio_stl_coords) == GMIO_STL_COORDS_RAWSIZE);
|
UTEST_ASSERT(sizeof(struct gmio_stl_coords) == GMIO_STL_COORDS_RAWSIZE);
|
||||||
|
|
||||||
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, normal) == 0);
|
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, n) == 0);
|
||||||
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v1) == GMIO_STL_COORDS_RAWSIZE);
|
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v1) == GMIO_STL_COORDS_RAWSIZE);
|
||||||
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v2) == 2*GMIO_STL_COORDS_RAWSIZE);
|
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v2) == 2*GMIO_STL_COORDS_RAWSIZE);
|
||||||
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v3) == 3*GMIO_STL_COORDS_RAWSIZE);
|
UTEST_ASSERT(offsetof(struct gmio_stl_triangle, v3) == 3*GMIO_STL_COORDS_RAWSIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user