Ejemplo n.º 1
0
void Vertex::draw(){
	if (!visible_)
	{
		return;
	}
	glColor4f( color_(0), color_(1), color_(2), color_(3) );
	draw_without_color();
};
Ejemplo n.º 2
0
void Vertex::draw( const Matrix44& adjust_matrix, const Vec3& bias )
{
	if (!visible_)
	{
		return;
	}
	glColor4f( color_(0), color_(1), color_(2), color_(3) );
	draw_without_color(adjust_matrix, bias);
}
Ejemplo n.º 3
0
	void main1_3(void *arg)
	{
		color Kd = color(diffuse(), diffuse(), diffuse());

		normal Nf = faceforward(normalize(N()), I());
		vector V = -normalize(I());

		while (illuminance(P(), Nf, PI / 2.0f))
		{
			color C = 0.0f;
			SAMPLE_LIGHT_2(color, C, 0.0f,
				C += Cl() * (
					color_() * Kd * (normalize(L()) % Nf) 
					+ cosinePower() * specularColor() * specularbrdf(normalize(L()), Nf, V, 0.1f/*roughness()*/)
					)
				);

			Ci() += C;
		}

		if ( ! less_than( &transparency(), LIQ_SCALAR_ALMOST_ZERO ) )
		{//transparent
			Ci() = Ci() * ( 1.0f - transparency() ) + trace_transparent() * transparency();
		}//else{ opacity }
		setOutputForMaya();
	}
Ejemplo n.º 4
0
	void main1(void *arg)
	{
		color Kd = color(diffuse(), diffuse(), diffuse());

		normal Nf = faceforward(normalize(N()), I());
		vector V = -normalize(I());

		while (illuminance(P(), Nf, PI / 2.0f))
		{
			color	C = 0.0f;
			color	last = 0.0f;
			int		num_samples = 0;

			while (sample_light())
			{
				C += Cl() * (
					color_() * Kd * (normalize(L()) % Nf) 
					+ cosinePower() * specularColor() * specularbrdf(normalize(L()), Nf, V, 0.1f/*roughness()*/)
					);

				++ num_samples;

				if ((num_samples % 4) == 0)
				{
					color	current = C * (1.0f / (scalar)num_samples);

					if (converged(current, last)){
						break;
					}
					last = current;
				}
			}

			C *= (1.0f / (scalar)num_samples);
			Ci() += C;
		}

		if ( ! less_than( &transparency(), LIQ_SCALAR_ALMOST_ZERO ) )
		{//transparent
			Ci() = Ci() * ( 1.0f - transparency() ) + trace_transparent() * transparency();
		}//else{ opacity }
		setOutputForMaya();
	}
