OCC Main Page | Visualization | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

Visualization
TKV3d
AIS


AIS_TexturedShape Class Reference

This class allows to map textures on shapes
Textures are image files.
The texture itself is parametrized in (0,1)x(0,1).
Each face of a shape located in
UV space is provided with these parameters:
- Umin - starting position in U
- Umax - ending position in U
- Vmin - starting position in V
- Vmax - ending position in V
Each face is triangulated and a texel is assigned to each
node. Facets are then filled using a linear interpolation
of texture between each 'three texels'
User can act on :
- the number of occurences of the texture on the face
- the position of the origin of the texture
- the scale factor of the texture
.

#include <AIS_TexturedShape.hxx>

Inheritance diagram for AIS_TexturedShape:

Inheritance graph
[legend]

Public Member Functions

Standard_EXPORT AIS_TexturedShape (const TopoDS_Shape &shap)
 Initializes the textured shape ashape.
.
virtual Standard_EXPORT void SetTextureFileName (const TCollection_AsciiString &TextureFileName)
 Sets the name of the texture file to map. The accepted
file types are those used in AlienImage with extensions
such as xwd, bmp, gif, rgb, ras, rs and more.
.
virtual Standard_EXPORT void SetTextureRepeat (const Standard_Boolean RepeatYN, const Standard_Real URepeat=1.0, const Standard_Real VRepeat=1.0)
 Sets the number of occurrences of
the texture on each face. The texture itself is parameterized
in (0,1) by (0,1) . Each face of the shape to be textured is
parameterized in UV space (Umin,Umax) by (Vmin,Vmax). If
RepeatYN is set to false, texture coordinates are clamped in the
range (0,1)x(0,1) of the face.
.
virtual Standard_EXPORT void SetTextureOrigin (const Standard_Boolean SetTextureOriginYN, const Standard_Real UOrigin=0.0, const Standard_Real VOrigin=0.0)
 Use this method to change the origin of the
texture. The texel (0,0) will be mapped to the
surfel (UOrigin,VOrigin)
.
virtual Standard_EXPORT void SetTextureScale (const Standard_Boolean SetTextureScaleYN, const Standard_Real ScaleU=1.0, const Standard_Real ScaleV=1.0)
 Use this method to scale the texture (percent of
the face).
You can specify a scale factor for both U and V.

example : if you set ScaleU and ScaleV to 0.5 and
you enable texture repeat, the texture will appear
twice on the face in each direction.
.
virtual Standard_EXPORT void ShowTriangles (const Standard_Boolean ShowTrianglesYN=Standard_False)
 Use this method to show the triangulation of
the shape. This is not very esthetic but can be
usefull for debug ...
.
Standard_EXPORT void SetTextureMapOn ()
 Enables texture mapping
.
Standard_EXPORT void SetTextureMapOff ()
 Disables texture mapping
.
Standard_EXPORT void EnableTextureModulate ()
 Enables texture modulation
.
Standard_EXPORT void DisableTextureModulate ()
 Disables texture modulation
.
Standard_EXPORT void UpdateAttributes ()
 Use this method to display the textured shape
without recomputing the whole presentation.
Use this method when ONLY the texture has been changed.
ie : myTShape->UpdateAttributes()

If other parameters (ie: scale factors,
texture origin, texture repeat ...) have changed,
the whole presentation has to be recomputed.
ie : if (myShape->DisplayMode() == 3)
myAISContext->RecomputePrsOnly(myShape);
else
{
myAISContext->SetDisplayMode(myShape,3,Standard_False);
myAISContext->Display(myShape, Standard_True);
}
.
Standard_EXPORT Standard_Boolean TextureMapState () const
Standard_EXPORT Standard_Real URepeat () const
Standard_EXPORT Standard_Boolean TextureRepeat () const
Standard_EXPORT Standard_Real Deflection () const
Standard_EXPORT Standard_CString TextureFile () const
Standard_EXPORT Standard_Real VRepeat () const
Standard_EXPORT Standard_Boolean ShowTriangles () const
Standard_EXPORT Standard_Real TextureUOrigin () const
Standard_EXPORT Standard_Real TextureVOrigin () const
Standard_EXPORT Standard_Real TextureScaleU () const
Standard_EXPORT Standard_Real TextureScaleV () const
Standard_EXPORT Standard_Boolean TextureScale () const
Standard_EXPORT Standard_Boolean TextureOrigin () const
Standard_EXPORT Standard_Boolean TextureModulate () const
Standard_EXPORT const Handle (Standard_Type)&DynamicType() const

Protected Member Functions

virtual Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)&aPresentationManager, const Handle(Prs3d_Presentation)&aPresentation, const Standard_Integer aMode=0)
 Calculates the 3D view aPresentation and its
updates. The latter are managed by aPresentationManager.
aPresentableObject has the display mode aMode;
this has the default value of 0, that is, the wireframe display mode.
.

Private Member Functions

Standard_EXPORT Standard_Boolean TriangleIsValid (const gp_Pnt &P1, const gp_Pnt &P2, const gp_Pnt &P3) const

Private Attributes

Graphic3d_NameOfTexture2D myPredefTexture
TCollection_AsciiString myTextureFile
Standard_Boolean DoRepeat
Standard_Real myURepeat
Standard_Real myVRepeat
Standard_Boolean DoMapTexture
Standard_Boolean DoSetTextureOrigin
Standard_Real myUOrigin
Standard_Real myVOrigin
Standard_Boolean DoSetTextureScale
Standard_Real myScaleU
Standard_Real myScaleV
Standard_Boolean DoShowTriangles
Standard_Real myDeflection
Handle_Graphic3d_AspectFillArea3d myAspect
Handle_Graphic3d_Texture2Dmanual mytexture
Standard_Real Umin
Standard_Real Umax
Standard_Real Vmin
Standard_Real Vmax
Standard_Real dUmax
Standard_Real dVmax
Standard_Boolean myModulate

