[cig-commits] commit: I have added a

Mercurial hg at geodynamics.org
Mon Nov 24 11:29:25 PST 2008


changeset:   60:ef26cb535cd4
user:        LouisMoresi
date:        Thu Jul 10 02:00:51 2008 +0000
files:       DrawingObjects/src/SwarmViewer.c DrawingObjects/src/SwarmViewer.h
description:
I have added a
	Bool pointSmoothing

variable to the SwarmViewer which toggles GL_POINT_SMOOTH when visualizing a swarm. This is
useful when there are not too many particles and the spaces between them become more visible
and the particle shapes are obvious.

I don't know how expensive it would be to render the large arrays of material points with this
option so I have left it off by default.

Louis


diff -r 6ff81996b76a -r ef26cb535cd4 DrawingObjects/src/SwarmViewer.c
--- a/DrawingObjects/src/SwarmViewer.c	Wed Jun 25 05:33:27 2008 +0000
+++ b/DrawingObjects/src/SwarmViewer.c	Thu Jul 10 02:00:51 2008 +0000
@@ -39,7 +39,7 @@
 *+		Patrick Sunter
 *+		Greg Watson
 *+
-** $Id: SwarmViewer.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** $Id: SwarmViewer.c 774 2008-07-10 02:00:51Z LouisMoresi $
 ** 
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
@@ -119,9 +119,11 @@ lucSwarmViewer* _lucSwarmViewer_New(
 
 void _lucSwarmViewer_Init( 
 	lucSwarmViewer*                                              self,
-	float                                                        pointSize )
+	float                                                        pointSize, 
+	Bool													     pointSmoothing )
 {
 	self->pointSize           = pointSize;
+	self->pointSmoothing      = pointSmoothing;
 }
 
 void _lucSwarmViewer_Delete( void* drawingObject ) {
@@ -179,7 +181,9 @@ void _lucSwarmViewer_Construct( void* dr
 	
 	_lucSwarmViewer_Init( 
 		self, 
-		(float) Stg_ComponentFactory_GetDouble( cf, self->name, "pointSize", 1.0 ) );
+		(float) Stg_ComponentFactory_GetDouble( cf, self->name, "pointSize",      1.0 ),
+		(Bool ) Stg_ComponentFactory_GetBool(   cf, self->name, "pointSmoothing", 0 )
+	  );
 }
 
 void _lucSwarmViewer_Build( void* drawingObject, void* data ) {
@@ -229,14 +233,26 @@ void _lucSwarmViewer_BuildDisplayList( v
 	   the gl lighting system doesn't seem to deal with lighting such tiny objects well. Lighting
 	   of particles doesn't really help the user anyway, so I've disabled it for now.
 	   PatrickSunter - 8 Jun 2006 */
+			
 	glDisable(GL_LIGHTING);
-
+		
+	if(self->pointSmoothing) 
+		glEnable(GL_POINT_SMOOTH);
+	else 
+		glDisable(GL_POINT_SMOOTH);
+		
+	
 	glBegin( GL_POINTS );
 	_lucSwarmViewerBase_BuildDisplayList( self, _context );
 	glEnd( );
 
-	/* Put back lighting settings */
-	glEnable(GL_LIGHTING);
+	/* Put back lighting / smoothing settings to low-impact options */
+	
+	glEnable(GL_LIGHTING);	
+		
+	if(self->pointSmoothing) {
+		glDisable(GL_POINT_SMOOTH);
+	}
 }
 
 
diff -r 6ff81996b76a -r ef26cb535cd4 DrawingObjects/src/SwarmViewer.h
--- a/DrawingObjects/src/SwarmViewer.h	Wed Jun 25 05:33:27 2008 +0000
+++ b/DrawingObjects/src/SwarmViewer.h	Thu Jul 10 02:00:51 2008 +0000
@@ -39,7 +39,7 @@
 *+		Patrick Sunter
 *+		Greg Watson
 *+
-** $Id: SwarmViewer.h 667 2007-03-01 06:43:11Z RobertTurnbull $
+** $Id: SwarmViewer.h 774 2008-07-10 02:00:51Z LouisMoresi $
 ** 
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
@@ -55,8 +55,9 @@
 		/* Macro defining parent goes here - This means you can cast this class as its parent */ \
 		__lucSwarmViewerBase \
 		/* Virtual functions go here */ \
-		/* Other info */\
-		float                                              pointSize;
+		/* Other info */ \
+		float                                              pointSize; \
+		Bool											   pointSmoothing;
 
 		/* Opacity Stuff */ 
 	



More information about the CIG-COMMITS mailing list