1 // Created on: 1997-07-28
2 // Created by: Pierre CHALAMET
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
21 #include <Graphic3d_Texture1Dsegment.ixx>
22 #include <Graphic3d_TypeOfTextureMode.hxx>
23 #include <Graphic3d_TextureParams.hxx>
25 // =======================================================================
26 // function : Graphic3d_Texture1Dsegment
28 // =======================================================================
29 Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const TCollection_AsciiString& theFileName)
30 : Graphic3d_Texture1D (theFileName, Graphic3d_TOT_1D),
38 myParams->SetRepeat (Standard_True);
39 myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
40 Graphic3d_Vec4 (0.0f, 0.0f, 1.0f, 0.0f),
41 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f));
44 // =======================================================================
45 // function : Graphic3d_Texture1Dsegment
47 // =======================================================================
48 Graphic3d_Texture1Dsegment::Graphic3d_Texture1Dsegment (const Graphic3d_NameOfTexture1D theNOT)
49 : Graphic3d_Texture1D (theNOT, Graphic3d_TOT_1D),
57 myParams->SetRepeat (Standard_True);
58 myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
59 Graphic3d_Vec4 (0.0f, 0.0f, 1.0f, 0.0f),
60 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f));
63 // =======================================================================
64 // function : SetSegment
66 // =======================================================================
67 void Graphic3d_Texture1Dsegment::SetSegment (const Standard_ShortReal X1,
68 const Standard_ShortReal Y1,
69 const Standard_ShortReal Z1,
70 const Standard_ShortReal X2,
71 const Standard_ShortReal Y2,
72 const Standard_ShortReal Z2)
80 Graphic3d_Vec4 aPlaneX (X2 - X1, Y2 - Y1, Z2 - Z1, 0.0f);
82 Standard_ShortReal aSqNorm = aPlaneX.x() * aPlaneX.x()
83 + aPlaneX.y() * aPlaneX.y()
84 + aPlaneX.z() * aPlaneX.z();
85 aPlaneX.x() /= aSqNorm;
86 aPlaneX.y() /= aSqNorm;
87 aPlaneX.z() /= aSqNorm;
88 aPlaneX.w() = -aPlaneX.x() * X1
92 myParams->SetGenMode (Graphic3d_TOTM_OBJECT,
94 Graphic3d_Vec4 (0.0f, 0.0f, 0.0f, 0.0f));
97 // =======================================================================
100 // =======================================================================
101 void Graphic3d_Texture1Dsegment::Segment (Standard_ShortReal& X1,
102 Standard_ShortReal& Y1,
103 Standard_ShortReal& Z1,
104 Standard_ShortReal& X2,
105 Standard_ShortReal& Y2,
106 Standard_ShortReal& Z2) const