next up previous contents index
Next: 7.39 data/examples/read_fileformat_obj1.dat Up: 7. Source Files Previous: 7.37 data/examples/polygon3_6.dat   Contents   Index


7.38 data/examples/polygon3_7.dat


/*
 * FILE: polygon3_7.dat
 *
 * example for using 3D textures
 */

A1 = (0.,0.,0.);
B1 = (0.4,0.,0.);
C1 = (0.4,0.4,0.);
D1 = (0.,0.4,0.);
A2 = (0.,0.,0.4);
B2 = (0.4,0.,0.4);
C2 = (0.4,0.4,0.4);
D2 = (0.,0.4,0.4);

N1 = (0.,0.,1.);
N2 = (0.,0.,1.);
N3 = (0.,1.,0.);
N4 = (1.,0.,0.);
N5 = (0.,1.,0.);
N6 = (1.,0.,0.);

cont1 = ( (A1,N1), (B1,N1), (C1,N1), (D1,N1) );
polygon1 = POLYGON3N( (A1,B1,D1), (cont1) );

cont2 = ( (A2,N2), (B2,N2), (C2,N2), (D2,N2) );
polygon2 = POLYGON3N( (A2,B2,D2), (cont2) );

cont3 = ( (A1,N3), (B1,N3), (B2,N3), (A2,N3) );
polygon3 = POLYGON3N( (A1,B1,A2), (cont3) );

cont4 = ( (B1,N4), (C1,N4), (C2,N4), (B2,N4) );
polygon4 = POLYGON3N( (B1,C1,B2), (cont4) );

cont5 = ( (C1,N5), (D1,N5), (D2,N5), (C2,N5) );
polygon5 = POLYGON3N( (C1,D1,C2), (cont5) );

cont6 = ( (D1,N6), (A1,N6), (A2,N6), (D2,N6) );
polygon6 = POLYGON3N( (D1,A1,D2), (cont6) );

teximg1 = TEXIMAGE3D(
  (
    (
    ((1.0,1.0,0.0,0.5), (1.0,0.0,1.0,0.5)),
    ((1.0,1.0,0.0,0.5), (1.0,1.0,1.0,0.5))
    ),
    (
    ((0.0,0.0,0.0,0.5), (0.0,0.0,1.0,0.5)),
    ((0.0,1.0,0.0,0.5), (0.0,1.0,1.0,0.5))
    )
  )
);

polys = (polygon1,polygon2,polygon3,polygon4,polygon5,
         polygon6);

cube1 = SCENENODE(
  (),
  ( TRANSFORMS( TRNSF3PT((0.6,0.6,0.6),(1.6,0.6,0.6),(0.6,1.6,0.6)) ) ),
  polys
);

SCENEROOT = SCENENODE(
  (cube1),
  (
    SETABSXYZTEXCS(),
    ATTRIBS( 
      teximg1,
      USETEXIMG(3),USEXYZTEXCS(1),USEABSXYZTEXCS(1),
      USETEXMAGTONEAREST(1),USETEXMINTONEAREST(1)
    )
  ),
  polys
);


next up previous contents index
Next: 7.39 data/examples/read_fileformat_obj1.dat Up: 7. Source Files Previous: 7.37 data/examples/polygon3_6.dat   Contents   Index
Administrator 2002-01-20