C++.


- 3


/p>

//

( dynamic_cast  (RTTI). , . RTTI 19.)

, SCLS, (. . 18.1).

 


 

 

 

 

SoNode SCLS

 

 


 

 

 

 

 

 

SoLight

 

 


SoPointLight SoSpotLight SoDirectionalLight

 

 


RPointLight RSpotLight RDirectionalLight

. 18.1.

class RiDirectionalLight :

public SoDirectionalLight, public SCLS { ... };

 

class RiSpotLight :

public SoSpotLight, public SCLS { ... };

 

// ...

SoLight *plight = next_scene_light();

if ( SCLS *pscls = dynamic_cast<SCLS*>(plight))

pscls->cast_shadow_map();

. Open Inventor, , SoLight

- SCLS cast_shadow_map():

class SoLight : public SoNode {

public:

void cast_shadow_map()

{ if ( _scls ) _scls->cast_shadow_map(); }

// ...

protected:

SCLS *_scls;

};

 

// ...

 

SdSoLight *plight = next_scene_light();

plight-> cast_shadow_map();

, ( ) ,  / C++.   istream