2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can [0]istribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file gameengine/Converter/BlenderWorldInfo.cpp
33 #include <stdio.h> // printf()
35 #include "BlenderWorldInfo.h"
37 /* This little block needed for linking to Blender... */
39 #include "BLI_winstuff.h"
42 /* This list includes only data type definitions */
43 #include "DNA_object_types.h"
44 #include "DNA_material_types.h"
45 #include "DNA_image_types.h"
46 #include "DNA_lamp_types.h"
47 #include "DNA_group_types.h"
48 #include "DNA_scene_types.h"
49 #include "DNA_camera_types.h"
50 #include "DNA_property_types.h"
51 #include "DNA_text_types.h"
52 #include "DNA_sensor_types.h"
53 #include "DNA_controller_types.h"
54 #include "DNA_actuator_types.h"
55 #include "DNA_mesh_types.h"
56 #include "DNA_meshdata_types.h"
57 #include "DNA_view3d_types.h"
58 #include "DNA_world_types.h"
59 #include "DNA_screen_types.h"
63 #include "BKE_global.h"
64 #include "BKE_scene.h"
65 /* end of blender include block */
68 BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World *blenderworld)
72 m_hasmist = ((blenderworld->mode) & WO_MIST ? true : false);
73 m_misttype = blenderworld->mistype;
74 m_miststart = blenderworld->miststa;
75 m_mistdistance = blenderworld->mistdist;
76 m_mistintensity = blenderworld->misi;
77 copy_v3_v3(m_mistcolor, &blenderworld->horr);
78 copy_v3_v3(m_backgroundcolor, &blenderworld->horr);
79 copy_v3_v3(m_ambientcolor, &blenderworld->ambr);
81 if (BKE_scene_check_color_management_enabled(blenderscene)) {
82 linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor);
83 linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor);
84 linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor);
92 BlenderWorldInfo::~BlenderWorldInfo()
96 bool BlenderWorldInfo::hasWorld()
101 bool BlenderWorldInfo::hasMist()
106 float BlenderWorldInfo::getBackColorRed()
108 return m_backgroundcolor[0];
111 float BlenderWorldInfo::getBackColorGreen()
113 return m_backgroundcolor[1];
116 float BlenderWorldInfo::getBackColorBlue()
118 return m_backgroundcolor[2];
121 float BlenderWorldInfo::getAmbientColorRed()
123 return m_ambientcolor[0];
126 float BlenderWorldInfo::getAmbientColorGreen()
128 return m_ambientcolor[1];
131 float BlenderWorldInfo::getAmbientColorBlue()
133 return m_ambientcolor[2];
136 short BlenderWorldInfo::getMistType()
141 float BlenderWorldInfo::getMistStart()
146 float BlenderWorldInfo::getMistDistance()
148 return m_mistdistance;
151 float BlenderWorldInfo::getMistIntensity()
153 return m_mistintensity;
156 float BlenderWorldInfo::getMistColorRed()
158 return m_mistcolor[0];
161 float BlenderWorldInfo::getMistColorGreen()
163 return m_mistcolor[1];
166 float BlenderWorldInfo::getMistColorBlue()
168 return m_mistcolor[2];
171 void BlenderWorldInfo::setBackColor(float r, float g, float b)
173 m_backgroundcolor[0] = r;
174 m_backgroundcolor[1] = g;
175 m_backgroundcolor[2] = b;
178 void BlenderWorldInfo::setMistType(short type)
183 void BlenderWorldInfo::setUseMist(bool enable)
188 void BlenderWorldInfo::setMistStart(float d)
193 void BlenderWorldInfo::setMistDistance(float d)
198 void BlenderWorldInfo::setMistIntensity(float intensity)
200 m_mistintensity = intensity;
202 void BlenderWorldInfo::setMistColor(float r, float g, float b)
209 void BlenderWorldInfo::setAmbientColor(float r, float g, float b)
211 m_ambientcolor[0] = r;
212 m_ambientcolor[1] = g;
213 m_ambientcolor[2] = b;