1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #include <Vrml_Texture2.ixx>
15 #include <TColStd_HArray1OfInteger.hxx>
17 Vrml_Texture2::Vrml_Texture2()
21 myImage = new Vrml_SFImage;
24 myImage->SetHeight(0);
25 myImage->SetNumber(Vrml_NULL);
27 myWrapS = Vrml_REPEAT;
28 myWrapT = Vrml_REPEAT;
31 Vrml_Texture2::Vrml_Texture2(const TCollection_AsciiString& aFilename,
32 const Handle(Vrml_SFImage)& aImage,
33 const Vrml_Texture2Wrap aWrapS,
34 const Vrml_Texture2Wrap aWrapT)
36 myFilename = aFilename;
42 void Vrml_Texture2::SetFilename(const TCollection_AsciiString& aFilename)
44 myFilename = aFilename;
47 TCollection_AsciiString Vrml_Texture2::Filename() const
52 void Vrml_Texture2::SetImage(const Handle(Vrml_SFImage)& aImage)
57 Handle(Vrml_SFImage) Vrml_Texture2::Image() const
62 void Vrml_Texture2::SetWrapS(const Vrml_Texture2Wrap aWrapS)
67 Vrml_Texture2Wrap Vrml_Texture2::WrapS() const
72 void Vrml_Texture2::SetWrapT(const Vrml_Texture2Wrap aWrapT)
77 Vrml_Texture2Wrap Vrml_Texture2::WrapT() const
82 Standard_OStream& Vrml_Texture2::Print(Standard_OStream& anOStream) const
85 anOStream << "Texture2 {" << endl;
87 if ( !(myFilename.IsEqual("") ) )
89 anOStream << " filename" << '\t';
90 anOStream << '"' << myFilename << '"' << endl;
93 if ( myImage->Width() != 0 || myImage->Height() != 0 || myImage->Number() != Vrml_NULL )
95 anOStream << " image" << '\t';
96 anOStream << myImage->Width() << ' ' << myImage->Height() << ' ';
98 switch ( myImage->Number() )
100 case Vrml_NULL: anOStream << "0"; break;
101 case Vrml_ONE: anOStream << "1"; break;
102 case Vrml_TWO: anOStream << "2"; break;
103 case Vrml_THREE: anOStream << "3"; break;
104 case Vrml_FOUR: anOStream << "4"; break;
107 if ( myImage->ArrayFlag() == Standard_True )
109 for ( i = myImage->Array()->Lower(); i <= myImage->Array()->Upper(); i++ )
111 // anOStream << ' ' << hex(myImage->Array()->Value(i),0);
112 anOStream << ' ' << myImage->Array()->Value(i);
120 case Vrml_REPEAT: break; // anOStream << " wrapS" << "\tREPEAT ";
121 case Vrml_CLAMP: anOStream << " wrapS" << "\tCLAMP" << endl; break;
126 case Vrml_REPEAT: break; // anOStream << " wrapT" << "\tREPEAT ";
127 case Vrml_CLAMP: anOStream << " wrapT" << "\tCLAMP" << endl; break;
130 anOStream << '}' << endl;