1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: b3dlight.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _B3D_B3DLIGHT_HXX
32 #define _B3D_B3DLIGHT_HXX
34 #ifndef _SVX_VECTOR3D_HXX
35 #include "vector3d.hxx"
38 #ifndef _SVX_MATRIL3D_HXX
39 #include "matril3d.hxx"
43 #include <tools/stream.hxx>
48 /*************************************************************************
50 |* Unterstuetzte Lichtquellen
52 \************************************************************************/
54 #define BASE3D_MAX_NUMBER_LIGHTS (8)
56 enum Base3DLightNumber
69 /*************************************************************************
71 |* Basisklasse fuer Lichtquellen
73 \************************************************************************/
82 Vector3D aPositionEye
;
83 Vector3D aSpotDirection
;
84 Vector3D aSpotDirectionEye
;
87 double fCosSpotCutoff
;
88 double fConstantAttenuation
;
89 double fLinearAttenuation
;
90 double fQuadraticAttenuation
;
92 unsigned bIsFirstLight
: 1;
93 unsigned bIsEnabled
: 1;
94 unsigned bIsDirectionalSource
: 1;
96 unsigned bIsAmbient
: 1;
97 unsigned bIsDiffuse
: 1;
98 unsigned bIsSpecular
: 1;
99 unsigned bLinearOrQuadratic
: 1;
104 // Zugriffsfunktionen
105 void SetIntensity(const Color rNew
,
106 Base3DMaterialValue
=Base3DMaterialAmbient
);
107 const Color
GetIntensity(Base3DMaterialValue
=Base3DMaterialAmbient
);
108 void SetPositionEye(const Vector3D
& rNew
)
109 { aPositionEye
=rNew
; }
110 const Vector3D
& GetPositionEye()
111 { return aPositionEye
; }
112 void SetPosition(const Vector3D
& rNew
)
114 const Vector3D
& GetPosition()
115 { return aPosition
; }
116 const Vector3D
& GetSpotDirection()
117 { return aSpotDirection
; }
118 const Vector3D
& GetSpotDirectionEye()
119 { return aSpotDirectionEye
; }
120 void SetSpotExponent(UINT16 nNew
)
121 { nSpotExponent
=nNew
; }
122 UINT16
GetSpotExponent()
123 { return nSpotExponent
; }
124 double GetSpotCutoff()
125 { return fSpotCutoff
; }
126 double GetCosSpotCutoff()
127 { return fCosSpotCutoff
; }
128 void SetConstantAttenuation(double fNew
)
129 { fConstantAttenuation
=fNew
; }
130 double GetConstantAttenuation()
131 { return fConstantAttenuation
; }
132 double GetLinearAttenuation()
133 { return fLinearAttenuation
; }
134 double GetQuadraticAttenuation()
135 { return fQuadraticAttenuation
; }
137 void Enable(BOOL bNew
=TRUE
)
140 { return bIsEnabled
; }
141 void SetFirst(BOOL bNew
=TRUE
)
142 { bIsFirstLight
=bNew
; }
144 { return bIsFirstLight
; }
145 void SetDirectionalSource(BOOL bNew
=TRUE
)
146 { bIsDirectionalSource
=bNew
; }
147 BOOL
IsDirectionalSource()
148 { return bIsDirectionalSource
; }
152 { return bIsAmbient
; }
154 { return bIsDiffuse
; }
156 { return bIsSpecular
; }
157 BOOL
IsLinearOrQuadratic()
158 { return bLinearOrQuadratic
; }
162 // Laden/Speichern in StarView
163 virtual void WriteData(SvStream
& rOut
) const;
164 virtual void ReadData(SvStream
& rIn
);
169 /*************************************************************************
171 |* Gruppe von Lichtquellen
173 \************************************************************************/
179 B3dLight aLight
[BASE3D_MAX_NUMBER_LIGHTS
];
181 // lokale Parameter des LightModels
182 Color aGlobalAmbientLight
;
184 // Hauptschalter fuer die Beleuchtung
185 unsigned bLightingEnabled
: 1;
186 unsigned bLocalViewer
: 1;
187 unsigned bModelTwoSide
: 1;
193 // lokale Parameter des LightModels
194 virtual void SetGlobalAmbientLight(const Color rNew
);
195 const Color
GetGlobalAmbientLight();
196 virtual void SetLocalViewer(BOOL bNew
=TRUE
);
197 virtual void SetModelTwoSide(BOOL bNew
=FALSE
);
198 BOOL
GetModelTwoSide();
200 // Hauptschalter fuer die Beleuchtung
201 virtual void EnableLighting(BOOL bNew
=TRUE
);
202 BOOL
IsLightingEnabled();
204 // Lichtquellen Interface
205 void SetIntensity(const Color rNew
,
206 Base3DMaterialValue
=Base3DMaterialAmbient
,
207 Base3DLightNumber
=Base3DLight0
);
208 const Color
GetIntensity(Base3DMaterialValue
=Base3DMaterialAmbient
,
209 Base3DLightNumber
=Base3DLight0
);
210 void SetPosition(const Vector3D
& rNew
,
211 Base3DLightNumber
=Base3DLight0
);
212 void SetDirection(const Vector3D
& rNew
,
213 Base3DLightNumber
=Base3DLight0
);
214 const Vector3D
& GetDirection(Base3DLightNumber
=Base3DLight0
);
215 void Enable(BOOL bNew
=TRUE
,
216 Base3DLightNumber
=Base3DLight0
);
217 BOOL
IsEnabled(Base3DLightNumber
=Base3DLight0
);
219 // Direkter Zugriff auf B3dLight
220 B3dLight
& GetLightObject(Base3DLightNumber
=Base3DLight0
);
222 // Laden/Speichern in StarView
223 virtual void WriteData(SvStream
& rOut
) const;
224 virtual void ReadData(SvStream
& rIn
);
229 }//end of namespace binfilter
231 #endif // _B3D_B3DLIGHT_HXX