next up previous contents index
Next: Advanced Primitives Up: Flags Previous: Flags

Gateway Objects

    Gateway objects are used to make objects behind the gateway visible either only through the gateway object or only not through the gateway object.

If FLAGS_GATEWAY is set for an object and the object is transparent, then objects behind the scene with the flag FLAGS_ONLY_THROUGH_GATEWAY set can only be seen through the gateway object. Objects with the flag FLAGS_NOT_THROUGH_GATEWAY set can not be seen through the gateway object. Figure 25 shows the scene for the example code below.

  figure563
Figure 25: A gateway object

  the_object = new_sphere();
  the_object->material = blue;  
  the_object->flags |= FLAGS_NOT_THROUGH_GATEWAY;

  object the_object2 = new_sphere();
  the_object2->material = red;  
  the_object2->flags |= FLAGS_ONLY_THROUGH_GATEWAY;


  object the_object3 = shift(0, -4, 0, stretch(1.5, 0.1, 1,new_cube()));
  the_object3->material = clear;
  the_object3->flags |= FLAGS_GATEWAY;

  LINK(the_scene, PLUS, shift(-3, 0, 2, bind(the_object)));
  LINK(the_scene, PLUS, shift(-3, 0, -2, bind(the_object)));
  LINK(the_scene, PLUS, shift(3, 0, 2, bind(the_object)));
  LINK(the_scene, PLUS, shift(3, 0, -2, bind(the_object)));
  LINK(the_scene, PLUS, shift(0, 0, 2, bind(the_object)));
  LINK(the_scene, PLUS, shift(0, 0, -2, bind(the_object)));

  LINK(the_scene, PLUS, shift(-1, 0, 2, bind(the_object2)));
  LINK(the_scene, PLUS, shift(-1, 0, -2, bind(the_object2)));
  LINK(the_scene, PLUS, shift(1, 0, 2, bind(the_object2)));
  LINK(the_scene, PLUS, shift(1, 0, -2, bind(the_object2)));
  LINK(the_scene, PLUS, shift(-3, 0, 0, bind(the_object2)));
  LINK(the_scene, PLUS, shift(3, 0, 0, bind(the_object2)));

  LINK(the_scene, PLUS, bind(the_object3));

Oneway Gateways  

Objects can also have a a flag set FLAGS_ONEWAY_GATEWAY. If a ONEWAY_GATEWAY object has a reflective object behind it and ONLY_THROUGH_GATEWAY objects in front of it, then the reflections of the object will be visible through the gateway.

Fig 26 is a symetrical picture except the blue objects are NOT_THROUGH_GATEWAY and the red objects are ONLY_THROUGH_GATEWAY. The small part spheres in the middle of the scene are the reflections of two large spheres in front of the gateway. The blue large sphere is in the bottom left corner but the red large sphere can not be seen because it is ONLY_THROUGH_GATEWAY. Because it is a ONEWAY_GATEWAY the reflection of the red sphere can seen. The reflection of the top blue sphere can not be seen through the gateway but the reflection of the red sphere can.

  figure572
Figure 26: A Oneway Gateway Object



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998