Constructor & Destructor Documentation

Standard_EXPORT AIS_TexturedShape::AIS_TexturedShape const TopoDS_Shape &  shap  ) 
 


Member Function Documentation

virtual Standard_EXPORT void AIS_TexturedShape::Compute const Handle(PrsMgr_PresentationManager3d)&  aPresentationManager,
const Handle(Prs3d_Presentation)&  aPresentation,
const Standard_Integer  aMode = 0
[protected, virtual]
 

Reimplemented from AIS_Shape.

Standard_EXPORT Standard_Real AIS_TexturedShape::Deflection  )  const
 

Standard_EXPORT void AIS_TexturedShape::DisableTextureModulate  ) 
 

Standard_EXPORT void AIS_TexturedShape::EnableTextureModulate  ) 
 

Standard_EXPORT const AIS_TexturedShape::Handle Standard_Type   )  const
 

Reimplemented from AIS_Shape.

virtual Standard_EXPORT void AIS_TexturedShape::SetTextureFileName const TCollection_AsciiString &  TextureFileName  )  [virtual]
 

Standard_EXPORT void AIS_TexturedShape::SetTextureMapOff  ) 
 

Standard_EXPORT void AIS_TexturedShape::SetTextureMapOn  ) 
 

virtual Standard_EXPORT void AIS_TexturedShape::SetTextureOrigin const Standard_Boolean  SetTextureOriginYN,
const Standard_Real  UOrigin = 0.0,
const Standard_Real  VOrigin = 0.0
[virtual]
 

virtual Standard_EXPORT void AIS_TexturedShape::SetTextureRepeat const Standard_Boolean  RepeatYN,
const Standard_Real  URepeat = 1.0,
const Standard_Real  VRepeat = 1.0
[virtual]
 

virtual Standard_EXPORT void AIS_TexturedShape::SetTextureScale const Standard_Boolean  SetTextureScaleYN,
const Standard_Real  ScaleU = 1.0,
const Standard_Real  ScaleV = 1.0
[virtual]
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::ShowTriangles  )  const
 

virtual Standard_EXPORT void AIS_TexturedShape::ShowTriangles const Standard_Boolean  ShowTrianglesYN = Standard_False  )  [virtual]
 

Standard_EXPORT Standard_CString AIS_TexturedShape::TextureFile  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TextureMapState  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TextureModulate  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TextureOrigin  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TextureRepeat  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TextureScale  )  const
 

Standard_EXPORT Standard_Real AIS_TexturedShape::TextureScaleU  )  const
 

Standard_EXPORT Standard_Real AIS_TexturedShape::TextureScaleV  )  const
 

Standard_EXPORT Standard_Real AIS_TexturedShape::TextureUOrigin  )  const
 

Standard_EXPORT Standard_Real AIS_TexturedShape::TextureVOrigin  )  const
 

Standard_EXPORT Standard_Boolean AIS_TexturedShape::TriangleIsValid const gp_Pnt &  P1,
const gp_Pnt &  P2,
const gp_Pnt &  P3
const [private]
 

Standard_EXPORT void AIS_TexturedShape::UpdateAttributes  ) 
 

Standard_EXPORT Standard_Real AIS_TexturedShape::URepeat  )  const
 

Standard_EXPORT Standard_Real AIS_TexturedShape::VRepeat  )  const
 


Field Documentation

Standard_Boolean AIS_TexturedShape::DoMapTexture [private]
 

Standard_Boolean AIS_TexturedShape::DoRepeat [private]
 

Standard_Boolean AIS_TexturedShape::DoSetTextureOrigin [private]
 

Standard_Boolean AIS_TexturedShape::DoSetTextureScale [private]
 

Standard_Boolean AIS_TexturedShape::DoShowTriangles [private]
 

Standard_Real AIS_TexturedShape::dUmax [private]
 

Standard_Real AIS_TexturedShape::dVmax [private]
 

Handle_Graphic3d_AspectFillArea3d AIS_TexturedShape::myAspect [private]
 

Standard_Real AIS_TexturedShape::myDeflection [private]
 

Standard_Boolean AIS_TexturedShape::myModulate [private]
 

Graphic3d_NameOfTexture2D AIS_TexturedShape::myPredefTexture [private]
 

Standard_Real AIS_TexturedShape::myScaleU [private]
 

Standard_Real AIS_TexturedShape::myScaleV [private]
 

Handle_Graphic3d_Texture2Dmanual AIS_TexturedShape::mytexture [private]
 

TCollection_AsciiString AIS_TexturedShape::myTextureFile [private]
 

Standard_Real AIS_TexturedShape::myUOrigin [private]
 

Standard_Real AIS_TexturedShape::myURepeat [private]
 

Standard_Real AIS_TexturedShape::myVOrigin [private]
 

Standard_Real AIS_TexturedShape::myVRepeat [private]
 

Standard_Real AIS_TexturedShape::Umax [private]
 

Standard_Real AIS_TexturedShape::Umin [private]
 

Standard_Real AIS_TexturedShape::Vmax [private]
 

Standard_Real AIS_TexturedShape::Vmin [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Aug 25 13:55:19 2008 for OpenCASCADE by  doxygen 1.4.1