48 std::cerr <<
"Usage: " << program <<
" sourcefile dstfile\n";
49 std::cerr <<
"The extension of the source/dest will be used to determine" << std::endl;
50 std::cerr <<
"how the conversion is done. Supported extensions are .voxel" << std::endl;
51 std::cerr <<
"and .bgeo" << std::endl;
62 #if defined(HOUDINI_11)
64 gdp->
addPrimAttrib(
"name",
sizeof(
int), GB_ATTRIB_INDEX, &def);
83 float tx, ty, tz, sx, sy, sz;
93 attrib.set(vol->getMapOffset(),
name);
103 xform.
scale(sx/2, sy/2, sz/2);
105 vol->setTransform(xform);
110 handle->size(rx, ry, rz);
115 for (
int z = 0;
z < rz;
z++)
117 for (
int y = 0;
y < ry;
y++)
119 for (
int x = 0;
x < rx;
x++)
125 handle->setValue(
x,
y,
z, v);
154 os <<
"VOXELS" << std::endl;
163 #if defined(HOUDINI_11)
164 FOR_ALL_PRIMITIVES(gdp, prim)
169 #if defined(HOUDINI_11)
177 name.
harden(buf.buffer());
180 if (attrib.isValid())
185 os <<
"VOLUME " << name << std::endl;
188 int resx, resy, resz;
191 vol->
getRes(resx, resy, resz);
192 os << resx <<
" " << resy <<
" " << resz << std::endl;
201 os << tmp.
x() <<
" " << tmp.
y() <<
" " << tmp.
z() << std::endl;
205 os << resx * (p1 - p2).
length() <<
" ";
207 os << resy * (p1 - p2).
length() <<
" ";
209 os << resz * (p1 - p2).
length() << std::endl;
214 os <<
"{" << std::endl;
215 for (
int z = 0;
z < resz;
z++)
217 for (
int y = 0;
y < resy;
y++)
220 for (
int x = 0;
x < resx;
x++)
222 os << (*handle)(
x,
y,
z) <<
" ";
227 os <<
"}" << std::endl;
270 if (args.
argc() != 3)
284 inputname.
harden(argv[1]);
285 outputname.
harden(argv[2]);
293 #if defined(HOUDINI_11)
294 gdp.
save((
const char *) outputname, 0, 0);
296 gdp.
save(outputname, NULL);
302 gdp.
load(inputname, NULL);
GLenum GLuint GLenum GLsizei const GLchar * buf
SYS_FORCE_INLINE GA_Detail & getDetail() const
bool getWord(UT_WorkBuffer &buffer)
void scale(T sx, T sy, T sz)
GEO_API const TypeMask GEOPRIMVOLUME
UT_Vector3T< float > UT_Vector3
GLdouble GLdouble GLdouble z
bool checkToken(const char *expected)
GA_PrimCompat::TypeMask getPrimitiveId() const override
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
GLuint GLsizei GLsizei * length
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
bool voxelSave(std::ostream &os, const GU_Detail *gdp)
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const GA_Attribute *src)
void identity()
Set the matrix to identity.
exint read(bool *array, exint sz=1)
void harden()
Take shallow copy and make it deep.
IOStatus load(const char *filename, const GA_LoadOptions *opts=0, UT_StringArray *errors=0)
Load a geometry file.
IOStatus save(const char *filename, const GA_SaveOptions *options, UT_StringArray *errors=0) const
#define GA_FOR_ALL_PRIMITIVES(gdp, prim)
GLuint const GLchar * name
Portable replacement for std::ofstream.
int theMain(int argc, char *argv[])
GEO_AttributeHandle getPrimAttribute(const char *attrib_name) const
static GEO_PrimVolume * build(GU_Detail *gdp, bool integers=false, int comps=1)
SYS_FORCE_INLINE const GA_Attribute * findPrimitiveAttribute(GA_AttributeScope s, const UT_StringRef &name) const
bool indexToPos(int x, int y, int z, UT_Vector3 &pos) const
SYS_FORCE_INLINE GA_Index getMapIndex() const
Gets the index of this primitive in the detail containing it.
GLsizeiptr const void GLenum usage
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, const UT_Vector3 &pos)
Set P from a UT_Vector3.
bool voxelLoad(UT_IStream &is, GU_Detail *gdp)
SYS_FORCE_INLINE GA_Offset getMapOffset() const
Gets the offset of this primitive in the detail containing it.
**If you just want to fire and args
SYS_FORCE_INLINE GA_Offset getPointOffset() const
void initialize(int argc, const char *const argv[])
UT_VoxelArrayHandleF getVoxelHandle() const
constexpr SYS_FORCE_INLINE T & y() noexcept
void getRes(int &rx, int &ry, int &rz) const
Returns the resolution of the voxel array.
GLbitfield GLuint program
constexpr SYS_FORCE_INLINE T & x() noexcept
GA_Attribute * addStringTuple(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, int tuple_size, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())