0024947: Redesign OCCT legacy type system -- automatic
[occt.git] / src / Graphic3d / Graphic3d_ShaderVariable.cxx
CommitLineData
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
30f0ad28 21// Specific instantiations of struct templates to avoid compilation warnings
c4a8a6bb 22template struct Graphic3d_UniformValue<Standard_Integer>;
23template struct Graphic3d_UniformValue<Standard_ShortReal>;
24template struct Graphic3d_UniformValue<Graphic3d_Vec2>;
25template struct Graphic3d_UniformValue<Graphic3d_Vec3>;
26template struct Graphic3d_UniformValue<Graphic3d_Vec4>;
27template struct Graphic3d_UniformValue<Graphic3d_Vec2i>;
28template struct Graphic3d_UniformValue<Graphic3d_Vec3i>;
29template struct Graphic3d_UniformValue<Graphic3d_Vec4i>;
30f0ad28 30
31// =======================================================================
32// function : ~Graphic3d_ValueInterface
33// purpose : Releases memory resources of variable value
34// =======================================================================
35Graphic3d_ValueInterface::~Graphic3d_ValueInterface()
36{
37 //
38}
39
40// =======================================================================
41// function : Graphic3d_ShaderVariable
42// purpose : Creates new abstract shader variable
43// =======================================================================
44Graphic3d_ShaderVariable::Graphic3d_ShaderVariable (const TCollection_AsciiString& theName)
45: myName (theName),
46 myValue (NULL)
47{
48 //
49}
50
51// =======================================================================
52// function : ~Graphic3d_ShaderVariableBase
53// purpose : Releases resources of shader variable
54// =======================================================================
55Graphic3d_ShaderVariable::~Graphic3d_ShaderVariable()
56{
57 delete myValue;
58}
59
60// =======================================================================
61// function : IsDone
62// purpose : Checks if the shader variable is valid or not
63// =======================================================================
64Standard_Boolean Graphic3d_ShaderVariable::IsDone() const
65{
66 return !myName.IsEmpty() && (myValue != NULL);
67}
68
69// =======================================================================
70// function : Name
71// purpose : Returns name of shader variable
72// =======================================================================
73const TCollection_AsciiString& Graphic3d_ShaderVariable::Name() const
74{
75 return myName;
76}
77
78// =======================================================================
79// function : Value
80// purpose : Returns interface of shader variable value
81// =======================================================================
82Graphic3d_ValueInterface* Graphic3d_ShaderVariable::Value()
83{
84 return myValue;
85}