RioEngine  0.1
My first attempt to create a 3D WYSIWYG Game Engine
clinstancematerial.cpp
Go to the documentation of this file.
1 //--------------------------------------------------------------- @License begins
2 // RioEngine: The late night Coke -without whores- debugging sessions
3 // 2012-2015 Leopoldo Lomas Flores. Torreon, Coahuila. MEXICO
4 // leopoldolomas [at] gmail
5 // www.rioengine.com
6 // www.leopoldolomas.info
7 // "You have a problem, you face it like a man."
8 //
9 // This is free and unencumbered software released into the public domain.
10 //
11 // Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
12 // software, either in source code form or as a compiled binary, for any purpose,
13 // commercial or non-commercial, and by any means.
14 //
15 // In jurisdictions that recognize copyright laws, the author or authors of this
16 // software dedicate any and all copyright interest in the software to the public
17 // domain. We make this dedication for the benefit of the public at large and to
18 // the detriment of our heirs and successors. We intend this dedication to be
19 // an overt act of relinquishment in perpetuity of all present and future
20 // rights to this software under copyright law.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
24 // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //--------------------------------------------------------------- @License ends
29 
30 #include <string>
31 #include "misc/genericshelper.hpp"
32 #include "cengine/carray.h"
34 
35 //-----------------------------------------------------------------------------
36 
38  setSymbol("");
39  setTarget("");
40 
41  m_bindVertexInputList = NULL;
42 }
43 
44 //-----------------------------------------------------------------------------
45 
47  copyValuesFromObject(original_obj);
48 }
49 
50 //-----------------------------------------------------------------------------
51 
52 CLInstanceMaterial::CLInstanceMaterial(const std::string& symbol, const std::string& target) : CObject() {
53  setSymbol(symbol);
54  setTarget(target);
55 
56  m_bindVertexInputList = NULL;
57 }
58 
59 //-----------------------------------------------------------------------------
60 
62  if (this == &original_obj) {
63  return *this;
64  }
65 
66  copyValuesFromObject(original_obj);
67 
68  return *this;
69 }
70 
71 //-----------------------------------------------------------------------------
72 
74  m_symbol = std::string(original_obj.symbol());
75  m_target = std::string(original_obj.target());
76 
77  if ((original_obj.bindVertexInputList() &&
78  original_obj.bindVertexInputList()->size() > 0)) {
79  m_bindVertexInputList = (CArray<CLBindVertexInput>*)original_obj.bindVertexInputList()->retain();
80  } else {
81  m_bindVertexInputList = NULL;
82  }
83 }
84 
85 //-----------------------------------------------------------------------------
86 
88  SAFE_RELEASE(m_bindVertexInputList);
89  SAFE_RETAIN(_array);
90  m_bindVertexInputList = _array;
91 }
92 
93 //-----------------------------------------------------------------------------
94 
96  return m_bindVertexInputList;
97 }
98 
99 //-----------------------------------------------------------------------------
100 
101 void CLInstanceMaterial::setSymbol(const std::string& symbol) {
102  m_symbol = symbol;
103 }
104 
105 //-----------------------------------------------------------------------------
106 
107 void CLInstanceMaterial::setSymbolFromQString(const QString& symbol) {
108  m_symbol = symbol.toStdString();
109 }
110 
111 //-----------------------------------------------------------------------------
112 
113 void CLInstanceMaterial::setTarget(const std::string& target) {
114  m_target = target;
115 }
116 
117 //-----------------------------------------------------------------------------
118 
119 void CLInstanceMaterial::setTargetFromQString(const QString& target) {
120  m_target = target.toStdString();
121 }
122 
123 //-----------------------------------------------------------------------------
124 
125 const std::string& CLInstanceMaterial::symbol() const {
126  return m_symbol;
127 }
128 
129 //-----------------------------------------------------------------------------
130 
132  return QString::fromStdString(m_symbol);
133 }
134 
135 //-----------------------------------------------------------------------------
136 
137 const std::string& CLInstanceMaterial::target() const {
138  return m_target;
139 }
140 
141 //-----------------------------------------------------------------------------
142 
144  return QString::fromStdString(m_target);
145 }
146 
147 //-----------------------------------------------------------------------------
148 
150  SAFE_RELEASE(m_bindVertexInputList);
151 }
void setBindVertexInputList(CArray< CLBindVertexInput > *_array)
const std::string & target() const
CLInstanceMaterial & operator=(const CLInstanceMaterial &instance_material)
virtual void copyValuesFromObject(const CLInstanceMaterial &instance_material)
void setTarget(const std::string &target)
CArray< CLBindVertexInput > * bindVertexInputList() const
void setTargetFromQString(const QString &target)
void setSymbolFromQString(const QString &symbol)
#define SAFE_RELEASE(x)
Definition: cobject.h:36
void setSymbol(const std::string &symbol)
const std::string & symbol() const
#define SAFE_RETAIN(x)
Definition: cobject.h:35
unsigned int size() const
Definition: carray.h:104
CObject * retain()
Definition: cobject.cpp:66