Occluderclasssense.t[693]

Occluder: this is a mix-in class that can be used with multiple inheritance to combine with other classes (such as SenseConnector, or Thing subclasses), to create an "occluded view." This lets you exclude certain objects from view, and you can make the exclusion vary according to the point of view.

This class is useful for situations where the view from one location to another is partially obstructed. For example, suppose we have two rooms, connected by a window between them. The window is the sense connector that connects the two top-level locations, and it makes objects in one room visible from the point of view of the other room. Suppose that one room contains a bookcase, with its back to the window. From the point of view of the other room, we can't see anything inside the bookcase. This class allows for such special situations.

Note that occlusion rules are applied "globally" within a room - that is, anything that an Occluder occludes will be removed from view, even if it's visible from another, non-occluding connector. Hence, occlusion always takes precedence over "inclusion" - if an object is occluded just once, then it won't be in view, no matter how many times it's added back into view by other connectors. This comes from the order in which the occlusion rules are considered. Occlusion rules are always run last, and they can't distinguish the connector that added an object to view. So, we first run around and collect up everything that can be seen, by considering all of the different paths to seeing those things. Then, we go through all of the occlusion rules that apply to the room, and we remove from view everything that the occluding connectors want to occlude.

class Occluder :   object

Superclass Tree   (in declaration order)

Occluder
        object

Subclass Tree  

(none)

Global Objects  

(none)

Summary of Properties  

(none)

Summary of Methods  

clearSenseInfo  finishSensePath  occludeObj 

Properties  

(none)

Methods  

clearSenseInfo ( )sense.t[712]

When we initialize for the sense path calculation, register to receive notification after we've finished building the sense table. We'll use the notification to remove any occluded objects from the sense table.

finishSensePath (objs, sense)sense.t[735]
Receive notification that the sense path calculation is now finished. 'objs' is a LookupTable containing all of the objects involved in the sense path calculation (the objects are the keys in the table). Each object in the table now has its tmpXxx_ properties set to the sense path data we've calculated for that object - tmpTrans_ is the transparency to the object, tmpAmbient_ is the ambient light level at the object, and so on.

Since our job is to occlude certain objects from view, we'll run through the table and test each object using our occlusion rule. If we find that we do occlude an object, we'll set its transparency to 'opaque' to indicate that it cannot be seen.

occludeObj (obj, sense, pov)sense.t[700]
Do we occlude the given object, in the given sense and from the given point of view? This returns true if the object is occluded, nil if not. By default, we simply ask the object whether it's occluded by this occluder from the given POV.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3