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.
15 #include <TCollection_AsciiString.hxx>
16 #include <TColStd_HArray1OfInteger.hxx>
17 #include <Vrml_SFImage.hxx>
18 #include <Vrml_Texture2.hxx>
20 Vrml_Texture2::Vrml_Texture2()
24 myImage = new Vrml_SFImage;
27 myImage->SetHeight(0);
28 myImage->SetNumber(Vrml_NULL);
30 myWrapS = Vrml_REPEAT;
31 myWrapT = Vrml_REPEAT;
34 Vrml_Texture2::Vrml_Texture2(const TCollection_AsciiString& aFilename,
35 const Handle(Vrml_SFImage)& aImage,
36 const Vrml_Texture2Wrap aWrapS,
37 const Vrml_Texture2Wrap aWrapT)
39 myFilename = aFilename;
45 void Vrml_Texture2::SetFilename(const TCollection_AsciiString& aFilename)
47 myFilename = aFilename;
50 TCollection_AsciiString Vrml_Texture2::Filename() const
55 void Vrml_Texture2::SetImage(const Handle(Vrml_SFImage)& aImage)
60 Handle(Vrml_SFImage) Vrml_Texture2::Image() const
65 void Vrml_Texture2::SetWrapS(const Vrml_Texture2Wrap aWrapS)
70 Vrml_Texture2Wrap Vrml_Texture2::WrapS() const
75 void Vrml_Texture2::SetWrapT(const Vrml_Texture2Wrap aWrapT)
80 Vrml_Texture2Wrap Vrml_Texture2::WrapT() const
85 Standard_OStream& Vrml_Texture2::Print(Standard_OStream& anOStream) const
88 anOStream << "Texture2 {\n";
90 if ( !(myFilename.IsEqual("") ) )
92 anOStream << " filename\t";
93 anOStream << '"' << myFilename << '"' << "\n";
96 if ( myImage->Width() != 0 || myImage->Height() != 0 || myImage->Number() != Vrml_NULL )
98 anOStream << " image\t";
99 anOStream << myImage->Width() << " " << myImage->Height() << " ";
101 switch ( myImage->Number() )
103 case Vrml_NULL: anOStream << "0"; break;
104 case Vrml_ONE: anOStream << "1"; break;
105 case Vrml_TWO: anOStream << "2"; break;
106 case Vrml_THREE: anOStream << "3"; break;
107 case Vrml_FOUR: anOStream << "4"; break;
110 if ( myImage->ArrayFlag() == Standard_True )
112 for ( i = myImage->Array()->Lower(); i <= myImage->Array()->Upper(); i++ )
114 // anOStream << " " << hex(myImage->Array()->Value(i),0);
115 anOStream << " " << myImage->Array()->Value(i);
123 case Vrml_REPEAT: break; // anOStream << " wrapS\tREPEAT ";
124 case Vrml_CLAMP: anOStream << " wrapS\tCLAMP\n"; break;
129 case Vrml_REPEAT: break; // anOStream << " wrapT\tREPEAT ";
130 case Vrml_CLAMP: anOStream << " wrapT\tCLAMP\n"; break;