Ejemplo n.º 5
0
Archivo: pwritf.c Proyecto: afni/rmafni
/* Subroutine */ int pwritf_(real *x, real *y, char *ch, integer *nch, 
	integer *isiz, integer *ior, integer *icent, ftnlen ch_len)
{
    /* System generated locals */
    integer i__1, i__2;
    real r__1, r__2;

    /* Builtin functions */
    double cos(doublereal), sin(doublereal);

    /* Local variables */
    static real xold, yold, size, xorg, yorg;
    static integer lstr[69999], nstr;
    static real xstr[69999], ystr[69999];
    static integer i__;
    static char chloc[6666];
    static integer nchar;
    extern /* Subroutine */ int color_(integer *);
    static integer isize;
    static real ct;
    static integer nchloc;
    static real st, xr, yr, xx, yy;
    extern integer lastnb_(char *, ftnlen);
    extern /* Subroutine */ int zzline_(real *, real *, real *, real *), 
	    zzconv_(char *, integer *, char *, integer *, ftnlen, ftnlen), 
	    zzphys_(real *, real *), zzstro_(char *, integer *, integer *, 
	    real *, real *, integer *, ftnlen);
    static real orr;




/* .......................................................................
 */

/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 */
/*  Calculate character width in terms of 1/1000 of the x-width. */


/*  Internal Data for PLOTPAK */

    isize = *isiz;
    if (isize <= 0) {
	isize = 8;
    } else if (isize == 1) {
	isize = 12;
    } else if (isize == 2) {
	isize = 16;
    } else if (isize == 3) {
	isize = 24;
    }

    size = isize * .001f * (zzzplt_1.xpgmax - zzzplt_1.xpgmin);

/*  Rotation/scaling factors for digitization */

    orr = *ior * .017453292f;
    ct = size * cos(orr);
    st = size * sin(orr);

/*  Base location, in internal coordinates */

    xx = *x;
    yy = *y;
    if (*nch >= 0) {
	zzphys_(&xx, &yy);
    }

/*  Get no. of characters in string.  Special option 999 must be checked. 
*/

    nchar = abs(*nch);
    if (nchar == 999) {
	i__1 = nchar;
	for (i__ = 1; i__ <= i__1; ++i__) {
	    if (*(unsigned char *)&ch[i__ - 1] == '\0') {
		goto L20;
	    }
/* L10: */
	}
L20:
	nchar = i__ - 1;
    } else if (nchar == 0) {
	nchar = lastnb_(ch, ch_len);
    }

/*  Digitize string into line segments */

    zzconv_(ch, &nchar, chloc, &nchloc, ch_len, 6666L);
    zzstro_(chloc, &nchloc, &nstr, xstr, ystr, lstr, 6666L);
    if (nstr <= 0) {
	return 0;
    }

/*  Find min, max of x and y */

    zzzplt_1.xbot = xstr[0];
    zzzplt_1.ybot = ystr[0];
    zzzplt_1.xtop = zzzplt_1.xbot;
    zzzplt_1.ytop = zzzplt_1.ybot;
    i__1 = nstr;
    for (i__ = 2; i__ <= i__1; ++i__) {
/* Computing MIN */
	r__1 = zzzplt_1.xbot, r__2 = xstr[i__ - 1];
	zzzplt_1.xbot = dmin(r__1,r__2);
/* Computing MAX */
	r__1 = zzzplt_1.xtop, r__2 = xstr[i__ - 1];
	zzzplt_1.xtop = dmax(r__1,r__2);
/* Computing MIN */
	r__1 = zzzplt_1.ybot, r__2 = ystr[i__ - 1];
	zzzplt_1.ybot = dmin(r__1,r__2);
/* Computing MAX */
	r__1 = zzzplt_1.ytop, r__2 = ystr[i__ - 1];
	zzzplt_1.ytop = dmax(r__1,r__2);
/* L100: */
    }

/*  Now compute origin of string, based on centering option; */
/*  the origin of the string goes at (XX,YY) */

    if (*icent == -1) {
	xorg = zzzplt_1.xbot;
	yorg = (zzzplt_1.ybot + zzzplt_1.ytop) * .5f;
    } else if (*icent == 0) {
	xorg = (zzzplt_1.xbot + zzzplt_1.xtop) * .5f;
	yorg = (zzzplt_1.ybot + zzzplt_1.ytop) * .5f;
    } else if (*icent == 1) {
	xorg = zzzplt_1.xtop;
	yorg = (zzzplt_1.ybot + zzzplt_1.ytop) * .5f;
    } else {
	xorg = zzzplt_1.xbot;
	yorg = zzzplt_1.ybot;
    }

/*  Now draw the strokes */

    i__1 = nstr;
    for (i__ = 1; i__ <= i__1; ++i__) {
	if (lstr[i__ - 1] <= 1) {
	    xr = xx + ct * (xstr[i__ - 1] - xorg) - st * (ystr[i__ - 1] - 
		    yorg);
	    yr = yy + st * (xstr[i__ - 1] - xorg) + ct * (ystr[i__ - 1] - 
		    yorg);
	    if (lstr[i__ - 1] == 1) {
		zzline_(&xold, &yold, &xr, &yr);
	    }
	    xold = xr;
	    yold = yr;
	} else if (lstr[i__ - 1] > 100 && lstr[i__ - 1] <= 107) {
	    i__2 = lstr[i__ - 1] - 100;
	    color_(&i__2);
	}
/* L200: */
    }

    zzzplt_1.xphold = xold;
    zzzplt_1.yphold = yold;
    return 0;
} /* pwritf_ */