示例#1
0
文件: mapping.cpp 项目: refnum/quesa
Mapping *
SphereMappingCreate(
        Vector          *center,
        Vector          *norm,
        Vector          *uaxis)
{
	Mapping *res;

	res = (Mapping *)Malloc(sizeof(Mapping));
	res->flags = OBJSPACE;
	res->method = SphereMapping;
	if (center)
		res->center = *center;
	else
		res->center.x = res->center.y = res->center.z = 0.;
	if (norm && uaxis) {
		res->norm = *norm;
		if (VecNormalize(&res->norm) == 0.) {
			RLerror(RL_ABORT, "Degenerate mapping vector.\n");
			return (Mapping *)NULL;
		}
		if (VecNormCross(norm, uaxis, &res->vaxis) == 0.) {
			RLerror(RL_ABORT, "Degenerate mapping vector.\n");
			return (Mapping *)NULL;
		}
		(void)VecNormCross(&res->vaxis, norm, &res->uaxis);
	} else {
		res->norm.x = res->norm.y = res->uaxis.y = res->uaxis.z =
			res->vaxis.x = res->vaxis.z = 0.;
		res->norm.z = res->uaxis.x = res->vaxis.y = 1.;
	}
	return res;
}
示例#2
0
文件: plane.cpp 项目: refnum/quesa
/*
 * create plane primitive
 */
Plane *
PlaneCreate(Vector *pos,Vector *norm)
{
	Plane *plane;
	Vector tmpnrm;

	tmpnrm = *norm;
	if (VecNormalize(&tmpnrm) == 0.) {
		RLerror(RL_WARN, "Degenerate plane normal.\n");
		return (Plane *)NULL;
	}
	plane = (Plane *)share_malloc(sizeof(Plane));
	plane->norm = tmpnrm;
	plane->pos = *pos;
	plane->d = dotp(&plane->norm, pos);

	return plane;
}
示例#3
0
文件: setup.c 项目: cek/rayshade4
/*
 * Set default parameters
 */
void
RSSetup()
{
	extern SurfList *CurSurf;
	extern Medium TopMedium;
	extern void NoiseInit();
#ifdef MULTIMAX
	unsigned int bytes;

	/*
	 * Initialize shared memory stuff.
	 */
	bytes = 1 << SHARED_BYTES;
	if (share_malloc_init(bytes) == -1) {
		RLerror(RL_PANIC, "Cannot share_malloc %d bytes.\n",bytes);
	} else
		fprintf(fstats,"Malloced %d bytes of shared memory.\n",
				bytes);
#endif

	Camera.hfov = HFOV;
	Camera.vfov = UNSET;
	Camera.pos.x = EYEX;
	Camera.pos.y = EYEY;
	Camera.pos.z = EYEZ;
	Camera.lookp.x = LOOKX;
	Camera.lookp.y = LOOKY;
	Camera.lookp.z = LOOKZ;
	Camera.up.x = UPX;
	Camera.up.y = UPY;
	Camera.up.z = UPZ;
	Camera.focaldist = UNSET;
	Camera.aperture = 0.;

	Screen.xres = Screen.yres = UNSET;

	Options.cpp = TRUE;
	Options.maxdepth = MAXDEPTH;
	Options.report_freq = REPORTFREQ;
	Options.jitter = TRUE;
	Options.samples = UNSET;
	Options.gaussian = GAUSSIAN;
	Options.filterwidth = UNSET;
	Options.contrast.r = UNSET;
	Options.ambient.r = Options.ambient.g =
		Options.ambient.b = 1.0;
	Options.cutoff.r = UNSET;
	Options.cache = TRUE;
	Options.shadowtransp = TRUE;
	Options.crop[LOW][X] = Options.crop[LOW][Y] = 0.;
	Options.crop[HIGH][X] = Options.crop[HIGH][Y] = 1.;
	Stats.fstats = stderr;
	Options.pictfile = stdout;
#ifdef URT
	Options.alpha = TRUE;
	Options.exp_output = FALSE;
#endif
	Options.gamma = GAMMA;
	Options.eyesep = UNSET;
#ifdef LINDA
	Options.workers = WORKERS;
#endif

	Options.totalframes = 1;
	Options.startframe = 0;
	Options.starttime = 0.;
	Options.framelength = 1.;
	Options.shutterspeed = 0.;

	TopMedium.index = DEFAULT_INDEX;
	TopMedium.statten = 1.0;
	NoiseInit();			/* Initialize values for Noise() */

	/*
	 * Top of object definition stack points to the World object.
	 * The World object is always a list.
	 */
	Defstack = GeomStackPush(GeomListCreate(), (GeomList *)NULL);
	Defstack->obj->name = strsave("World");
	/* Initialize surface stack */
	CurSurf = SurfPush((Surface *)NULL, (SurfList *)NULL);
}
示例#4
0
文件: RT.cpp 项目: refnum/quesa
/*===========================================================================*\
 *
 *	Routine:	rt_Setup()
 *
 *	Comments:	Sets the default parameters
 *
\*===========================================================================*/
static
TQ3Status
rt_Setup(TRTDrawContext * /*inContext*/)
{
	extern Medium TopMedium;
	extern void NoiseInit();
#ifdef MULTIMAX
	unsigned int bytes;

	/*
	 * Initialize shared memory stuff.
	 */
	bytes = 1 << SHARED_BYTES;
	if (share_malloc_init(bytes) == -1) {
		RLerror(RL_PANIC, "Cannot share_malloc %d bytes.\n",bytes);
	} else
		fprintf(fstats,"Malloced %d bytes of shared memory.\n",
				bytes);
#endif

	Camera.hfov = HFOV;
	Camera.vfov = UNSET;
	Camera.pos.x = EYEX;
	Camera.pos.y = EYEY;
	Camera.pos.z = EYEZ;
	Camera.lookp.x = LOOKX;
	Camera.lookp.y = LOOKY;
	Camera.lookp.z = LOOKZ;
	Camera.up.x = UPX;
	Camera.up.y = UPY;
	Camera.up.z = UPZ;
	Camera.focaldist = UNSET;
	Camera.aperture = 0.;

	Screen.xres = Screen.yres = UNSET;

	Options.cpp = TRUE;
	Options.maxdepth = MAXDEPTH;
	Options.report_freq = REPORTFREQ;
	Options.jitter = TRUE;
	Options.samples = UNSET;
	Options.gaussian = GAUSSIAN;
	Options.filterwidth = UNSET;
	Options.contrast.r = UNSET;
	Options.ambient.r = Options.ambient.g =
		Options.ambient.b = 1.0;
	Options.cutoff.r = UNSET;
	Options.cache = TRUE;
	Options.shadowtransp = TRUE;
	Options.crop[LOW][X] = Options.crop[LOW][Y] = 0.;
	Options.crop[HIGH][X] = Options.crop[HIGH][Y] = 1.;
	Stats.fstats = stderr;
	Options.pictfile = stdout;
#ifdef URT
	Options.alpha = TRUE;
	Options.exp_output = FALSE;
#endif
	Options.gamma = GAMMA;
	Options.eyesep = UNSET;
#ifdef LINDA
	Options.workers = WORKERS;
#endif

	Options.totalframes = 1;
	Options.startframe = 0;
	Options.starttime = 0.;
	Options.framelength = 1.;
	Options.shutterspeed = 0.;

	TopMedium.index = DEFAULT_INDEX;
	TopMedium.statten = 1.0;
	NoiseInit();			/* Initialize values for Noise() */


	
	return kQ3Success;
}