This module also has two functions for reading and writing the image transformation information associated with a model.
Header to include: iview.h
(includes imodel.h)
Iview *imodViewNew(int size)
void imodViewDelete(Iview *vw)
void imodViewDefault(Iview *vw)
void imodViewDefaultScale(Imod *imod, Iview *vw, Ipoint *imageMax,
float binScale)
void imodViewModelDefault(Imod *imod, Iview *vw, Ipoint *imageMax)
int imodViewWrite(Iview *vw, FILE *fout, Ipoint *scale)
int imodViewModelRead(Imod *imod)
int imodViewClipRead(Imod *imod)
int imodViewModelNew(Imod *imod)
void imodObjviewToObject(Iobjview *objview, Iobj *obj)
void imodObjviewFromObject(Iobj *obj, Iobjview *objview)
void imodViewUse(Imod *imod)
int imodViewStore(Imod *imod, int cview)
int imodObjviewComplete(Imod *imod)
void imodObjviewDelete(Imod *imod, int index)
void imodObjviewsFree(Imod *imod)
int imodIMNXRead(Imod *imod)
int imodIMNXWrite(Imod *imod)
IrefImage *imodIMNXNew()
World flags
Iobjview structure
Iview structure
IrefImage structure
Allocates a new array of Iview structure of the given size. Returns NULL for error.
Frees the Iview structure or array of Iviews in vw, without freeing any object views.
Sets default entries for the view vw with no model information, i.e. sets the rad to 1.0 and assumes no object views
Sets the default scaling for a view vw based on current model dimensions in model imod. If the model is empty and has no extent, it assumes the image dimensions given in imageMax. The ratio of Z binning to X/Y binning given in binScale, as well as the model zscale, is used to scale the Z dimensions.
Sets up a default view in vw given model information in imod and image dimensions in imageMax. No longer used in 3dmod but kept for consistency and for RIB conversion
Writes an Iview structure vw, including object views and a model clip plane chunk, to the file fout. Clip plane points are scaled by scale, and normals are scaled by the inverse. Returns IMOD_ERROR_WRITE for error.
Reads one Iview structure into model imod from the model element file, and adds it to the model's view array. Reads object views as well. Returns IMOD_ERROR_READ for error.
Reads the variable-sized model clip plane chunk. Returns IMOD_ERROR_READ for error.
Adds a new view to view array in the model imod and assigns it default properties. Returns IMOD_ERROR_MEMORY for memory error.
Copies all of the characteristics from the Objview structure objview to the object obj
Copies all of the characteristics from the object obj to the object view objview.
Makes the view specified by the cview element of model imod be the current view by copying it to the default view (element 0 of the view array) and setting object properties from any object views.
Stores the default view and information about all objects in the cview element of the view array of model imod. Returns IMOD_ERROR_MEMORY for memory error.
Makes the actual model views in imod have a complete set of object views, copying from object properties into all views if any need to be created. Returns IMOD_ERROR_MEMORY for error.
Deletes the object views for object index from all of the views in model imod.
Frees the object views from all views in model imod.
Allocates an IrefImage structure and reads the IMONX chunk for model imod. Returns -1 for error.
Writes the IrefImage structure refImage in model imod if any. Returns -1 if there is none.
Allocates and returns a new IrefImage structure with default values of 1 for cscale and oscale and 0 for crot, ctrans, orot, and otrans.
#define VIEW_WORLD_ON 1 /* Use mat matrix for transformation */ #define VIEW_WORLD_LIGHT (1l << 1) /* Use lighting */ #define VIEW_WORLD_DEPTH_CUE (1l << 2) /* Enable depth cueing */ #define VIEW_WORLD_WIREFRAME (1l << 3) /* Show wireframe not surface */ #define VIEW_WORLD_STEREO (1l << 4) /* Stereo flags (Unused 8/21/07) */ #define VIEW_WORLD_HARDWARE (1l << 5) #define VIEW_WORLD_UPDOWN (1l << 6) #define VIEW_WORLD_LOWRES (1l << 7) #define VIEW_WORLD_LABELS (1l << 8) /* Drawing point labels */ /* Shift and actual bits reserved for point quality (8, 9, 10) */ #define WORLD_QUALITY_SHIFT 8 #define WORLD_QUALITY_BITS (7l << WORLD_QUALITY_SHIFT) #define WORLD_KICKOUT_CLIPS (1l << 11) /* Push Z clipping planes far out */ #define WORLD_MOVE_ALL_CLIP (1l << 12) /* Move all clipping planes together */ #define VIEW_WORLD_INVERT_Z (1l << 13) /* Invert Z in model view */ #define VIEW_WORLD_CLIP_IMAGE (1l << 14) /* Apply global clipping plane to image */
typedef struct Mod_Object_View { b3dUInt32 flags; /* bit flags IMOD_OBJFLAG */ b3dFloat red; /* Red (0 - 1.0) */ b3dFloat green; /* Green (0 - 1.0) */ b3dFloat blue; /* Blue (0 - 1.0) */ b3dInt32 pdrawsize; /* size to draw scattered objs */ b3dUByte linewidth; /* linewidth in 3-D */ b3dUByte linesty; /* line draw style */ b3dUByte trans; /* transperentcy */ /* define clipping planes. max for each object is 7. */ IclipPlanes clips; /* Added info IMAT */ b3dUByte ambient; /* Ambient multiplier to color */ b3dUByte diffuse; /* Diffuse multiplier to color */ b3dUByte specular; /* Specular property, added to color */ b3dUByte shininess; /* shininess exponent */ b3dUByte fillred; /* Fill color red */ b3dUByte fillgreen; /* Fill color green */ b3dUByte fillblue; /* Fill color blue */ b3dUByte quality; /* Sphere quality */ b3dUInt32 mat2; /* set to 0, use as flags. Unused */ b3dUByte valblack; /* Black level for showing values */ b3dUByte valwhite; /* White level for showing values */ b3dUByte matflags2; /* First two bits: skip low and high end in value draw */ b3dUByte meshThickness; /* Thickness between paired offset meshes */ }Iobjview;
typedef struct { /* Set up the camera */ b3dFloat fovy; /* field of view of camera, perspective in degrees. */ b3dFloat rad; /* viewing radius of sphere encloseing bounding box. */ b3dFloat aspect; /* aspect ratio */ b3dFloat cnear; /* clip near range 0.0 to 1.0, default 0.0. */ b3dFloat cfar; /* clip far range 0.0 to 1.0, default 1.0. */ /* Model transformation values for model view. */ Ipoint rot; Ipoint trans; Ipoint scale; /* World OpenGL transformation matrix (unused 8/21/07). */ b3dFloat mat[16]; b3dUInt32 world; /* flags */ b3dByte label[VIEW_STRSIZE]; /* Label for view */ b3dFloat dcstart, dcend; /* Depth cue start and end */ b3dFloat lightx, lighty; /* Light position X and Y */ b3dFloat plax; /* Parallax angle for stereo */ IclipPlanes clips; /* Global clipping planes */ Iobjview *objview; /* Array of properties of each object */ b3dInt32 objvsize; /* Number of objects properties exist for */ }Iview;
typedef struct { Ipoint oscale; Ipoint otrans; Ipoint orot; Ipoint cscale; Ipoint ctrans; Ipoint crot; }IrefImage;