37 namespace HDK_Sample {
40 error(
const char *msg)
42 fprintf(stderr,
"Error: %s\n", msg);
47 i3dSphere(
int nvalues,
60 UT_ASSERT(!strcmp(names[0],
"density") && sizes[0] == 1);
61 UT_ASSERT(!strcmp(names[1],
"color") && sizes[1] == 3);
65 for (i = 0; i < nvalues; i++)
68 d = P[i].
length() > 1 ? 0 : 1;
70 color[0] = d * SYSfit(P[i].
x(), -1, 1, 0, 1);
71 color[1] = d * SYSfit(P[i].
y(), -1, 1, 0, 1);
72 color[2] = d * SYSfit(P[i].
z(), -1, 1, 0, 1);
82 using namespace HDK_Sample;
89 const char *chnames[2] = {
"density",
"color" };
90 int chsizes[2] = { 1, 3 };
92 printf(
"Generating sphere.i3d\n");
96 error(
"Unable to createTexture()");
98 if (!fp.
fillTexture(2, chnames, chsizes, i3dSphere, 1))
99 error(
"Unable to fill the texture");
101 if (!fp.
exportTag(
"software",
"hdk_isosphere"))
102 error(
"Unable to save software tag");
105 error(
"Unable to close texture");
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
int fillTexture(int num_channels, const char *channel_names[], int channel_sizes[], IMG3D_TextureEval evaluator, int max_samples=4, fpreal variance=0.005, fpreal filter_width=1, fpreal jitter=1)
auto printf(const S &fmt, const T &...args) -> int
GLdouble GLdouble GLdouble z
constexpr SYS_FORCE_INLINE T length() const noexcept
**But if you need a result
int theMain(int argc, char *argv[])
static SYS_FUNC_NORETURN void exit(UT_ExitCode exit_code=EXIT_OK)
Calls exit(), which implicitly leads to our callbacks being called.
bool exportTag(const char *name, int value)
void enlargeBounds(const UT_Vector3T< T > &min, const UT_Vector3T< T > &max)
auto fprintf(std::FILE *f, const S &fmt, const T &...args) -> int
int createTexture(const char *filename, const UT_BoundingBox &box, int xres, int yres, int zres, int compression=5)
SYS_FORCE_INLINE void initBounds()
Class to handle reading/writing 3D texture images.