Revision: 77069
http://sourceforge.net/p/brlcad/code/77069
Author: brlcad
Date: 2020-09-06 05:50:07 +0000 (Sun, 06 Sep 2020)
Log Message:
-----------
apply zulip patch from Sumagna Das that stubs in an initial vol-from-png
plugin. not yet functional, but compiles and exposes a few other issues in
libgcv.
Added Paths:
-----------
brlcad/trunk/src/libgcv/plugins/vol/
brlcad/trunk/src/libgcv/plugins/vol/CMakeLists.txt
brlcad/trunk/src/libgcv/plugins/vol/png_read.c
Added: brlcad/trunk/src/libgcv/plugins/vol/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libgcv/plugins/vol/CMakeLists.txt
(rev 0)
+++ brlcad/trunk/src/libgcv/plugins/vol/CMakeLists.txt 2020-09-06 05:50:07 UTC
(rev 77069)
@@ -0,0 +1 @@
+LIBGCV_ADD_PLUGIN(vol "png_read.c" "librt;libbu")
Property changes on: brlcad/trunk/src/libgcv/plugins/vol/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: brlcad/trunk/src/libgcv/plugins/vol/png_read.c
===================================================================
--- brlcad/trunk/src/libgcv/plugins/vol/png_read.c
(rev 0)
+++ brlcad/trunk/src/libgcv/plugins/vol/png_read.c 2020-09-06 05:50:07 UTC
(rev 77069)
@@ -0,0 +1,64 @@
+#include "common.h"
+
+#include "gcv/api.h"
+#include "bu/mime.h"
+#include "wdb.h"
+
+struct png_read_opts{
+ int coloured;
+};
+
+static void create_opts(struct bu_opt_desc **opts_desc,
+ void **dest_options_data)
+{
+ struct png_read_opts *opts_data;
+
+ BU_ALLOC(opts_data, struct png_read_opts);
+ *dest_options_data = opts_data;
+ *opts_desc = (struct bu_opt_desc *)bu_calloc(3, sizeof(struct bu_opt_desc),
"options_desc");
+
+ opts_data->coloured = 0;
+
+ BU_OPT((*opts_desc)[0], "c", "colored", NULL, bu_opt_bool,
+ &opts_data->coloured, "Check if it is coloured");
+ BU_OPT_NULL((*opts_desc)[1]);
+}
+
+static void free_opts(void *options_data)
+{
+ bu_free(options_data, "options_data");
+}
+
+static int png_read(struct gcv_context *context,
+ const struct gcv_opts *UNUSED(gcv_options),
+ const void *options_data, const char *source_path)
+{
+ const point_t center = {0.0, 0.0, 0.0};
+ const fastf_t radius = 1.0;
+
+ const struct png_read_opts *opts = (struct png_read_opts *)options_data;
+
+ bu_log("importing from PNG file '%s'\n", source_path);
+ bu_log("image is coloured: %s\n", opts->coloured ? "True" : "False");
+
+ mk_id(context->dbip->dbi_wdbp, "GCV plugin test");
+
+ mk_sph(context->dbip->dbi_wdbp, "test", center, radius);
+
+ return 1;
+}
+
+HIDDEN int png_can_read(const char * data)
+{
+ if (!data) return 0;
+ return 1;
+}
+
+const struct gcv_filter gcv_conv_png_read = {
+ "PNG Reader", GCV_FILTER_READ, BU_MIME_MODEL_UNKNOWN, png_can_read,
+ create_opts, free_opts, png_read
+};
+
+static const struct gcv_filter * const filters[] = {&gcv_conv_png_read, NULL};
+
+const struct gcv_plugin gcv_plugin_info = {filters};
Property changes on: brlcad/trunk/src/libgcv/plugins/vol/png_read.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
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