Revision: 73022
          http://sourceforge.net/p/brlcad/code/73022
Author:   brlcad
Date:     2019-05-08 06:23:33 +0000 (Wed, 08 May 2019)
Log Message:
-----------
specify a flag so we know to record it.  also, make sure we handle definitions 
that have uvs but not normals

Modified Paths:
--------------
    brlcad/trunk/include/rt/geom.h
    brlcad/trunk/src/libgcv/plugins/obj/obj_read.c

Modified: brlcad/trunk/include/rt/geom.h
===================================================================
--- brlcad/trunk/include/rt/geom.h      2019-05-08 06:03:19 UTC (rev 73021)
+++ brlcad/trunk/include/rt/geom.h      2019-05-08 06:23:33 UTC (rev 73022)
@@ -849,9 +849,10 @@
 #define RT_BOT_PLATE_NOCOS 4
 
 /* flags for bot_flags */
-#define RT_BOT_HAS_SURFACE_NORMALS 0x1 /**< @brief This primitive may have 
surface normals at each face vertex */
-#define RT_BOT_USE_NORMALS 0x2         /**< @brief Use the surface normals if 
they exist */
-#define RT_BOT_USE_FLOATS 0x4          /**< @brief Use the single precision 
version of "tri_specific" during prep */
+#define RT_BOT_HAS_SURFACE_NORMALS 0x1 /**< @brief Has surface normals at each 
face vertex */
+#define RT_BOT_USE_NORMALS         0x2 /**< @brief Use the surface normals if 
they exist */
+#define RT_BOT_USE_FLOATS          0x4 /**< @brief Use the single precision 
version of "tri_specific" during prep */
+#define RT_BOT_HAS_TEXTURE_UVS     0x8 /**< @brief Has uv texture coordinates 
at each face vertex */
 
 #define RT_BOT_CK_MAGIC(_p) BU_CKMAG(_p, RT_BOT_INTERNAL_MAGIC, 
"rt_bot_internal")
 /** @} */

Modified: brlcad/trunk/src/libgcv/plugins/obj/obj_read.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/obj/obj_read.c      2019-05-08 06:03:19 UTC 
(rev 73021)
+++ brlcad/trunk/src/libgcv/plugins/obj/obj_read.c      2019-05-08 06:23:33 UTC 
(rev 73022)
@@ -2562,14 +2562,29 @@
     }
 
     /* write bot to ".g" file */
-    if (ti.tri_type == FACE_NV || ti.tri_type == FACE_TNV) {
+    if (ti.tri_type == FACE_TNV) {
        ret = mk_bot_w_normals_and_uvs(outfp, bu_vls_addr(gfi->primitive_name),
                                       ti.bot_mode, bot_orientation,
-                                      RT_BOT_HAS_SURFACE_NORMALS | 
RT_BOT_USE_NORMALS,
+                                      RT_BOT_HAS_SURFACE_NORMALS | 
RT_BOT_USE_NORMALS | RT_BOT_HAS_TEXTURE_UVS,
                                       ti.bot_num_vertices, ti.bot_num_faces, 
ti.bot_vertices,
                                       ti.bot_faces, ti.bot_thickness, 
ti.bot_face_mode,
                                       ti.bot_num_normals, ti.bot_normals, 
ti.bot_face_normals,
                                       ti.bot_num_texture_vertices, 
ti.bot_texture_vertices, ti.bot_textures);
+    } else if (ti.tri_type == FACE_TV) {
+       ret = mk_bot_w_normals_and_uvs(outfp, bu_vls_addr(gfi->primitive_name),
+                                      ti.bot_mode, bot_orientation,
+                                      RT_BOT_HAS_TEXTURE_UVS,
+                                      ti.bot_num_vertices, ti.bot_num_faces, 
ti.bot_vertices,
+                                      ti.bot_faces, ti.bot_thickness, 
ti.bot_face_mode,
+                                      0, NULL, NULL,
+                                      ti.bot_num_texture_vertices, 
ti.bot_texture_vertices, ti.bot_textures);
+    } else if (ti.tri_type == FACE_NV) {
+       ret = mk_bot_w_normals(outfp, bu_vls_addr(gfi->primitive_name),
+                              ti.bot_mode, bot_orientation,
+                              RT_BOT_HAS_SURFACE_NORMALS | RT_BOT_USE_NORMALS,
+                              ti.bot_num_vertices, ti.bot_num_faces, 
ti.bot_vertices,
+                              ti.bot_faces, ti.bot_thickness, ti.bot_face_mode,
+                              ti.bot_num_normals, ti.bot_normals, 
ti.bot_face_normals);
     } else {
        ret = mk_bot(outfp, bu_vls_addr(gfi->primitive_name), ti.bot_mode,
                     bot_orientation, 0, ti.bot_num_vertices, ti.bot_num_faces,

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to