30f0ad28 |
1 | // Created on: 2013-09-25 |
2 | // Created by: Denis BOGOLEPOV |
d5f74e42 |
3 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
30f0ad28 |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
30f0ad28 |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
30f0ad28 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
30f0ad28 |
15 | |
16 | #include <Standard_Atomic.hxx> |
17 | |
18 | #include <Graphic3d_ShaderVariable.hxx> |
19 | |
30f0ad28 |
20 | |
92efcf78 |
21 | IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ShaderVariable,Standard_Transient) |
22 | |
30f0ad28 |
23 | // Specific instantiations of struct templates to avoid compilation warnings |
c4a8a6bb |
24 | template struct Graphic3d_UniformValue<Standard_Integer>; |
25 | template struct Graphic3d_UniformValue<Standard_ShortReal>; |
26 | template struct Graphic3d_UniformValue<Graphic3d_Vec2>; |
27 | template struct Graphic3d_UniformValue<Graphic3d_Vec3>; |
28 | template struct Graphic3d_UniformValue<Graphic3d_Vec4>; |
29 | template struct Graphic3d_UniformValue<Graphic3d_Vec2i>; |
30 | template struct Graphic3d_UniformValue<Graphic3d_Vec3i>; |
31 | template struct Graphic3d_UniformValue<Graphic3d_Vec4i>; |
30f0ad28 |
32 | |
33 | // ======================================================================= |
34 | // function : ~Graphic3d_ValueInterface |
35 | // purpose : Releases memory resources of variable value |
36 | // ======================================================================= |
37 | Graphic3d_ValueInterface::~Graphic3d_ValueInterface() |
38 | { |
39 | // |
40 | } |
41 | |
42 | // ======================================================================= |
43 | // function : Graphic3d_ShaderVariable |
44 | // purpose : Creates new abstract shader variable |
45 | // ======================================================================= |
46 | Graphic3d_ShaderVariable::Graphic3d_ShaderVariable (const TCollection_AsciiString& theName) |
47 | : myName (theName), |
48 | myValue (NULL) |
49 | { |
50 | // |
51 | } |
52 | |
53 | // ======================================================================= |
54 | // function : ~Graphic3d_ShaderVariableBase |
55 | // purpose : Releases resources of shader variable |
56 | // ======================================================================= |
57 | Graphic3d_ShaderVariable::~Graphic3d_ShaderVariable() |
58 | { |
59 | delete myValue; |
60 | } |
61 | |
62 | // ======================================================================= |
63 | // function : IsDone |
64 | // purpose : Checks if the shader variable is valid or not |
65 | // ======================================================================= |
66 | Standard_Boolean Graphic3d_ShaderVariable::IsDone() const |
67 | { |
68 | return !myName.IsEmpty() && (myValue != NULL); |
69 | } |
70 | |
71 | // ======================================================================= |
72 | // function : Name |
73 | // purpose : Returns name of shader variable |
74 | // ======================================================================= |
75 | const TCollection_AsciiString& Graphic3d_ShaderVariable::Name() const |
76 | { |
77 | return myName; |
78 | } |
79 | |
80 | // ======================================================================= |
81 | // function : Value |
82 | // purpose : Returns interface of shader variable value |
83 | // ======================================================================= |
84 | Graphic3d_ValueInterface* Graphic3d_ShaderVariable::Value() |
85 | { |
86 | return myValue; |
87 | } |