Logo Search packages:      
Sourcecode: opencascade version File versions  Download package

void Graphic3d_Group::SetPrimitivesAspect ( const Handle(Graphic3d_AspectFillArea3d)&  CTX  ) 

Modifies the current context of the group to give
another aspect for all the face primitives created
after this call in the group.

Definition at line 412 of file Graphic3d_Group_8.cxx.

References Graphic3d_AspectFillArea3d::BackFace(), Graphic3d_AspectFillArea3d::BackMaterial(), Graphic3d_AspectFillArea3d::Distinguish(), Graphic3d_AspectFillArea3d::Edge(), Graphic3d_AspectFillArea3d::FrontMaterial(), Aspect_AspectFillArea::HatchStyle(), IsDeleted(), Graphic3d_MaterialAspect::MaterialType(), Graphic3d_AspectFillArea3d::PolygonOffsets(), Graphic3d_AspectFillArea3d::TextureMap(), Graphic3d_AspectFillArea3d::TextureMapState(), Update(), Aspect_AspectFillArea::Values(), and Quantity_Color::Values().

                                                                                        {

        if (IsDeleted ()) return;

        Standard_Real R, G, B;
        Standard_Real AWidth;
        //Quantity_Color AColor;
        Quantity_Color AIntColor;
        Quantity_Color BackIntColor;
        Quantity_Color AEdgeColor;
        Aspect_TypeOfLine ALType;
        Aspect_InteriorStyle AStyle;

        CTX->Values (AStyle, AIntColor, BackIntColor, AEdgeColor, ALType, AWidth);
        AIntColor.Values (R, G, B, Quantity_TOC_RGB);

        MyCGroup.ContextFillArea.Style          = int (AStyle);
        MyCGroup.ContextFillArea.IntColor.r     = float (R);
        MyCGroup.ContextFillArea.IntColor.g     = float (G);
        MyCGroup.ContextFillArea.IntColor.b     = float (B);
#ifdef OCC1174    
        if ( CTX->Distinguish() )
          BackIntColor.Values( R, G, B, Quantity_TOC_RGB );
#endif
        MyCGroup.ContextFillArea.BackIntColor.r = float( R );
        MyCGroup.ContextFillArea.BackIntColor.g = float( G );
        MyCGroup.ContextFillArea.BackIntColor.b = float( B );

        MyCGroup.ContextFillArea.Edge   = (CTX->Edge () ? 1 : 0);
        AEdgeColor.Values (R, G, B, Quantity_TOC_RGB);
        MyCGroup.ContextFillArea.EdgeColor.r    = float (R);
        MyCGroup.ContextFillArea.EdgeColor.g    = float (G);
        MyCGroup.ContextFillArea.EdgeColor.b    = float (B);
        MyCGroup.ContextFillArea.LineType       = int (ALType);
        MyCGroup.ContextFillArea.Width  = float (AWidth);
        MyCGroup.ContextFillArea.Hatch  = int (CTX->HatchStyle ());
        // Front and Back face
        MyCGroup.ContextFillArea.Distinguish    =
                        ( CTX->Distinguish () ? 1 : 0 );
        MyCGroup.ContextFillArea.BackFace       =
                        ( CTX->BackFace () ? 1 : 0 );
        
        /*** Back Material ***/
        // Material state
        MyCGroup.ContextFillArea.Back.Shininess =
                float ((CTX->BackMaterial ()).Shininess ());
        MyCGroup.ContextFillArea.Back.Ambient   =
                float ((CTX->BackMaterial ()).Ambient ());
        MyCGroup.ContextFillArea.Back.Diffuse   =
                float ((CTX->BackMaterial ()).Diffuse ());
        MyCGroup.ContextFillArea.Back.Specular  =
                float ((CTX->BackMaterial ()).Specular ());
        MyCGroup.ContextFillArea.Back.Transparency      =
                float ((CTX->BackMaterial ()).Transparency ());
        MyCGroup.ContextFillArea.Back.Emission  =
                float ((CTX->BackMaterial ()).Emissive ());     
                
        // Reflection mode      
        MyCGroup.ContextFillArea.Back.IsAmbient =
                ( (CTX->BackMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
        MyCGroup.ContextFillArea.Back.IsDiffuse =
                ( (CTX->BackMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
        MyCGroup.ContextFillArea.Back.IsSpecular        =
                ( (CTX->BackMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
        MyCGroup.ContextFillArea.Back.IsEmission        =
                ( (CTX->BackMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_EMISSION) ? 1 : 0 );
                                        
        // Material type
//JR/Hp
        const Graphic3d_MaterialAspect ama = CTX->BackMaterial () ;
        Standard_Boolean amt = ama.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
        MyCGroup.ContextFillArea.Back.IsPhysic = ( amt ? 1 : 0 );
//      MyCGroup.ContextFillArea.Back.IsPhysic  =
//              ( (CTX->BackMaterial ()).MaterialType
//                                      (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0 );
                                        
        // Material color                               
        /*MyCGroup.ContextFillArea.Back.Color.r =
                float (((CTX->BackMaterial ()).Color ()).Red ());
        MyCGroup.ContextFillArea.Back.Color.g   =
                float (((CTX->BackMaterial ()).Color ()).Green ());
        MyCGroup.ContextFillArea.Back.Color.b   =
                float (((CTX->BackMaterial ()).Color ()).Blue ());*/
        
        // Specular color                               
        MyCGroup.ContextFillArea.Back.ColorSpec.r       =
                float (((CTX->BackMaterial ()).SpecularColor ()).Red ());
        MyCGroup.ContextFillArea.Back.ColorSpec.g       =
                float (((CTX->BackMaterial ()).SpecularColor ()).Green ());
        MyCGroup.ContextFillArea.Back.ColorSpec.b       =
                float (((CTX->BackMaterial ()).SpecularColor ()).Blue ());
                
        // Ambient color                                
        MyCGroup.ContextFillArea.Back.ColorAmb.r        =
                float (((CTX->BackMaterial ()).AmbientColor ()).Red ());
        MyCGroup.ContextFillArea.Back.ColorAmb.g        =
                float (((CTX->BackMaterial ()).AmbientColor ()).Green ());
        MyCGroup.ContextFillArea.Back.ColorAmb.b        =
                float (((CTX->BackMaterial ()).AmbientColor ()).Blue ());
                
        // Diffuse color                                
        MyCGroup.ContextFillArea.Back.ColorDif.r        =
                float (((CTX->BackMaterial ()).DiffuseColor ()).Red ());
        MyCGroup.ContextFillArea.Back.ColorDif.g        =
                float (((CTX->BackMaterial ()).DiffuseColor ()).Green ());
        MyCGroup.ContextFillArea.Back.ColorDif.b        =
                float (((CTX->BackMaterial ()).DiffuseColor ()).Blue ());
                
        // Emissive color
        MyCGroup.ContextFillArea.Back.ColorEms.r        =
                float (((CTX->BackMaterial ()).EmissiveColor ()).Red ());
        MyCGroup.ContextFillArea.Back.ColorEms.g        =
                float (((CTX->BackMaterial ()).EmissiveColor ()).Green ());
        MyCGroup.ContextFillArea.Back.ColorEms.b        =
                float (((CTX->BackMaterial ()).EmissiveColor ()).Blue ());
                
        MyCGroup.ContextFillArea.Back.EnvReflexion = 
                float ((CTX->BackMaterial ()).EnvReflexion());
                
        /*** Front Material ***/
        // Ligth specificity
        MyCGroup.ContextFillArea.Front.Shininess        =
                float ((CTX->FrontMaterial ()).Shininess ());
        MyCGroup.ContextFillArea.Front.Ambient  =
                float ((CTX->FrontMaterial ()).Ambient ());
        MyCGroup.ContextFillArea.Front.Diffuse  =
                float ((CTX->FrontMaterial ()).Diffuse ());
        MyCGroup.ContextFillArea.Front.Specular =
                float ((CTX->FrontMaterial ()).Specular ());
        MyCGroup.ContextFillArea.Front.Transparency     =
                float ((CTX->FrontMaterial ()).Transparency ());
        MyCGroup.ContextFillArea.Front.Emission =
                float ((CTX->FrontMaterial ()).Emissive ());    
                
        // Reflection mode      
        MyCGroup.ContextFillArea.Front.IsAmbient        =
                ( (CTX->FrontMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_AMBIENT) ? 1 : 0 );
        MyCGroup.ContextFillArea.Front.IsDiffuse        =
                ( (CTX->FrontMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_DIFFUSE) ? 1 : 0 );
        MyCGroup.ContextFillArea.Front.IsSpecular       =
                ( (CTX->FrontMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_SPECULAR) ? 1 : 0 );
        MyCGroup.ContextFillArea.Front.IsEmission       =
                ( (CTX->FrontMaterial ()).ReflectionMode
                                        (Graphic3d_TOR_EMISSION) ? 1 : 0 );
                                        
        //Material type
//JR/Hp
        const Graphic3d_MaterialAspect amas = CTX->FrontMaterial () ;
        Standard_Boolean amty = amas.MaterialType(Graphic3d_MATERIAL_PHYSIC) ;
        MyCGroup.ContextFillArea.Front.IsPhysic = ( amty ? 1 : 0 );
//      MyCGroup.ContextFillArea.Front.IsPhysic =
//              ( (CTX->FrontMaterial ()).MaterialType
//                                      (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0 );
        
        // Material color                               
        /*MyCGroup.ContextFillArea.Front.Color.r        =
                float (((CTX->FrontMaterial ()).Color ()).Red ());
        MyCGroup.ContextFillArea.Front.Color.g  =
                float (((CTX->FrontMaterial ()).Color ()).Green ());
        MyCGroup.ContextFillArea.Front.Color.b  =
                float (((CTX->FrontMaterial ()).Color ()).Blue ());*/
                                        
        // Specular color                               
        MyCGroup.ContextFillArea.Front.ColorSpec.r      =
                float (((CTX->FrontMaterial ()).SpecularColor ()).Red ());
        MyCGroup.ContextFillArea.Front.ColorSpec.g      =
                float (((CTX->FrontMaterial ()).SpecularColor ()).Green ());
        MyCGroup.ContextFillArea.Front.ColorSpec.b      =
                float (((CTX->FrontMaterial ()).SpecularColor ()).Blue ());
                
        // Ambient color                                
        MyCGroup.ContextFillArea.Front.ColorAmb.r       =
                float (((CTX->FrontMaterial ()).AmbientColor ()).Red ());
        MyCGroup.ContextFillArea.Front.ColorAmb.g       =
                float (((CTX->FrontMaterial ()).AmbientColor ()).Green ());
        MyCGroup.ContextFillArea.Front.ColorAmb.b       =
                float (((CTX->FrontMaterial ()).AmbientColor ()).Blue ());
                
        // Diffuse color                                
        MyCGroup.ContextFillArea.Front.ColorDif.r       =
                float (((CTX->FrontMaterial ()).DiffuseColor ()).Red ());
        MyCGroup.ContextFillArea.Front.ColorDif.g       =
                float (((CTX->FrontMaterial ()).DiffuseColor ()).Green ());
        MyCGroup.ContextFillArea.Front.ColorDif.b       =
                float (((CTX->FrontMaterial ()).DiffuseColor ()).Blue ());
                
        // Emissive color
        MyCGroup.ContextFillArea.Front.ColorEms.r       =
                float (((CTX->FrontMaterial ()).EmissiveColor ()).Red ());
        MyCGroup.ContextFillArea.Front.ColorEms.g       =
                float (((CTX->FrontMaterial ()).EmissiveColor ()).Green ());
        MyCGroup.ContextFillArea.Front.ColorEms.b       =
                float (((CTX->FrontMaterial ()).EmissiveColor ()).Blue ());
                
        MyCGroup.ContextFillArea.Front.EnvReflexion = 
                float ((CTX->FrontMaterial ()).EnvReflexion());
                
        MyCGroup.ContextFillArea.IsDef  = 1; // Material definition ok

        Handle(Graphic3d_TextureMap) GroupTextureMap = CTX->TextureMap();
        if (! GroupTextureMap.IsNull() )
          MyCGroup.ContextFillArea.Texture.TexId = GroupTextureMap->TextureId();
        else
          MyCGroup.ContextFillArea.Texture.TexId = -1;

        MyCGroup.ContextFillArea.Texture.doTextureMap =
                CTX->TextureMapState () ? 1 : 0;

        // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets 
        Standard_Integer aPolyMode;
        Standard_Real    aPolyFactor, aPolyUnits;
        CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
        MyCGroup.ContextFillArea.PolygonOffsetMode   = aPolyMode;
        MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
        MyCGroup.ContextFillArea.PolygonOffsetUnits  = aPolyUnits;
        // OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets

        int noinsert    = 0;
        MyGraphicDriver->FaceContextGroup (MyCGroup, noinsert);

        MyCGroup.ContextFillArea.IsSet  = 1;

        Update ();

}


Generated by  Doxygen 1.6.0   Back to index