/usr/share/dx/samples/callmodule/renderimage.c is in dxsamples 4.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #include "dx/dx.h"
#include <stdio.h>
#include <unistd.h>
#define MAX_PARAMS 21
main()
{
int rcode;
ModuleInput minput[MAX_PARAMS];
ModuleOutput moutput[MAX_PARAMS];
float iso_value = 0.1;
Object isosurface_out, autocamera_out, import_cloud_out;
Object render_out;
DXInitModules();
/* Import - setup in/outputs and call module */
DXModSetStringInput(&minput[0], "name",
"cloudwater");
DXModSetObjectOutput(&moutput[0], "data", &import_cloud_out);
rcode = DXCallModule("Import", 1, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* Isosurface - setup in/outputs and call module */
/* no need to reference import_cloud_out before using it here */
/* because we will not use it again. After this module is */
/* called import_cloud_out will be deleted. */
DXModSetObjectInput(&minput[0], "data", import_cloud_out);
DXModSetFloatInput(&minput[1], "value", iso_value);
DXModSetObjectOutput(&moutput[0], "surface", &isosurface_out);
rcode = DXCallModule("Isosurface", 2, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* AutoCamera - setup in/outputs and call module */
/* We need to reference isosurface_out, because we will need */
/* it again as an input to Render */
/* If it were not referenced here, it would be deleted after the */
/* call to DXCallModule */
DXReference(isosurface_out);
DXModSetObjectInput(&minput[0], "object", isosurface_out);
DXModSetObjectOutput(&moutput[0], "camera", &autocamera_out);
rcode = DXCallModule("AutoCamera", 1, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* Render - setup in/outputs and call module */
DXModSetObjectInput(&minput[0], "object", isosurface_out);
DXModSetObjectInput(&minput[1], "camera", autocamera_out);
DXModSetObjectOutput(&moutput[0], "image", &render_out);
rcode = DXCallModule("Render", 2, minput, 1, moutput);
if (rcode == ERROR) goto error;
/* WriteImage - setup in/outputs and call module */
DXModSetObjectInput(&minput[0], "image", render_out);
DXModSetStringInput(&minput[1], "name", "imagefile");
DXModSetStringInput(&minput[2], "format", "tiff");
rcode = DXCallModule("WriteImage", 3, minput, 0, moutput);
/* now delete isosurface_out */
DXDelete((Object)isosurface_out);
if (rcode == ERROR) goto error;
error: exit (-1);
}
|