/** completePlane **/ void completePlane(scene_t *scene, entity_t *ent) { sobj_t *sobj; plane_t *plane; assert(scene->magic == SCENE_T); assert(ent->magic == ENTITY_T); sobj = ent->entDerived; assert(sobj->magic == SCENEOBJ_T); plane = sobj->sobjDerived; assert(plane->magic == PLANE_T); plane->normal = unitize(cross(plane->orient1, plane->orient2)); completeSceneObj(scene, ent); }
/** newSceneObj **/ entity_t *createSceneObj(FILE *inFP, scene_t *scene, char *type, int code) { entity_t *ent; /* Pointer to new entity_t */ sobj_t *sobj; /* Pointer to new sobj_t */ pixel_t white = {255, 255, 255}; /* Default color */ intensity_t zero = {0, 0, 0}; /* Default diffuse/reflect values */ /* create new sceneObject structure */ ent = createEntity(inFP, type, code); sobj = (sobj_t *) malloc(sizeof(sobj_t)); assert(sobj != NULL); ent->entDerived = sobj; /* Set default values for a shape */ sobj->color = white; sobj->diffuse = zero; sobj->reflective = zero; sobj->magic = SCENEOBJ_T; loadSceneObj(inFP, ent); completeSceneObj(scene, ent); return(ent); }