Project

General

Profile

SO3Engine
SO3Material.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3MATERIAL_H__
33#define __SO3MATERIAL_H__
34
38
39namespace SO3
40{
41
42class _SO3_Export SMaterial : public SData
43{
44public:
45 static void CleanUpGeneratedTechniques(Ogre::Material* mat);
46protected:
47 Ogre::MaterialPtr ogreMaterial;
50 std::string mGroupName;
52private:
53
54public:
57 SMaterial(SScene* scene, const std::string& groupname, const std::string& materialName, const bool& loadedFromScript = false);
58
61 ~SMaterial();
62
65 SWidget* GetAssociatedWidget();
66
70 void SetAssociatedWidget(SWidget* newAssociatedWidget);
71
74 SScene* GetScene();
75
78 std::string GetGroupName();
79
82 Ogre::MaterialPtr getOgreMaterialPointer();
83
86 int GetNumTechniques();
87
90 STechnique* GetTechnique(const unsigned int& technique);
91
94 int GetTechniqueIndexByName(const std::string& techname);
95
98 bool GetReceiveShadows();
99
102 void SetReceiveShadows(const bool& state);
103
106 void SetLightingEnabled(const bool& state);
107
110 void SetAmbientColor(const int& color);
111
114 void SetDiffuseColor(const int& color);
115
118 void SetSpecularColor(const int& color);
119
122 void SetSelfIlluminationColor(const int& color);
123
126 void SetAmbientColor(float r, float g, float b, float a);
127
130 void SetDiffuseColor(float r, float g, float b, float a);
131
134 void SetSpecularColor(float r, float g, float b, float a);
135
138 void SetSelfIlluminationColor(float r, float g, float b, float a);
139
142 void SetShininess(const float& value);
143
144 void AddTechnique();
145
146 void RemoveTechnique(const unsigned int& technique);
147
151 void _BindTechniquesToOgre();
152
156 void _UnbindTechniquesToOgre();
157
160 void _UpdateOgreMaterialPointer();
161
165 void SetPointSize(Ogre::Real size);
166
170 void CleanUpGeneratedTechniques();
171
175 void WriteMaterialFile(std::string path = "");
176
177 static void UpdateMaterialScript(std::string path);
178
179 static int CountMaterialsInScript(std::string path);
180
184 void SetIgnoreSlicePlane(bool state);
185
189 bool GetIgnoreSlicePlane();
190
193 void UpdateGeneratedMaterial(bool full = false);
194protected:
195private:
199 SMaterial();
200};
201
202}
203
204#endif
librairies include
SScene * mScene
Definition SO3Material.h:48
std::string mGroupName
Definition SO3Material.h:50
Ogre::MaterialPtr ogreMaterial
Definition SO3Material.h:47
bool mIgnoreSlicePlane
Definition SO3Material.h:51
SWidget * associatedWidget
Definition SO3Material.h:49