[cig-commits] r4061 - in long/3D/Gale/trunk/src/gLucifer: .
DrawingObjects/src
walter at geodynamics.org
walter at geodynamics.org
Thu Jul 20 20:07:39 PDT 2006
Author: walter
Date: 2006-07-20 20:07:38 -0700 (Thu, 20 Jul 2006)
New Revision: 4061
Modified:
long/3D/Gale/trunk/src/gLucifer/
long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmRGBColourViewer.c
Log:
r61 at earth (orig r593): CecileDuboz | 2006-07-11 22:17:22 -0700
This file was not working due to wrong lighting..
Added a few firewalls as well to make sure that the
variable do exist before trying to retrieve them.
Property changes on: long/3D/Gale/trunk/src/gLucifer
___________________________________________________________________
Name: svk:merge
- 3433ad49-13df-0310-980d-a6a68cf0952a:/trunk:592
d11c8794-cf10-0410-8271-cb625e597d60:/cig:218
+ 3433ad49-13df-0310-980d-a6a68cf0952a:/trunk:593
d11c8794-cf10-0410-8271-cb625e597d60:/cig:218
Modified: long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmRGBColourViewer.c
===================================================================
--- long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmRGBColourViewer.c 2006-07-21 03:07:36 UTC (rev 4060)
+++ long/3D/Gale/trunk/src/gLucifer/DrawingObjects/src/SwarmRGBColourViewer.c 2006-07-21 03:07:38 UTC (rev 4061)
@@ -233,15 +233,41 @@
}
void _lucSwarmRGBColourViewer_Build( void* drawingObject, void* data ) {}
+
void _lucSwarmRGBColourViewer_Initialise( void* drawingObject, void* data ) {
lucSwarmRGBColourViewer* self = (lucSwarmRGBColourViewer*)drawingObject;
SwarmVariable_Register* swarmVariable_Register = self->swarm->swarmVariable_Register;
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+
+
self->opacityVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->opacityVariableName );
self->maskVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->maskVariableName );
- self->colourRedVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourRedVariableName );
- self->colourGreenVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourGreenVariableName );
- self->colourBlueVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourBlueVariableName );
+
+ if ( 0 != strcmp( self->colourRedVariableName, "" ) ) {
+ self->colourRedVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourRedVariableName );
+ Journal_Firewall( self->colourRedVariable != NULL, errorStr,
+ "Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
+ "but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+ self->name, __func__, self->colourRedVariableName, self->swarm->name );
+ }
+
+ if ( 0 != strcmp( self->colourGreenVariableName, "" ) ) {
+ self->colourGreenVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourGreenVariableName );
+ Journal_Firewall( self->colourGreenVariable != NULL, errorStr,
+ "Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
+ "but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+ self->name, __func__, self->colourGreenVariableName, self->swarm->name );
+ }
+
+ if ( 0 != strcmp( self->colourBlueVariableName, "" ) ) {
+ self->colourBlueVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourBlueVariableName );
+ Journal_Firewall( self->colourBlueVariable != NULL, errorStr,
+ "Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
+ "but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+ self->name, __func__, self->colourBlueVariableName, self->swarm->name );
+ }
+
}
@@ -287,54 +313,65 @@
double opacity = 1.0;
double maskResult;
StandardParticle* particle;
-
+ double colourValueRed = 0.0;
+ double colourValueGreen = 0.0;
+ double colourValueBlue = 0.0;
+
+
+
/* Initialise colour value */
memcpy( &colour, &self->colour, sizeof(lucColour) );
-
+
glPointSize( self->pointSize );
+ /* lighting of small particle objects like particle dots seems to do more harm than good */
+ glDisable(GL_LIGHTING);
+
glBegin( GL_POINTS );
- for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ){
- /* Test to see if this particle should be drawn */
- particle = Swarm_ParticleAt( swarm, lParticle_I );
+ for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I++ ){
+ /* Test to see if this particle should be drawn */
+ particle = Swarm_ParticleAt( swarm, lParticle_I );
- if ( maskVariable ) {
- SwarmVariable_ValueAt( maskVariable, lParticle_I, &maskResult );
- if ( lucDrawingObjectMask_Test( &self->mask, maskResult ) == False )
- continue;
- }
- /* Get Opacity Value */
- if ( opacityVariable ){
- SwarmVariable_ValueAt( opacityVariable, lParticle_I, &opacity );
- colour.opacity = (float)opacity;
-
- }
- /* Get red colour */
- if ( colourRedVariable){
-// SwarmVariable_ValueAt( colourRedVariable, lParticle_I, &colourRed );
- colour.red = Variable_GetValueFloat(colourRedVariable->variable, lParticle_I);
- }
- /* Get green colour */
- if ( colourGreenVariable){
- //SwarmVariable_ValueAt( colourGreenVariable, lParticle_I, &colourGreen );
- colour.green = Variable_GetValueFloat(colourGreenVariable->variable, lParticle_I);
- }
- /* Get blue colour */
- if ( colourBlueVariable){
- //SwarmVariable_ValueAt( colourBlueVariable, lParticle_I, &colourBlue );
- colour.blue = Variable_GetValueFloat(colourBlueVariable->variable, lParticle_I);
- }
-// if( (colour.red!=0.0) || (colour.green!=0.0) || (colour.blue!=0.0) ){
-// printf (" colour is %f %f %f \n", colourRed, colourGreen, colourBlue );
-// }
+ if ( maskVariable ) {
+ SwarmVariable_ValueAt( maskVariable, lParticle_I, &maskResult );
+ if ( lucDrawingObjectMask_Test( &self->mask, maskResult ) == False )
+ continue;
+ }
+ /* Get Opacity Value */
+ if ( opacityVariable ){
+ SwarmVariable_ValueAt( opacityVariable, lParticle_I, &opacity );
+ colour.opacity = (float)opacity;
+
+ }
+ /* Get red colour */
+ if ( colourRedVariable){
+ SwarmVariable_ValueAt( colourRedVariable, lParticle_I, &colourValueRed );
+ colour.red = colourValueRed;
+ /* Other way to do it... */
+ /* colour.red = Variable_GetValueFloat(colourRedVariable->variable, lParticle_I);*/
+ }
+ /* Get green colour */
+ if ( colourGreenVariable){
+ SwarmVariable_ValueAt( colourGreenVariable, lParticle_I, &colourValueGreen );
+ colour.green = colourValueGreen;
+ }
+
+ /* Get blue colour */
+ if ( colourBlueVariable){
+ SwarmVariable_ValueAt( colourBlueVariable, lParticle_I, &colourValueBlue );
+ colour.blue = colourValueBlue;
+ }
- lucColourMap_SetOpenGLColourFromRGB_ExplicitOpacity( colour.red, colour.green, colour.blue, (float)opacity );
+ lucColourMap_SetOpenGLColourFromRGB_ExplicitOpacity( colour.red, colour.green, colour.blue, (float)opacity );
- /* Plot the particle as a point */
- lucSwarmRGBColourViewer_PlotParticle( self, _context, lParticle_I );
- }
+ /* Plot the particle as a point */
+ lucSwarmRGBColourViewer_PlotParticle( self, _context, lParticle_I );
+ }
+ glEnd();
+
+ /* Put back lighting settings */
+ glEnable(GL_LIGHTING);
- glEnd();
}
More information about the cig-commits
mailing list