[GRASS-SVN] r47398 - in grass/trunk: include lib/nviz lib/ogsf
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 3 14:20:47 EDT 2011
Author: annakrat
Date: 2011-08-03 11:20:47 -0700 (Wed, 03 Aug 2011)
New Revision: 47398
Modified:
grass/trunk/include/ogsf_proto.h
grass/trunk/lib/nviz/nviz.c
grass/trunk/lib/ogsf/GS2.c
Log:
wxNviz: init lights
Modified: grass/trunk/include/ogsf_proto.h
===================================================================
--- grass/trunk/include/ogsf_proto.h 2011-08-03 18:20:32 UTC (rev 47397)
+++ grass/trunk/include/ogsf_proto.h 2011-08-03 18:20:47 UTC (rev 47398)
@@ -88,6 +88,8 @@
int GS_surf_exists(int);
int GS_new_surface(void);
int GS_new_light(void);
+void GS_set_light_reset(int);
+int GS_get_light_reset(void);
void GS_setlight_position(int, float, float, float, int);
void GS_setlight_color(int, float, float, float);
void GS_setlight_ambient(int, float, float, float);
Modified: grass/trunk/lib/nviz/nviz.c
===================================================================
--- grass/trunk/lib/nviz/nviz.c 2011-08-03 18:20:32 UTC (rev 47397)
+++ grass/trunk/lib/nviz/nviz.c 2011-08-03 18:20:47 UTC (rev 47398)
@@ -39,6 +39,8 @@
}
/* lights */
+ GS_set_light_reset(1);
+
for (i = 0; i < MAX_LIGHTS - 1; i++) {
Nviz_new_light(data);
}
Modified: grass/trunk/lib/ogsf/GS2.c
===================================================================
--- grass/trunk/lib/ogsf/GS2.c 2011-08-03 18:20:32 UTC (rev 47397)
+++ grass/trunk/lib/ogsf/GS2.c 2011-08-03 18:20:47 UTC (rev 47398)
@@ -79,6 +79,7 @@
static struct Cell_head wind;
static int Buffermode;
static int Numlights = 0;
+static int Resetlight = 1;
static int Modelshowing = 0;
void void_func(void)
@@ -249,7 +250,16 @@
return (-1);
}
-
+void GS_set_light_reset(int i)
+{
+ Resetlight = i;
+ if (i)
+ Numlights = 0;
+}
+int GS_get_light_reset(void)
+{
+ return Resetlight;
+}
/*!
\brief Add new model light
@@ -258,12 +268,12 @@
*/
int GS_new_light(void)
{
- static int first = 1;
int i;
- if (first) {
- first = 0;
+ if (GS_get_light_reset()) {
+ GS_set_light_reset(0);
+
for (i = 0; i < MAX_LIGHTS; i++) {
Gv.lights[i].position[X] = Gv.lights[i].position[Y] = 0.0;
Gv.lights[i].position[Z] = 1.0;
More information about the grass-commit
mailing list