[cig-commits] commit: Copy the 1.4.x branch to the default
Mercurial
hg at geodynamics.org
Fri Feb 5 13:00:22 PST 2010
changeset: 215:6f05d8c665b0
tag: tip
parent: 210:fbd4029e4444
parent: 214:2a10999ac584
user: Walter Landry <wlandry at caltech.edu>
date: Fri Feb 05 12:57:55 2010 -0800
files: Base/src/Camera.c Base/src/Camera.h Base/src/DrawingObject.c Base/src/DrawingObject_Register.c Base/src/Light.c Base/src/Light.h Base/src/Light_Register.c Base/src/OutputFormat.c Base/src/OutputFormat.h Base/src/OutputFormat.meta Base/src/OutputFormat_Register.c Base/src/OutputFormat_Register.h Base/src/RenderingEngine.c Base/src/RenderingEngine.h Base/src/Viewport.c Base/src/Viewport.h Base/src/Viewport.meta Base/src/Window.c Base/src/Window.h Base/src/Window.meta DrawingObjects/src/Axis.c DrawingObjects/src/Axis.h DrawingObjects/src/Axis.meta DrawingObjects/src/ColourBar.c DrawingObjects/src/CrossSection.c DrawingObjects/src/CrossSection.h DrawingObjects/src/CrossSection.meta DrawingObjects/src/DrawingObjects.h DrawingObjects/src/Eigenvectors.c DrawingObjects/src/Eigenvectors.h DrawingObjects/src/Eigenvectors.meta DrawingObjects/src/EigenvectorsCrossSection.c DrawingObjects/src/EigenvectorsCrossSection.h DrawingObjects/src/EigenvectorsCrossSection.meta DrawingObjects/src/FeVariableSurface.c DrawingObjects/src/FieldVariableBorder.c DrawingObjects/src/HistoricalSwarmTrajectory.c DrawingObjects/src/Init.c DrawingObjects/src/Isosurface.c DrawingObjects/src/MeshViewer.c DrawingObjects/src/MeshViewer.h DrawingObjects/src/MeshViewer.meta DrawingObjects/src/ScalarField.c DrawingObjects/src/ScalarField.h DrawingObjects/src/ScalarFieldCrossSection.c DrawingObjects/src/ScalarFieldCrossSection.h DrawingObjects/src/ScalarFieldCrossSection.meta DrawingObjects/src/ScalarFieldOnMesh.c DrawingObjects/src/ScalarFieldOnMesh.h DrawingObjects/src/ScalarFieldOnMeshCrossSection.c DrawingObjects/src/ScalarFieldOnMeshCrossSection.h DrawingObjects/src/ScalarFieldOnMeshCrossSection.meta DrawingObjects/src/TextureMap.c DrawingObjects/src/VectorArrowCrossSection.c DrawingObjects/src/VectorArrowCrossSection.h DrawingObjects/src/VectorArrowCrossSection.meta DrawingObjects/src/VectorArrows.c DrawingObjects/src/VectorArrows.h DrawingObjects/src/types.h OutputFormats/src/EncoderLibavcodec.c OutputFormats/src/EncoderLibavcodec.h OutputFormats/src/EncoderLibfame.c OutputFormats/src/EncoderLibfame.h OutputFormats/src/OutputJPEG.c OutputFormats/src/OutputJPEG.h OutputFormats/src/OutputPNG.c OutputFormats/src/OutputPNG.h OutputFormats/src/OutputPNG.meta OutputFormats/src/OutputPPM.c OutputFormats/src/OutputPPM.h OutputFormats/src/OutputTIFF.c OutputFormats/src/OutputTIFF.h OutputFormats/src/OutputVECTOR.c OutputFormats/src/OutputVECTOR.h RenderingEngines/src/OpenGlUtil.c RenderingEngines/src/RenderingEngineGL.c RenderingEngines/src/RenderingEngineGL.h RenderingEngines/src/RenderingEngineVTK.cxx RenderingEngines/src/RenderingEngineVTK.h Windowing/src/CarbonWindow.c Windowing/src/OSMesaWindow.c Windowing/src/SDLWindow.c Windowing/src/X11Window.c
description:
Copy the 1.4.x branch to the default
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Camera.c
--- a/Base/src/Camera.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Camera.c Fri Feb 05 12:57:55 2010 -0800
@@ -83,7 +83,7 @@ void* _lucCamera_DefaultNew( Name name )
Type type = lucCamera_Type;
Stg_Class_DeleteFunction* _delete = _lucCamera_Delete;
Stg_Class_PrintFunction* _print = _lucCamera_Print;
- Stg_Class_CopyFunction* _copy = _Stg_Class_Copy;
+ Stg_Class_CopyFunction* _copy = _lucCamera_Copy;
Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucCamera_DefaultNew;
Stg_Component_ConstructFunction* _construct = _lucCamera_AssignFromXML;
Stg_Component_BuildFunction* _build = _lucCamera_Build;
@@ -141,9 +141,7 @@ void _lucCamera_Init(
/* Store Original Values */
self->needsToDraw = True;
self->buffer = lucLeft;
- //self->originalCamera = lucCamera_Copy( self );
- self->originalCamera = _lucCamera_DefaultNew( "CameraCopy" );
- _lucCamera_Copy( self, self->originalCamera );
+ self->originalCamera = lucCamera_Copy( self );
}
void _lucCamera_Delete( void* camera ) {
@@ -191,9 +189,11 @@ void _lucCamera_Print( void* camera, Str
Stream_UnIndent( stream );
}
-void _lucCamera_Copy( void* camera, void* dest ) {
+void* _lucCamera_Copy( void* camera, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
lucCamera* self = camera;
- lucCamera* newCamera = dest;
+ lucCamera* newCamera;
+
+ newCamera = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
newCamera->originalCamera = NULL;
newCamera->centreFieldVariable = NULL;
@@ -209,6 +209,8 @@ void _lucCamera_Copy( void* camera, void
newCamera->buffer = self->buffer;
newCamera->stereoType = self->stereoType;
newCamera->needsToDraw = self->needsToDraw;
+
+ return (void*) newCamera;
}
void _lucCamera_AssignFromXML( void* camera, Stg_ComponentFactory* cf, void* data ) {
@@ -218,8 +220,7 @@ void _lucCamera_AssignFromXML( void* cam
Coord rotationCentre;
XYZ upDirection;
FieldVariable* centreFieldVariable;
- Coord vectorFocusToCamera;
- double focalLength, defaultFocalLength;
+ double focalLength;
double aperture;
double eyeSeparation;
lucStereoType stereoType;
@@ -242,13 +243,12 @@ void _lucCamera_AssignFromXML( void* cam
upDirection[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionY", 1.0 );
upDirection[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionZ", 0.0 );
+ focalLength = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalLength", 0.0 );
+
coord[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordX", 0.0 );
coord[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordY", 0.0 );
coord[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordZ", 1.0 );
- StGermain_VectorSubtraction( vectorFocusToCamera, coord, focalPoint, 3 );
- defaultFocalLength = StGermain_VectorMagnitude(vectorFocusToCamera, 3);
- focalLength = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalLength", defaultFocalLength );
aperture = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"aperture", 45.0 );
/* Get Stereo Type */
@@ -260,7 +260,7 @@ void _lucCamera_AssignFromXML( void* cam
else
stereoType = lucMono;
- eyeSeparation = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"eyeSeparation", focalLength / 30.0 );
+ eyeSeparation = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"eyeSeparation", 0.2 );
centreFieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"CentreFieldVariable", FieldVariable, False, data );
@@ -356,8 +356,7 @@ void lucCamera_Reset( void* camera ) {
lucCamera* self = camera;
lucCamera* originalCamera = self->originalCamera;
- _lucCamera_Copy( originalCamera, self );
- //Stg_Class_Copy( originalCamera, self, False, NULL, NULL );
+ Stg_Class_Copy( originalCamera, self, False, NULL, NULL );
self->originalCamera = originalCamera;
self->needsToDraw = True;
}
@@ -467,12 +466,11 @@ void lucCamera_ChangeFocalPoint( void* c
lucCamera* self = (lucCamera*) camera;
XYZ leftDirection;
Dimension_Index dim_I;
- double adjust = self->focalLength / 200.0;
lucCamera_GetLeftDirection( camera, leftDirection );
for ( dim_I = 0 ; dim_I < 3 ; dim_I++ ) {
- self->focalPoint[ dim_I ] += adjust * ((double)xpos - (double)startx) * leftDirection[ dim_I ];
- self->focalPoint[ dim_I ] -= adjust * ((double)ypos - (double)starty) * self->upDirection[ dim_I ];
+ self->focalPoint[ dim_I ] += 0.01 * ((double)xpos - (double)startx) * leftDirection[ dim_I ];
+ self->focalPoint[ dim_I ] -= 0.01 * ((double)ypos - (double)starty) * self->upDirection[ dim_I ];
}
self->needsToDraw = True;
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Camera.h
--- a/Base/src/Camera.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Camera.h Fri Feb 05 12:57:55 2010 -0800
@@ -112,7 +112,10 @@
void _lucCamera_Print( void* camera, Stream* stream );
- void _lucCamera_Copy( void* camera, void* dest );
+ void* _lucCamera_Copy( void* camera, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+
+ #define lucCamera_Copy( self ) \
+ (lucCamera*) Stg_Class_Copy( self, NULL, False, NULL, NULL )
void* _lucCamera_DefaultNew( Name name );
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/CrossSection.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/CrossSection.c Fri Feb 05 12:57:55 2010 -0800
@@ -0,0 +1,105 @@
+#include <StGermain/StGermain.h>
+
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "CrossSection.h"
+
+/* Returns a cross section struct parsed from XML string */
+lucCrossSection* lucCrossSection_Read( Stg_ComponentFactory* cf, Name component)
+{
+ Name crossSectionStr;
+ char axisChar;
+ char crossSectionVal[20];
+ char modifierChar = ' ';
+ lucCrossSection* self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
+ self->value = 0.0;
+ self->axis = 0;
+ self->interpolate = False;
+
+ /* Read the cross section string specification from xml */
+ crossSectionStr = Stg_ComponentFactory_GetString( cf, component, (Dictionary_Entry_Key)"crossSection", "z=min" );
+
+ /* axis=value : draw at this exact value on axis
+ * axis=min : draw at minimum of range on axis
+ * axis=max : draw at maximum of range on axis
+ * axis=value% : draw at interpolated percentage value of range on axis
+ * Axis is a single character, one of [xyzXYZ] */
+
+ /* Parse the input string */
+ if ( sscanf( crossSectionStr, "%c=%s", &axisChar, crossSectionVal ) == 2 )
+ {
+ /* Axis X/Y/Z */
+ if ( toupper( axisChar ) >= 'X' )
+ self->axis = toupper( axisChar ) - 'X'; /* x=0 y=1 z=2 */
+
+ if (sscanf( crossSectionVal, "%lf%c", &self->value, &modifierChar) >= 1)
+ {
+ /* Found a numeric value + optional modifier character */
+ //fprintf(stderr, "CROSS SECTION VALUE %lf on Axis %c\n",self->value, axisChar);
+
+ /* Interpolate cross section using percentage value */
+ if (modifierChar == '%')
+ {
+ /* Interpolate between max and min value using provided value as percentage */
+ self->interpolate = True;
+ //fprintf(stderr, "PERCENTAGE %lf %% CROSS SECTION on Axis %c\n", self->value, axisChar);
+ self->value *= 0.01;
+ }
+ }
+ /* Max or Min specified? */
+ else if (strcmp(crossSectionVal, "min") == 0)
+ {
+ self->value = 0.0;
+ self->interpolate = True;
+ //fprintf(stderr, "MIN CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
+ }
+ else if (strcmp(crossSectionVal, "max") == 0)
+ {
+ self->value = 1.0;
+ self->interpolate = True;
+ //fprintf(stderr, "MAX CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
+ }
+ }
+
+ /* Return cross section data */
+ return self;
+}
+
+/* Setup cross section values from passed parameters
+ * Returns pointer to passed in cross section so can be used in function calls
+ * If input object is NULL a new one is created */
+lucCrossSection* lucCrossSection_Set(lucCrossSection* self, double value, Axis axis, Bool interpolate)
+{
+ /* Allocate if necessary */
+ if (self == NULL)
+ self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
+
+ /* Copy values */
+ self->value = value;
+ self->axis = axis;
+ self->interpolate = interpolate;
+
+ /* Return pointer */
+ return self;
+}
+
+/* Returns the cross section value, interpolating where necessary */
+double lucCrossSection_GetValue(lucCrossSection* self, double min, double max)
+{
+ if (self->interpolate)
+ /* Interpolation factor 0-1 provided to determine cross-section value */
+ return min + self->value * (max - min);
+ else
+ /* Exact value provided */
+ return self->value;
+}
+
+/* Free cross-section memory */
+void lucCrossSection_Delete(lucCrossSection* self)
+{
+ if (self != NULL) Memory_Free(self);
+}
+
+
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/CrossSection.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/CrossSection.h Fri Feb 05 12:57:55 2010 -0800
@@ -0,0 +1,29 @@
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#ifndef __lucCrossSection_h__
+#define __lucCrossSection_h__
+
+/* Cross section utility */
+typedef struct {
+ double value;
+ Axis axis;
+ Bool interpolate;
+} lucCrossSection;
+
+/* Returns a cross section struct parsed from XML string */
+lucCrossSection* lucCrossSection_Read( Stg_ComponentFactory* cf, Name component);
+
+/* Setup cross section values from passed parameters
+ * Returns pointer to passed in cross section so can be used in function calls
+ * If input object is NULL a new one is created */
+lucCrossSection* lucCrossSection_Set(lucCrossSection* self, double value, Axis axis, Bool interpolate);
+
+/* Returns the cross section value, interpolating where necessary */
+double lucCrossSection_GetValue(lucCrossSection* self, double min, double max);
+
+/* Free cross-section memory */
+void lucCrossSection_Delete(lucCrossSection* self);
+
+#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/DrawingObject.c
--- a/Base/src/DrawingObject.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/DrawingObject.c Fri Feb 05 12:57:55 2010 -0800
@@ -141,11 +141,8 @@ void _lucDrawingObject_Destroy( void* ca
void lucDrawingObject_Setup( void* drawingObject, void* context ) {
lucDrawingObject* self = (lucDrawingObject*) drawingObject ;
- double time;
lucDebug_PrintFunctionBegin( self, 2 );
-
- time = MPI_Wtime();
if ( self->needsToSetup )
self->_setup( self, context );
@@ -156,9 +153,6 @@ void lucDrawingObject_Setup( void* drawi
self->needsToSetup = False;
self->needsToCleanUp = True;
- time = MPI_Wtime() - time;
- Journal_DPrintfL( lucDebug, 2, "Setup took %f seconds, ", time );
-
lucDebug_PrintFunctionEnd( self, 2 );
}
@@ -167,17 +161,15 @@ void lucDrawingObject_Draw( void* drawin
double time;
lucDebug_PrintFunctionBegin( self, 2 );
- Journal_DPrintfL( lucDebug, 2, "Drawing (%s), ", self->name );
lucDrawingObject_Setup( self, context );
-
time = MPI_Wtime();
self->_draw( self, window, viewportInfo, context );
time = MPI_Wtime() - time;
- Journal_DPrintfL( lucDebug, 2, "Drawing took %f seconds\n", time );
+ Journal_DPrintfL( lucDebug, 2, "(%s) Drawing took %f seconds\n", self->name, time );
lucDebug_PrintFunctionEnd( self, 2 );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/DrawingObject_Register.c
--- a/Base/src/DrawingObject_Register.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/DrawingObject_Register.c Fri Feb 05 12:57:55 2010 -0800
@@ -100,6 +100,7 @@ void lucDrawingObject_Register_DrawAll(
for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
object = lucDrawingObject_Register_GetByIndex( self, object_I );
+ lucLight_Register_EnableAll( lightRegister );
lucDrawingObject_Draw( object, window, viewportInfo, context );
if ( compositeEachDraw )
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Light.c
--- a/Base/src/Light.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Light.c Fri Feb 05 12:57:55 2010 -0800
@@ -58,15 +58,31 @@
const Type lucLight_Type = "lucLight";
-/* Default light at eye pos shining in all directions without attenuation, ie: sunlight from behind viewer
- * Setting the light position should be done relative to the eye rather than model, thus if you want the scene lit more from above,
- * simply increase the y component rather than calculating absolute world coordinates for such a light.
- * this allows the lighting to move with the camera and keep the scene lit in the same way
- * If absolute light coords required in future a flag can easily be implemented to do so */
-const double LUC_LIGHT_DEFAULT_POS_X = 0.0;
-const double LUC_LIGHT_DEFAULT_POS_Y = 0.0;
-const double LUC_LIGHT_DEFAULT_POS_Z = 0.0;
-const double LUC_LIGHT_DEFAULT_POS_W = 1.0;
+/* The position defaults have been chosen for a directional light source (hence posW=0)
+ shining onto the left,top,front corner of a 1x1x1 box, currently the most commonly
+ used geometry. -- PatrickSunter, 8 Jun 2006 */
+const double LUC_LIGHT_DEFAULT_POS_X = 1.0;
+const double LUC_LIGHT_DEFAULT_POS_Y = -2.0;
+const double LUC_LIGHT_DEFAULT_POS_Z = -2.0;
+const double LUC_LIGHT_DEFAULT_POS_W = 0.0;
+
+lucLight* lucLight_New(
+ Name name,
+ Light_Index index,
+ int model,
+ int material,
+ float position[4],
+ float lmodel_ambient[4],
+ float spotCutOff,
+ float spotDirection[3]
+)
+{
+ lucLight* self = (lucLight*) _lucLight_DefaultNew( name );
+
+ lucLight_InitAll( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
+
+ return self;
+}
lucLight* _lucLight_New( LUCLIGHT_DEFARGS )
{
@@ -80,6 +96,7 @@ lucLight* _lucLight_New( LUCLIGHT_DEFAR
nameAllocationType = NON_GLOBAL;
self = (lucLight*) _Stg_Component_New( STG_COMPONENT_PASSARGS );
+
return self;
}
@@ -114,22 +131,21 @@ void lucLight_Init(
}
-lucLight* lucLight_New(
- Name name,
- Light_Index index,
- int model,
- int material,
- float position[4],
- float lmodel_ambient[4],
- float spotCutOff,
- float spotDirection[3]
-)
+void lucLight_InitAll(
+ void* light,
+ Light_Index index,
+ int model,
+ int material,
+ float position[4],
+ float lmodel_ambient[4],
+ float spotCutOff,
+ float spotDirection[3])
{
- lucLight* self = (lucLight*) _lucLight_DefaultNew( name );
+
+ lucLight* self = light;
+ /* TODO Init parent */
lucLight_Init( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
-
- return self;
}
void _lucLight_Delete( void* light ) {
@@ -211,6 +227,7 @@ void _lucLight_AssignFromXML( void* ligh
float position[4];
float spotCutOff;
float spotDirection[3];
+ Name modelName;
Name materialName;
float lmodel_ambient[4];
@@ -232,6 +249,21 @@ void _lucLight_AssignFromXML( void* ligh
lmodel_ambient[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambG", 0.2 );
lmodel_ambient[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambB", 0.2 );
lmodel_ambient[3] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambA", 1.0 );
+
+
+ modelName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"model", "TwoSide" );
+ if ( strcasecmp( modelName, "Ambient" ) == 0 ) {
+ model = GL_LIGHT_MODEL_AMBIENT;
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ }
+ else if ( strcasecmp( modelName, "Local" ) == 0 ) {
+ model = GL_LIGHT_MODEL_LOCAL_VIEWER;
+ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
+ }
+ else if ( strcasecmp( modelName, "TwoSide" ) == 0 ){
+ model = GL_LIGHT_MODEL_TWO_SIDE;
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+ }
position[0] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posX", LUC_LIGHT_DEFAULT_POS_X );
position[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posY", LUC_LIGHT_DEFAULT_POS_Y );
@@ -284,21 +316,19 @@ void lucLight_Pickle( void* light, Strea
Journal_Printf( stream, "</struct>\n");
}
-/* functions to change the lights paramters - unused as yet, only called from light interactions which don't work */
+/* functions to change the lights paramters */
void lucLight_Position( void * light, int lightIndex, float posX, float posY, float posZ, float posW) {
- lucLight* self = (lucLight*) light;
+ lucLight* self = (lucLight*) light;
- /* Sets the position of the light index = index */
+ /* Sets the potiotion of the light index = index */
+ glEnable(GL_LIGHTING);
+
self->position[0] += posX;
self->position[1] += posY;
self->position[2] += posZ;
self->position[3] += posW;
- /* Light position now relative to eye, not model! */
- glPushMatrix();
- glLoadIdentity();
glLightfv(GL_LIGHT0 + lightIndex, GL_POSITION, self->position);
- glPopMatrix();
self->needsToDraw = True;
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Light.h
--- a/Base/src/Light.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Light.h Fri Feb 05 12:57:55 2010 -0800
@@ -53,13 +53,13 @@
extern const double LUC_LIGHT_DEFAULT_POS_Z;
extern const double LUC_LIGHT_DEFAULT_POS_W;
- #define __lucLight \
- __Stg_Component \
- AbstractContext* context; \
- Light_Index index;\
+ #define __lucLight \
+ __Stg_Component \
+ AbstractContext* context; \
+ Light_Index index;\
int model; \
int material;\
- float position[4];\
+ float position[4];\
float lmodel_ambient[4];\
float spotCutOff;\
float spotDirection[3];\
@@ -70,14 +70,14 @@
/** Constructors */
lucLight* lucLight_New(
- Name name,
+ Name name,
Light_Index index,
- int model,
- int material,
- float position[4],
- float lmodel_ambient[4],
- float spotCutOff,
- float spotDirection[3]
+ int model,
+ int material,
+ float position[4],
+ float lmodel_ambient[4],
+ float spotCutOff,
+ float spotDirection[3]
);
@@ -93,6 +93,17 @@
lucLight* _lucLight_New( LUCLIGHT_DEFARGS );
+ void lucLight_InitAll(
+ void* light,
+ Light_Index index,
+ int model,
+ int material,
+ float position[4],
+ float lmodel_ambient[4],
+ float spotCutOff,
+ float spotDirection[3]
+ );
+
/** Virtual Functions */
void _lucLight_Delete( void* light ) ;
void _lucLight_Print( void* light, Stream* stream ) ;
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Light_Register.c
--- a/Base/src/Light_Register.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Light_Register.c Fri Feb 05 12:57:55 2010 -0800
@@ -79,53 +79,23 @@ void lucLight_Register_EnableAll( voi
lucLight* light;
Light_Index lightCount = 0;
Light_Index light_I = 0;
- float black[] = { 0.0, 0.0, 0.0, 1.0 };
- float white[] = { 1.0, 1.0, 1.0, 1.0 };
- float ambient[] = { 0.2, 0.2, 0.2, 1.0 };
- float diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
+
+ /* Enabling the lights */
+ glEnable(GL_LIGHTING);
+ lightCount = lucLight_Register_GetCount( self );
+
+ for (light_I = 0; light_I < lightCount; light_I++){
+ light = lucLight_Register_GetByIndex(self, light_I);
+ glLightfv(GL_LIGHT0 + light_I, GL_POSITION, light->position);
+ glLightf(GL_LIGHT0 + light_I, GL_SPOT_CUTOFF, light->spotCutOff);
+ glLightfv(GL_LIGHT0 + light_I, GL_SPOT_DIRECTION, light->spotDirection);
- /* Here we setup defaults for a standard nice looking lighting model */
- glEnable(GL_COLOR_MATERIAL);
- glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ glEnable(GL_LIGHT0 + light_I);
+ }
+
+ if(lightCount == 0) /* No light is listed in the xml file, but we still need to enable the default light */
+ glEnable(GL_LIGHT0);
- /* Set global material light properties */
- glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black); /* Disable light emission on materials */
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); /* Disable specular on material */
- /* Replace preceding statement with following to enable specular highlights
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white); /* Enable specular on material /
- /* Set material shininess factor /
- float shininess = 64.0; /* Default 0, range 0-128 /
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, &shininess); */
-
- /* glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); /* Set global ambient, GL default is 0.2 */
- /* Light both sides of polygons - required to see both sides of surfaces */
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
-
- /* Enabling the individual lights
- * Light positioning now done in opengl coords, not eye coords
- * If we reposition lights without loading identity they will be fixed to the model and not following camera */
- lightCount = lucLight_Register_GetCount( self );
- glPushMatrix();
- glLoadIdentity();
- //Journal_DPrintfL( lucDebug, 2, "Enabling %d lights\n", lightCount);
- for (light_I = 0; light_I < lightCount; light_I++){
- light = lucLight_Register_GetByIndex(self, light_I);
- glLightfv(GL_LIGHT0 + light_I, GL_POSITION, light->position);
- glLightf(GL_LIGHT0 + light_I, GL_SPOT_CUTOFF, light->spotCutOff);
- glLightfv(GL_LIGHT0 + light_I, GL_SPOT_DIRECTION, light->spotDirection);
- GLint viewportArray[4];
- glGetIntegerv( GL_VIEWPORT, viewportArray );
-
- /* Set light properties - using defaults as most params have not been setup correctly for xml */
- glLightfv(GL_LIGHT0 + light_I, GL_AMBIENT, light->lmodel_ambient);
- glLightfv(GL_LIGHT0 + light_I, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT0 + light_I, GL_SPECULAR, white);
-
- /* Turn on */
- glEnable(GL_LIGHT0 + light_I);
- }
- /* Restore model view */
- glPopMatrix();
}
Light_Index lucLight_Register_GetCurrentLightIndex( void * lightRegister ) {
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/OutputFormat.c
--- a/Base/src/OutputFormat.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/OutputFormat.c Fri Feb 05 12:57:55 2010 -0800
@@ -85,21 +85,18 @@ lucOutputFormat* _lucOutputFormat_New(
void _lucOutputFormat_Init(
lucOutputFormat* self,
- Name extension,
- Bool transparent )
+ Name extension )
{
self->extension = StG_Strdup( extension );
- self->transparent = transparent;
}
-void lucOutputFormat_New(
+void lucOutputFormat_InitAll(
void* outputFormat,
- Name extension,
- Bool transparent )
+ Name extension )
{
lucOutputFormat* self = outputFormat;
- _lucOutputFormat_Init( self, extension, transparent );
+ _lucOutputFormat_Init( self, extension );
}
@@ -135,22 +132,18 @@ void* _lucOutputFormat_Copy( void* outpu
void _lucOutputFormat_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ) {
lucOutputFormat* self = outputFormat;
- Bool transparent = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"transparent", False );
self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
if( !self->context )
self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-
- _lucOutputFormat_Init( self, self->extension, transparent );
}
-
void _lucOutputFormat_Build( void* outputFormat, void* data ) { }
void _lucOutputFormat_Initialise( void* outputFormat, void* data ) { }
void _lucOutputFormat_Execute( void* outputFormat, void* data ) { }
void _lucOutputFormat_Destroy( void* outputFormat, void* data ) { }
-void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputFormat* self = (lucOutputFormat*) outputFormat;
if ( context->rank != MASTER )
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/OutputFormat.h
--- a/Base/src/OutputFormat.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/OutputFormat.h Fri Feb 05 12:57:55 2010 -0800
@@ -49,7 +49,7 @@
extern const Type lucOutputFormat_Type;
- typedef void (lucOutputFormat_OutputFunction) ( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData );
+ typedef void (lucOutputFormat_OutputFunction) ( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData );
#define __lucOutputFormat \
__Stg_Component \
@@ -57,8 +57,7 @@
/* Virtual Functions */ \
lucOutputFormat_OutputFunction* _output; \
/* Other Info */ \
- Name extension; \
- Bool transparent;
+ Name extension;
struct lucOutputFormat {__lucOutputFormat};
@@ -77,19 +76,23 @@
lucOutputFormat* _lucOutputFormat_New( LUCOUTPUTFORMAT_DEFARGS );
+ void lucOutputFormat_InitAll(
+ void* outputFormat,
+ Name extension );
+
void _lucOutputFormat_Delete( void* outputFormat ) ;
void _lucOutputFormat_Print( void* outputFormat, Stream* stream ) ;
void* _lucOutputFormat_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) ;
void* _lucOutputFormat_DefaultNew( Name name ) ;
- void _lucOutputFormat_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ) ;
+void _lucOutputFormat_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ) ;
void _lucOutputFormat_Build( void* outputFormat, void* data );
void _lucOutputFormat_Initialise( void* outputFormat, void* data );
void _lucOutputFormat_Execute( void* outputFormat, void* data );
void _lucOutputFormat_Destroy( void* outputFormat, void* data );
/* +++ Public Functions +++ */
- void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
Name lucOutputFormat_GetImageFilename( void* outputFormat, lucWindow* window, void* _context ) ;
FILE* lucOutputFormat_OpenFile( void* outputFormat, lucWindow* window, void* _context, const char *mode ) ;
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/OutputFormat.meta
--- a/Base/src/OutputFormat.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/OutputFormat.meta Fri Feb 05 12:57:55 2010 -0800
@@ -19,12 +19,7 @@
<list name="Params">
- <struct>
- <param name="Name">transparent</param>
- <param name="Type">Bool</param>
- <param name="Default">False</param>
- <param name="Description">Output with transparent alpha channel, only works if format supports RGBA data</param>
- </struct>
+
</list>
<list name="Dependencies">
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/OutputFormat_Register.c
--- a/Base/src/OutputFormat_Register.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/OutputFormat_Register.c Fri Feb 05 12:57:55 2010 -0800
@@ -69,7 +69,7 @@ lucOutputFormat_Register* lucOutputForma
return self;
}
-void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData, lucAlphaPixel* alphaPixelData ) {
+void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputFormat_Register* self = (lucOutputFormat_Register*) outputFormat_Register;
OutputFormat_Index object_I;
OutputFormat_Index objectCount = lucOutputFormat_Register_GetCount( self );
@@ -77,10 +77,7 @@ void lucOutputFormat_Register_OutputAll(
for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
object = lucOutputFormat_Register_GetByIndex( self, object_I );
- if (object->transparent)
- lucOutputFormat_Output( object, window, context, alphaPixelData );
- else
- lucOutputFormat_Output( object, window, context, pixelData );
+ lucOutputFormat_Output( object, window, context, pixelData );
}
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/OutputFormat_Register.h
--- a/Base/src/OutputFormat_Register.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/OutputFormat_Register.h Fri Feb 05 12:57:55 2010 -0800
@@ -123,7 +123,7 @@
Stg_ObjectList_PrintAllObjects( (self)->objects, stream )
/* +++ Public Functions +++ */
- void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData , lucAlphaPixel* alphaPixelData) ;
+ void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/RenderingEngine.c
--- a/Base/src/RenderingEngine.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/RenderingEngine.c Fri Feb 05 12:57:55 2010 -0800
@@ -154,12 +154,12 @@ void lucRenderingEngine_Clear( void* ren
lucDebug_PrintFunctionEnd( self, 2 );
}
-void lucRenderingEngine_GetPixelData( void* renderingEngine, lucWindow* window, void* pixelData, Bool withAlpha ) {
+void lucRenderingEngine_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* pixelData ) {
lucRenderingEngine* self = (lucRenderingEngine*) renderingEngine ;
lucDebug_PrintFunctionBegin( self, 2 );
- self->_getPixelData( self, window, pixelData, withAlpha );
+ self->_getPixelData( self, window, pixelData );
lucDebug_PrintFunctionEnd( self, 2 );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/RenderingEngine.h
--- a/Base/src/RenderingEngine.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/RenderingEngine.h Fri Feb 05 12:57:55 2010 -0800
@@ -51,7 +51,7 @@
typedef void (lucRenderingEngine_RenderFunction) ( void* renderingEngine, lucWindow* window, AbstractContext* context);
typedef void (lucRenderingEngine_ClearFunction) ( void* renderingEngine, lucWindow* window, Bool clearAll );
- typedef void (lucRenderingEngine_GetPixelDataFunction) ( void* renderingEngine, lucWindow* window, void* pixelData, Bool withAlpha);
+ typedef void (lucRenderingEngine_GetPixelDataFunction) ( void* renderingEngine, lucWindow* window, lucPixel* pixelData);
typedef void (lucRenderingEngine_CompositeViewportFunction) (
void* renderingEngine,
lucViewportInfo* viewportInfo,
@@ -105,7 +105,7 @@
/* +++ Public Functions +++ */
void lucRenderingEngine_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) ;
void lucRenderingEngine_Clear( void* renderingEngine, lucWindow* window, Bool clearAll ) ;
- void lucRenderingEngine_GetPixelData(void* renderingEngine, lucWindow* window, void* pixelData, Bool withAlpha);
+ void lucRenderingEngine_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* pixelData ) ;
void lucRenderingEngine_CompositeViewport(
void* renderingEngine,
lucViewportInfo* viewportInfo,
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Viewport.c
--- a/Base/src/Viewport.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Viewport.c Fri Feb 05 12:57:55 2010 -0800
@@ -70,6 +70,26 @@ const Type lucViewport_Type = "lucViewpo
MPI_Datatype lucViewport_MPI_Datatype;
+lucViewport* lucViewport_New(
+ Name name,
+ lucCamera* camera,
+ lucDrawingObject** drawingObjectList,
+ DrawingObject_Index drawingObjectCount,
+ lucLight** lightList,
+ Light_Index lightCount,
+ Bool drawTitle,
+ Bool drawTime,
+ Bool compositeEachObject,
+ double nearClipPlane,
+ double farClipPlane )
+{
+ lucViewport* self = _lucViewport_DefaultNew( name );
+
+ lucViewport_InitAll( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
+
+ return self;
+}
+
lucViewport* _lucViewport_New( LUCVIEWPORT_DEFARGS )
{
lucViewport* self;
@@ -91,16 +111,13 @@ void _lucViewport_Init(
lucCamera* camera,
lucDrawingObject** drawingObjectList,
DrawingObject_Index drawingObjectCount,
- lucLight** lightList,
- Light_Index lightCount,
+ lucLight** lightList,
+ Light_Index lightCount,
Bool drawTitle,
Bool drawTime,
Bool compositeEachObject,
double nearClipPlane,
- double farClipPlane,
- double scaleX,
- double scaleY,
- double scaleZ)
+ double farClipPlane )
{
DrawingObject_Index object_I;
Light_Index light_I;
@@ -113,15 +130,12 @@ void _lucViewport_Init(
lightPosition[1]= LUC_LIGHT_DEFAULT_POS_Y;
lightPosition[2]= LUC_LIGHT_DEFAULT_POS_Z;
lightPosition[3]= LUC_LIGHT_DEFAULT_POS_W;
-
+
self->camera = camera;
self->drawTitle = drawTitle;
self->drawTime = drawTime;
self->nearClipPlane = nearClipPlane;
self->farClipPlane = farClipPlane;
- self->scaleX = scaleX;
- self->scaleY = scaleY;
- self->scaleZ = scaleZ;
self->compositeEachObject = compositeEachObject;
self->drawingObject_Register = lucDrawingObject_Register_New();
@@ -135,36 +149,33 @@ void _lucViewport_Init(
for ( light_I = 0 ; light_I < lightCount ; light_I++ )
lucLight_Register_Add( self->light_Register, lightList[ light_I ] );
- if(lightCount == 0) {
- self->defaultLight = lucLight_New( "defaultLight", 0, GL_LIGHT_MODEL_TWO_SIDE, GL_AMBIENT_AND_DIFFUSE,
- lightPosition, lmodel_ambient, spotCutOff, spotDirection);
- lucLight_Register_Add( self->light_Register, self->defaultLight );
- }
+ if(lightCount == 0){
+ self->defaultLight = lucLight_New( "defaultLight", 0, GL_LIGHT_MODEL_TWO_SIDE, GL_AMBIENT_AND_DIFFUSE, lightPosition, lmodel_ambient, spotCutOff, spotDirection);
+ lucLight_Register_Add( self->light_Register, self->defaultLight );
+ }
+
+
}
-lucViewport* lucViewport_New(
- Name name,
- lucCamera* camera,
- lucDrawingObject** drawingObjectList,
+void lucViewport_InitAll(
+ void* viewport,
+ lucCamera* camera,
+ lucDrawingObject** drawingObjectList,
DrawingObject_Index drawingObjectCount,
- lucLight** lightList,
- Light_Index lightCount,
+ lucLight** lightList,
+ Light_Index lightCount,
Bool drawTitle,
Bool drawTime,
Bool compositeEachObject,
double nearClipPlane,
- double farClipPlane,
- double scaleX,
- double scaleY,
- double scaleZ)
+ double farClipPlane )
{
- lucViewport* self = _lucViewport_DefaultNew( name );
+ lucViewport* self = viewport;
- _lucViewport_Init( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane, scaleX, scaleY, scaleZ);
-
- return self;
+ _lucViewport_Init( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
}
+
void _lucViewport_Delete( void* viewport ) {
lucViewport* self = viewport;
@@ -267,29 +278,27 @@ void _lucViewport_AssignFromXML( void* v
Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTitle", True ),
Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTime", False ),
Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"compositeEachObject", False ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"nearClipPlane", camera->focalLength / 10.0 ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"farClipPlane", camera->focalLength * 10.0 ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleX", 1.0 ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleY", 1.0 ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleZ", 1.0 ) );
+ Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"nearClipPlane", 0.1 ),
+ Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"farClipPlane", 40.0 ) );
Memory_Free( drawingObjectList );
if(lightList)
Memory_Free( lightList );
}
-void _lucViewport_Build( void* viewport, void* data ) { }
-void _lucViewport_Initialise( void* viewport, void* data ) {}
-void _lucViewport_Execute( void* viewport, void* data ) { }
-void _lucViewport_Destroy( void* viewport, void* data ) { }
+void _lucViewport_Build( void* camera, void* data ) { }
+void _lucViewport_Initialise( void* camera, void* data ) { }
+void _lucViewport_Execute( void* camera, void* data ) { }
+void _lucViewport_Destroy( void* camera, void* data ) { }
void lucViewport_Draw( void* viewport, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) {
lucViewport* self = (lucViewport*) viewport ;
lucDebug_PrintFunctionBegin( self, 2 );
- /* Enables the lights */
+ /*Enables the lights */
lucLight_Register_EnableAll( self->light_Register );
+
lucDrawingObject_Register_DrawAll( self->drawingObject_Register, window, viewportInfo, context, self->compositeEachObject );
lucDebug_PrintFunctionEnd( self, 2 );
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Viewport.h
--- a/Base/src/Viewport.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Viewport.h Fri Feb 05 12:57:55 2010 -0800
@@ -53,15 +53,12 @@
#define __lucViewport \
__Stg_Component \
AbstractContext* context; \
- lucCamera* camera; \
- lucDrawingObject_Register* drawingObject_Register; \
- lucLight_Register* light_Register; \
- lucLight* defaultLight; \
+ lucCamera* camera; \
+ lucDrawingObject_Register* drawingObject_Register; \
+ lucLight_Register* light_Register; \
+ lucLight* defaultLight; \
double nearClipPlane; \
double farClipPlane; \
- double scaleX; \
- double scaleY; \
- double scaleZ; \
Bool drawTitle; \
Bool drawTime; \
Bool compositeEachObject;
@@ -74,15 +71,12 @@
lucDrawingObject** drawingObjectList,
DrawingObject_Index drawingObjectCount,
lucLight** lightList,
- Light_Index lightCount,
- Bool drawTitle,
+ Light_Index lightCount,
+ Bool drawTitle,
Bool drawTime,
Bool compositeEachObject,
double nearClipPlane,
- double farClipPlane,
- double scaleX,
- double scaleY,
- double scaleZ );
+ double farClipPlane );
#ifndef ZERO
@@ -97,12 +91,25 @@
lucViewport* _lucViewport_New( LUCVIEWPORT_DEFARGS );
+ void lucViewport_InitAll(
+ void* viewport,
+ lucCamera* camera,
+ lucDrawingObject** drawingObjectList,
+ DrawingObject_Index drawingObjectCount,
+ lucLight** lightList,
+ Light_Index lightCount,
+ Bool drawTitle,
+ Bool drawTime,
+ Bool compositeEachObject,
+ double nearClipPlane,
+ double farClipPlane );
+
void _lucViewport_Delete( void* viewport ) ;
void _lucViewport_Print( void* viewport, Stream* stream ) ;
void* _lucViewport_Copy( void* viewport, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) ;
void* _lucViewport_DefaultNew( Name name ) ;
- void _lucViewport_AssignFromXML( void* viewport, Stg_ComponentFactory* cf, void* data ) ;
+void _lucViewport_AssignFromXML( void* viewport, Stg_ComponentFactory* cf, void* data ) ;
void _lucViewport_Build( void* viewport, void* data );
void _lucViewport_Initialise( void* viewport, void* data );
void _lucViewport_Execute( void* viewport, void* data );
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Viewport.meta
--- a/Base/src/Viewport.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Viewport.meta Fri Feb 05 12:57:55 2010 -0800
@@ -41,24 +41,7 @@
<param name="Default">40.0</param>
<param name="Description">Specifies the distance from the camera to the far clipping plane, behind which nothing will be drawn.</param>
</struct>
- <struct>
- <param name="Name">scaleX</param>
- <param name="Type">Double</param>
- <param name="Default">1.0</param>
- <param name="Description">Model scaling factor in X direction.</param>
- </struct>
- <struct>
- <param name="Name">scaley</param>
- <param name="Type">Double</param>
- <param name="Default">1.0</param>
- <param name="Description">Model scaling factor in Y direction.</param>
- </struct>
- <struct>
- <param name="Name">scaleZ</param>
- <param name="Type">Double</param>
- <param name="Default">1.0</param>
- <param name="Description">Model scaling factor in Z direction.</param>
- </struct>
+
</list>
<list name="Dependencies">
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Window.c
--- a/Base/src/Window.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Window.c Fri Feb 05 12:57:55 2010 -0800
@@ -118,8 +118,7 @@ void _lucWindow_Init(
Bool interactive,
Bool continuous,
Bool isTimedOut,
- double maxIdleTime,
- Bool antialias )
+ double maxIdleTime )
{
OutputFormat_Index outputFormat_I;
WindowInteraction_Index windowInteraction_I;
@@ -130,7 +129,6 @@ void _lucWindow_Init(
self->resized = False;
self->interactive = interactive;
self->continuous = continuous;
- self->antialias = antialias;
self->viewportInfoList = Memory_Alloc_Array( lucViewportInfo, viewportCount, "viewport info Array" );
memcpy( self->viewportInfoList, viewportInfoList, viewportCount * sizeof( lucViewportInfo ) );
@@ -301,9 +299,8 @@ void _lucWindow_AssignFromXML( void* win
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"backgroundColour", "white" ),
interactive,
continuous,
- Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"isTimedOut", False ),
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 ),
- Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"antialias", True )
+ Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"isTimedOut", True ),
+ Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 )
);
/* Free Memory */
@@ -379,10 +376,10 @@ void _lucWindow_Execute( void* window, v
MPI_Bcast( &redisplay, 1, MPI_INT, MASTER, self->context->communicator );
/* Still events to process? delay redisplay until queue empty */
- if (events <= 1 && redisplay)
+ if (events <= 1)
{
/* Redraw Window (Call virtual to display) */
- self->_displayWindow( self );
+ if (redisplay) self->_displayWindow( self );
redisplay = False;
}
}
@@ -398,15 +395,14 @@ void _lucWindow_Execute( void* window, v
/* Stop idle timeout */
self->idleTime = 0;
-
- /* Clean up drawing objects */
- lucWindow_CleanUp( window, data );
+
lucDebug_PrintFunctionEnd( self, 1 );
}
void _lucWindow_Destroy( void* window, void* data ) {
lucWindow* self = (lucWindow*)window;
+ lucWindow_CleanUp( window, data );
Memory_Free(self->title);
lucDeleteFont();
}
@@ -470,7 +466,6 @@ void lucWindow_Dump( void* window, Abstr
Pixel_Index width = self->width;
Pixel_Index height = self->height;
lucPixel* imageBuffer = NULL;
- lucAlphaPixel* imageAlphaBuffer = NULL;
Stream* errorStream = Journal_MyStream( Error_Type, self );
lucDebug_PrintFunctionBegin( self, 1 );
@@ -478,19 +473,15 @@ void lucWindow_Dump( void* window, Abstr
/* Allocate Memory */
imageBuffer = Memory_Alloc_Array( lucPixel, width * height, "Pixels" );
Journal_Firewall( imageBuffer != NULL, errorStream, "In func %s: Cannot allocate array.", __func__ );
- imageAlphaBuffer = Memory_Alloc_Array( lucAlphaPixel, width * height, "Pixels" );
- Journal_Firewall( imageAlphaBuffer != NULL, errorStream, "In func %s: Cannot allocate array.", __func__ );
/* Grab Pixels from window */
- lucRenderingEngine_GetPixelData( self->renderingEngine, self, imageBuffer, False );
- lucRenderingEngine_GetPixelData( self->renderingEngine, self, imageAlphaBuffer, True );
+ lucRenderingEngine_GetPixelData( self->renderingEngine, self, imageBuffer );
/* Output in different formats that the user gives */
- lucOutputFormat_Register_OutputAll( self->outputFormat_Register, self, context, imageBuffer, imageAlphaBuffer);
+ lucOutputFormat_Register_OutputAll( self->outputFormat_Register, self, context, imageBuffer );
/* Free memory */
Memory_Free( imageBuffer );
- Memory_Free( imageAlphaBuffer );
lucDebug_PrintFunctionEnd( self, 1 );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Window.h
--- a/Base/src/Window.h Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Window.h Fri Feb 05 12:57:55 2010 -0800
@@ -89,7 +89,6 @@
Pixel_Index startx; \
Pixel_Index starty; \
char* title; \
- Bool antialias; \
struct lucWindow {__lucWindow};
diff -r fbd4029e4444 -r 6f05d8c665b0 Base/src/Window.meta
--- a/Base/src/Window.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/Base/src/Window.meta Fri Feb 05 12:57:55 2010 -0800
@@ -52,7 +52,7 @@
<struct>
<param name="Name">isTimedOut</param>
<param name="Type">Bool</param>
- <param name="Default">False</param>
+ <param name="Default">True</param>
<param name="Description">If True, and interactive mode is on, the window will time out after maxIdleTime seconds have elapsed (default is 600).</param>
</struct>
@@ -62,12 +62,7 @@
<param name="Default">600.0</param>
<param name="Description">The maximum time (in seconds) that the window can be open without user input. This is so that the user is warned when running the program with interactive turned on but without being aware.</param>
</struct>
- <struct>
- <param name="Name">antialias</param>
- <param name="Type">Bool</param>
- <param name="Default">True</param>
- <param name="Description">If True multisample anti-aliasing will be enabled where the hardware and graphics library allows it. This effectively smooths the edges of lines and polygons for a much nicer looking output. Set to False to disable anti-aliasing. Not available for OSMesa windows, to reduce aliasing in OSMesa, render a larger window and downsample manually.</param>
- </struct>
+
</list>
<list name="Dependencies">
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Axis.c
--- a/DrawingObjects/src/Axis.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Axis.c Fri Feb 05 12:57:55 2010 -0800
@@ -70,6 +70,21 @@
const Type lucAxis_Type = "lucAxis";
+lucAxis* lucAxis_New(
+ Name name,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ)
+{
+ lucAxis* self = (lucAxis*) _lucAxis_DefaultNew( name );
+
+ lucAxis_InitAll( self, origin, length, colourX, colourY, colourZ);
+
+ return self;
+}
+
lucAxis* _lucAxis_New( LUCAXIS_DEFARGS )
{
lucAxis* self;
@@ -82,13 +97,13 @@ lucAxis* _lucAxis_New( LUCAXIS_DEFARGS
return self;
}
-void _lucAxis_Init(
- lucAxis* self,
- Coord origin,
- float length,
- lucColour colourX,
- lucColour colourY,
- lucColour colourZ)
+void lucAxis_Init(
+ lucAxis* self,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ)
{
self->length = length;
@@ -100,19 +115,18 @@ void _lucAxis_Init(
}
-lucAxis* lucAxis_New(
- Name name,
- Coord origin,
- float length,
- lucColour colourX,
- lucColour colourY,
- lucColour colourZ)
+void lucAxis_InitAll(
+ void* axis,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ)
{
- lucAxis* self = (lucAxis*) _lucAxis_DefaultNew( name );
+ lucAxis* self = axis;
- _lucAxis_Init( self, origin, length, colourX, colourY, colourZ);
-
- return self;
+ /* TODO Init parent */
+ lucAxis_Init( self, origin, length, colourX, colourY, colourZ );
}
void _lucAxis_Delete( void* drawingObject ) {
@@ -168,7 +182,7 @@ void* _lucAxis_DefaultNew( Name name ) {
void _lucAxis_AssignFromXML( void* axis, Stg_ComponentFactory* cf, void* data ) {
lucAxis* self = (lucAxis*) axis;
- Name colourNameX;
+ Name colourNameX;
Name colourNameY;
Name colourNameZ;
@@ -186,16 +200,17 @@ void _lucAxis_AssignFromXML( void* axis,
lucColour_FromString( &self->colourY, colourNameY );
lucColour_FromString( &self->colourZ, colourNameZ );
- origin[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", 20.0 );
- origin[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", 20.0 );
- origin[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", 0.25 );
+ origin[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", -0.05 );
+ origin[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", -0.05 );
+ origin[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", -0.05 );
- _lucAxis_Init( self,
- origin,
- Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 ),
- self->colourX,
- self->colourY,
- self->colourZ);
+ lucAxis_InitAll( self,
+ origin,
+ Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 ),
+ self->colourX,
+ self->colourY,
+ self->colourZ);
+
}
void _lucAxis_Build( void* Axis, void* data ) { }
@@ -209,112 +224,120 @@ void _lucAxis_Setup( void* drawingObject
}
void _lucAxis_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
- lucAxis* self = (lucAxis*)drawingObject;
- lucViewport* viewport = viewportInfo->viewport;
- DomainContext* context = (DomainContext*) _context;
- Dimension_Index dim = context->dim;
- Coord origin, min, max;
+ lucAxis* self = (lucAxis*)drawingObject;
+ DomainContext* context = (DomainContext*) _context;
+ Dimension_Index dim = context->dim;
+ double rodLength = 0.0;
+ double arrowHeadLength = 0.0;
+ double textSpacing = 0.0;
+
+ /* Initialise OpenGL stuff */
+ glShadeModel(GL_SMOOTH);
+ glDisable(GL_LIGHTING);
- /* Undo any scaling factor */
- if (viewport->scaleX != 1.0 || viewport->scaleY != 1.0 || viewport->scaleZ != 1.0)
- glScalef(1.0/viewport->scaleX, 1.0/viewport->scaleY, 1.0/viewport->scaleZ);
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_BLEND);
+
+ /* Disable lighting because we don't want a 3D effect */
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- /* Calculate desired origin viewport coords in projected screen coords */
- GLdouble modelMatrix[16];
- GLdouble projMatrix[16];
- GLint viewportArray[4];
+ /* The rodlength is the total length of the arrow line.
+ By default it is 0.25 */
+ rodLength = self->length;
+
+ /* The tip of the arrow hea starts at rodLength.
+ The size of the arrow is a fifth of the total length */
+ arrowHeadLength = rodLength/5.0;
- glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
- glGetIntegerv( GL_VIEWPORT, viewportArray );
-
- gluUnProject(self->origin[0], self->origin[1], self->origin[2],
- modelMatrix, projMatrix, viewportArray,
- &origin[0], &origin[1], &origin[2]);
-
- /* Draw axis */
+ textSpacing = 0; //arrowHeadLength;
+
if (dim == 2) {
- /* The tip of the arrow head starts at length.
- The size of the arrow is a fifth of the total length */
- double arrowHeadLength = self->length/5.0;
- double textSpacing = 0; //arrowHeadLength;
- glDisable(GL_LIGHTING);
- glEnable(GL_LINE_SMOOTH);
-
- /* Drawing the X axis, default is the RED color */
- lucColour_SetOpenGLColour( &self->colourX );
+ /* Drawing the X axis, default is the RED color */
+ lucColour_SetOpenGLColour( &self->colourX );
glBegin( GL_LINES );
- glVertex2f( origin[I_AXIS], origin[J_AXIS] );
- glVertex2f( origin[I_AXIS] + self->length , origin[J_AXIS] );
+ glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] );
+ glVertex2f( self->origin[I_AXIS] + rodLength , self->origin[J_AXIS] );
glEnd();
glBegin(GL_TRIANGLES);
- glVertex2f( origin[I_AXIS] + self->length, origin[J_AXIS] );
- glVertex2f( origin[I_AXIS] + self->length - arrowHeadLength, origin[J_AXIS] - arrowHeadLength/2.0);
- glVertex2f( origin[I_AXIS] + self->length - arrowHeadLength, origin[J_AXIS] + arrowHeadLength/2.0);
+ glVertex2f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] );
+ glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] - arrowHeadLength/2.0);
+ glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] + arrowHeadLength/2.0);
glEnd();
- //lucPrint(origin[I_AXIS] + self->length + textSpacing, origin[J_AXIS], "X");
+ lucPrint(self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], "X");
/* Drawing the Y axis, default is the GREEN color */
lucColour_SetOpenGLColour( &self->colourY );
glBegin( GL_LINES );
- glVertex2f( origin[I_AXIS], origin[J_AXIS] );
- glVertex2f( origin[I_AXIS], origin[J_AXIS] + self->length );
+ glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] );
+ glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
glEnd();
glBegin(GL_TRIANGLES);
- glVertex2f( origin[I_AXIS], origin[J_AXIS] + self->length );
- glVertex2f( origin[I_AXIS] + arrowHeadLength/2.0, origin[J_AXIS] + self->length - arrowHeadLength);
- glVertex2f( origin[I_AXIS] - arrowHeadLength/2.0, origin[J_AXIS] + self->length - arrowHeadLength);
+ glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
+ glVertex2f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
+ glVertex2f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
glEnd();
- //lucPrint(origin[I_AXIS], origin[J_AXIS] + self->length + arrowHeadLength, "Y");
+ lucPrint(self->origin[I_AXIS], self->origin[J_AXIS] + rodLength + arrowHeadLength, "Y");
+ }
+ else if ( dim == 3 ) {
+ /* Drawing the X axis, by default using the RED color */
+ lucColour_SetOpenGLColour( &self->colourX );
- glDisable(GL_LINE_SMOOTH);
+ glBegin(GL_TRIANGLES);
+ glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS], self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength,
+ self->origin[J_AXIS] - arrowHeadLength/2.0, self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength,
+ self->origin[J_AXIS] + arrowHeadLength/2.0,
+ self->origin[K_AXIS] );
+ glEnd();
- } else {
- /* Drawing the X axis */
- lucColour_SetOpenGLColour( &self->colourX );
- {
- XYZ pos = {self->length/2 + origin[I_AXIS], origin[J_AXIS], (dim == 2 ? 0.0 : origin[K_AXIS])};
- XYZ vector = {1.0, 0.0, 0.0};
- luc_DrawVector( dim, pos, vector, self->length, 0.1 );
- }
-
- /* Drawing the Y axis */
- lucColour_SetOpenGLColour( &self->colourY );
- {
- XYZ pos = {origin[I_AXIS], self->length/2 + origin[J_AXIS], (dim == 2 ? 0.0 : origin[K_AXIS])};
- XYZ vector = {0.0, 1.0, 0.0};
- luc_DrawVector( dim, pos, vector, self->length, 0.1 );
- }
+ glBegin( GL_LINES );
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] , self->origin[K_AXIS] );
+ glEnd();
+
+ lucPrint3d( self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], self->origin[K_AXIS], "X");
+
+ /* Drawing the Y axis, by default using the GREEN color */
+ lucColour_SetOpenGLColour( &self->colourY );
- /* Drawing the Z axis */
- if ( dim == 3 ) {
- lucColour_SetOpenGLColour( &self->colourZ );
- {
- XYZ pos = {origin[I_AXIS], origin[J_AXIS], self->length/2 + origin[K_AXIS]};
- XYZ vector = {0.0, 0.0, 1.0};
- luc_DrawVector( dim, pos, vector, self->length, 0.1 );
- }
- }
- }
+ glBegin(GL_TRIANGLES);
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength, self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength,
+ self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength,
+ self->origin[K_AXIS] );
+ glEnd();
- /* Labels - don't draw in display list if using one */
- glDisable(GL_LIGHTING);
- lucColour_SetOpenGLColour( &self->colourX );
- lucPrint3d(origin[I_AXIS] + self->length, origin[J_AXIS], (dim == 2 ? 0.0 : origin[K_AXIS]), "X");
- lucColour_SetOpenGLColour( &self->colourY );
- lucPrint3d(origin[I_AXIS], origin[J_AXIS] + self->length * 1.25, (dim == 2 ? 0.0 : origin[K_AXIS]), "Y");
- if (dim == 3)
- {
- lucColour_SetOpenGLColour( &self->colourZ );
- lucPrint3d( origin[I_AXIS], origin[J_AXIS] , origin[K_AXIS] + self->length, "Z");
- }
- glEnable(GL_LIGHTING);
+ glBegin( GL_LINES );
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength , self->origin[K_AXIS] );
+ glEnd();
- /* Re-Apply scaling factors */
- if (viewport->scaleX != 1.0 || viewport->scaleY != 1.0 || viewport->scaleZ != 1.0)
- glScalef(viewport->scaleX, viewport->scaleY, viewport->scaleZ);
+ lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS]+ rodLength + arrowHeadLength, self->origin[K_AXIS], "Y");
+
+
+ /* Drawing the Z axis, by default using the BLUE color */
+ lucColour_SetOpenGLColour( &self->colourZ );
+ glBegin(GL_TRIANGLES);
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
+ glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] ,
+ self->origin[K_AXIS] + rodLength - arrowHeadLength );
+ glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS],
+ self->origin[K_AXIS] + rodLength -arrowHeadLength );
+ glEnd();
+
+ glBegin( GL_LINES );
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] );
+ glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
+ glEnd();
+
+ lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength + textSpacing, "Z");
+ }
+ /* Put back settings */
+ glEnable(GL_LIGHTING);
}
void _lucAxis_CleanUp( void* drawingObject, void* _context ) {
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Axis.h
--- a/DrawingObjects/src/Axis.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Axis.h Fri Feb 05 12:57:55 2010 -0800
@@ -53,7 +53,7 @@
#define __lucAxis \
__lucOpenGLDrawingObject \
Coord origin;\
- float length;\
+ float length;\
lucColour colourX;\
lucColour colourY;\
lucColour colourZ;
@@ -62,13 +62,14 @@
/** Constructors */
lucAxis* lucAxis_New(
- Name name,
- Coord origin,
- float length,
- lucColour colourX,
- lucColour colourY,
- lucColour colourZ);
+ Name name,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ);
+
#ifndef ZERO
#define ZERO 0
#endif
@@ -80,6 +81,23 @@
LUCOPENGLDRAWINGOBJECT_PASSARGS
lucAxis* _lucAxis_New( LUCAXIS_DEFARGS );
+
+ void lucAxis_InitAll(
+ void* axis,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ);
+
+ void _lucAxis_Init(
+ void* axis,
+ Coord origin,
+ float length,
+ lucColour colourX,
+ lucColour colourY,
+ lucColour colourZ);
+
void _lucAxis_Setup( void* drawingObject, void* _context );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Axis.meta
--- a/DrawingObjects/src/Axis.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Axis.meta Fri Feb 05 12:57:55 2010 -0800
@@ -37,27 +37,28 @@
<struct>
<param name="Name">originX</param>
<param name="Type">Double</param>
- <param name="Default">20.0</param>
- <param name="Description">Sets the X origin of the axis, in viewport coords.</param>
+ <param name="Default">-0.25</param>
+ <param name="Description">Sets the X origin of the axis.</param>
</struct>
<struct>
<param name="Name">originY</param>
<param name="Type">Double</param>
- <param name="Default">20.0</param>
- <param name="Description">Sets the Y origin of the axis, in viewport coords.</param>
+ <param name="Default">0.0</param>
+ <param name="Description">Sets the Y origin of the axis.</param>
</struct>
<struct>
<param name="Name">originZ</param>
<param name="Type">Double</param>
- <param name="Default">0.25</param>
- <param name="Description">Sets the Z origin of the axis: depth value in viewport, range [0,1].</param>
+ <param name="Default">0.0</param>
+ <param name="Description">Sets the Z origin of the axis.</param>
</struct>
<struct>
<param name="Name">length</param>
<param name="Type">Double</param>
- <param name="Default">0.2</param>
+ <param name="Default">0.25</param>
<param name="Description">Scales the length of the X,Y,Z axes.</param>
</struct>
+
</list>
<list name="Dependencies">
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ColourBar.c
--- a/DrawingObjects/src/ColourBar.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ColourBar.c Fri Feb 05 12:57:55 2010 -0800
@@ -282,7 +282,6 @@ void _lucColourBar_Draw( void* drawingOb
/* Set up 2D Viewer the size of the viewport */
lucViewport2d(True, viewportInfo);
- glDisable(GL_MULTISAMPLE); /* Looks best without anti-aliasing */
lucSetFontCharset(FONT_SMALL);
@@ -370,7 +369,6 @@ void _lucColourBar_Draw( void* drawingOb
}
/* Draw Colour Bar */
- glDisable(GL_CULL_FACE);
for ( pixel_I = 0 ; pixel_I < length ; pixel_I++ ) {
value = ((float)pixel_I / length);
lucColourMap_SetOpenGLColourFromScaledValue( colourMap, value);
@@ -387,7 +385,6 @@ void _lucColourBar_Draw( void* drawingOb
/* Restore the viewport */
lucViewport2d(False, viewportInfo);
- glEnable(GL_MULTISAMPLE);
}
void _lucColourBar_CleanUp( void* drawingObject, void* _context ) {
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Contour.meta
--- a/DrawingObjects/src/Contour.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Contour.meta Fri Feb 05 12:57:55 2010 -0800
@@ -21,7 +21,7 @@
<param name="Name">resolution</param>
<param name="Type">UnsignedInt</param>
<param name="Default">8</param>
- <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of verticies in each direction.</param>
+ <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of vertices in each direction.</param>
</struct>
<struct>
<param name="Name">resolutionX</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/CrossSection.c
--- a/DrawingObjects/src/CrossSection.c Tue Jan 19 15:26:41 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,301 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** * Neither the name of the Monash University nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*% Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+ Cecile Duboz
-*+ Robert Turnbull
-*+ Alan Lo
-*+ Louis Moresi
-*+ David Stegman
-*+ David May
-*+ Stevan Quenette
-*+ Patrick Sunter
-*+ Greg Watson
-*+
-** $Id: CrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "CrossSection.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-#include <ctype.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucCrossSection_Type = "lucCrossSection";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucCrossSection* _lucCrossSection_New( LUCCROSSSECTION_DEFARGS )
-{
- lucCrossSection* self;
-
- /* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
- assert( _sizeOfSelf >= sizeof(lucCrossSection) );
- self = (lucCrossSection*) _lucOpenGLDrawingObject_New( LUCOPENGLDRAWINGOBJECT_PASSARGS );
-
- return self;
-}
-
-void _lucCrossSection_Init(
- lucCrossSection* self,
- Name colourName,
- double value,
- Axis axis,
- Bool interpolate)
-{
- lucColour_FromString( &self->colour, colourName );
- /* Use provided setup function to correctly set axis etc */
- lucCrossSection_Set(self, value, axis, interpolate);
-}
-
-void _lucCrossSection_Delete( void* drawingObject ) {
- lucCrossSection* self = (lucCrossSection*)drawingObject;
-
- _lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucCrossSection_Print( void* drawingObject, Stream* stream ) {
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- _lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucCrossSection_DefaultNew( Name name ) {
- /* Variables set in this function */
- SizeT _sizeOfSelf = sizeof(lucCrossSection);
- Type type = lucCrossSection_Type;
- Stg_Class_DeleteFunction* _delete = _lucCrossSection_Delete;
- Stg_Class_PrintFunction* _print = _lucCrossSection_Print;
- Stg_Class_CopyFunction* _copy = NULL;
- Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucCrossSection_DefaultNew;
- Stg_Component_ConstructFunction* _construct = _lucCrossSection_AssignFromXML;
- Stg_Component_BuildFunction* _build = _lucCrossSection_Build;
- Stg_Component_InitialiseFunction* _initialise = _lucCrossSection_Initialise;
- Stg_Component_ExecuteFunction* _execute = _lucCrossSection_Execute;
- Stg_Component_DestroyFunction* _destroy = _lucCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucOpenGLDrawingObject_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucCrossSection_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
- lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucCrossSection_BuildDisplayList;
-
- /* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
- AllocationType nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
- return (void*) _lucCrossSection_New( LUCCROSSSECTION_PASSARGS );
-}
-
-void _lucCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- Name crossSectionStr;
- char axisChar;
- char crossSectionVal[20];
- char modifierChar = ' ';
- double value = 0.0;
- Axis axis = 0;
- Bool interpolate = False;
-
- /* Construct Parent */
- _lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
- /* Read the cross section string specification */
- crossSectionStr = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"crossSection", "z=min" );
-
- /* axis=value : draw at this exact value on axis
- * axis=min : draw at minimum of range on axis
- * axis=max : draw at maximum of range on axis
- * axis=value% : draw at interpolated percentage value of range on axis
- * Axis is a single character, one of [xyzXYZ] */
-
- /* Parse the input string */
- if ( sscanf( crossSectionStr, "%c=%s", &axisChar, crossSectionVal ) == 2 )
- {
- /* Axis X/Y/Z */
- if ( toupper( axisChar ) >= 'X' )
- axis = toupper( axisChar ) - 'X'; /* x=0 y=1 z=2 */
-
- if (sscanf( crossSectionVal, "%lf%c", &value, &modifierChar) >= 1)
- {
- /* Found a numeric value + optional modifier character */
- //fprintf(stderr, "CROSS SECTION VALUE %lf on Axis %c\n",self->value, axisChar);
-
- /* Interpolate cross section using percentage value */
- if (modifierChar == '%')
- {
- /* Interpolate between max and min value using provided value as percentage */
- interpolate = True;
- //fprintf(stderr, "PERCENTAGE %lf %% CROSS SECTION on Axis %c\n", self->value, axisChar);
- value *= 0.01;
- }
- }
- /* Max or Min specified? */
- else if (strcmp(crossSectionVal, "min") == 0)
- {
- value = 0.0;
- interpolate = True;
- //fprintf(stderr, "MIN CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
- }
- else if (strcmp(crossSectionVal, "max") == 0)
- {
- value = 1.0;
- interpolate = True;
- //fprintf(stderr, "MAX CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
- }
- }
-
- self->fieldVariableName = Memory_Alloc_Array(char, 50, "fieldVariableName");
- strcpy(self->fieldVariableName, "FieldVariable");
-
- _lucCrossSection_Init(
- self,
- Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black" ),
- value,
- axis,
- interpolate );
-}
-
-void _lucCrossSection_Build( void* drawingObject, void* data )
-{
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- AbstractContext* context = self->context;
- Stg_ComponentFactory* cf = context->CF;
-
- /* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
- self->fieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)self->fieldVariableName, FieldVariable, False, data );
- Stg_Component_Build( self->fieldVariable, data, False );
-}
-
-void _lucCrossSection_Initialise( void* drawingObject, void* data ) {}
-void _lucCrossSection_Execute( void* drawingObject, void* data ) {}
-
-void _lucCrossSection_Destroy( void* drawingObject, void* data ) {
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- Memory_Free(self->fieldVariableName);
-}
-
-void _lucCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- /* Ensure the field is synchronised. */
- lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
-
- /* Call parent Draw */
- _lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-/* Default cross-section object allows drawing a cut plane at a specified coord on any axis */
-void _lucCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
- lucCrossSection* self = (lucCrossSection*)drawingObject;
- double plane[4][3], min[3], max[3];
-
- FieldVariable_GetMinAndMaxGlobalCoords(self->fieldVariable, min, max );
-
- /* Fixed value on chosen axis */
- plane[0][self->axis] = plane[1][self->axis] = plane[2][self->axis] = plane[3][self->axis] = self->value;
- /* Max and min values on other axis */
- plane[0][self->axis1] = min[self->axis1];
- plane[1][self->axis1] = min[self->axis1];
- plane[2][self->axis1] = max[self->axis1];
- plane[3][self->axis1] = max[self->axis1];
-
- plane[0][self->axis2] = max[self->axis2];
- plane[1][self->axis2] = min[self->axis2];
- plane[2][self->axis2] = min[self->axis2];
- plane[3][self->axis2] = max[self->axis2];
-
- lucColour_SetOpenGLColour( &self->colour );
-
- glEnable(GL_LIGHTING);
- glDisable(GL_CULL_FACE);
-
- /* Create normal aligned to axis */
- double normal[3] = {0.0, 0.0, 0.0};
- normal[self->axis] = 1.0;
- glNormal3dv( normal );
- glBegin(GL_QUADS);
- glVertex3dv(plane[0]);
- glVertex3dv(plane[1]);
- glVertex3dv(plane[2]);
- glVertex3dv(plane[3]);
- glEnd();
-
-}
-
-/* Returns the cross section value, interpolating where necessary */
-double lucCrossSection_GetValue(void* crossSection, double min, double max)
-{
- lucCrossSection* self = (lucCrossSection*)crossSection;
- if (self->interpolate)
- /* Interpolation factor 0-1 provided to determine cross-section value */
- return min + self->value * (max - min);
- else
- /* Exact value provided */
- return self->value;
-}
-
-/* Function to set all cross section parameters and return self for use in passing cross-sections to functions */
-lucCrossSection* lucCrossSection_Set(void* crossSection, double val, Axis axis, Bool interpolate)
-{
- lucCrossSection* self = (lucCrossSection*)crossSection;
- self->value = val;
- self->axis = axis;
- self->interpolate = interpolate;
-
- /* Set other axis directions for drawing cross section:
- * These settings produce consistant polygon winding for cross sections on all axis */
- switch (self->axis) {
- case I_AXIS:
- self->axis1 = J_AXIS;
- self->axis2 = K_AXIS;
- break;
- case J_AXIS:
- self->axis1 = K_AXIS;
- self->axis2 = I_AXIS;
- break;
- case K_AXIS:
- self->axis1 = I_AXIS;
- self->axis2 = J_AXIS;
- break;
- }
-
- return self;
-}
-
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/CrossSection.h
--- a/DrawingObjects/src/CrossSection.h Tue Jan 19 15:26:41 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** * Neither the name of the Monash University nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*% Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+ Cecile Duboz
-*+ Robert Turnbull
-*+ Alan Lo
-*+ Louis Moresi
-*+ David Stegman
-*+ David May
-*+ Stevan Quenette
-*+ Patrick Sunter
-*+ Greg Watson
-*+
-** $Id: CrossSection.h 628 2006-10-12 08:23:07Z SteveQuenette $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "OpenGLDrawingObject.h"
-
-#ifndef __lucCrossSection_h__
-#define __lucCrossSection_h__
-
- /** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
- extern const Type lucCrossSection_Type;
-
- /** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
- #define __lucCrossSection \
- /* Macro defining parent goes here - This means you can cast this class as its parent */ \
- __lucOpenGLDrawingObject \
- /* Virtual functions go here */ \
- /* Other info */ \
- lucColour colour; \
- FieldVariable* fieldVariable; \
- Name fieldVariableName; \
- double value; \
- Axis axis; \
- Axis axis1; \
- Axis axis2; \
- Bool interpolate; \
-
- struct lucCrossSection { __lucCrossSection };
-
- /** Private Constructor: This will accept all the virtual functions for this class as arguments. */
-
- #ifndef ZERO
- #define ZERO 0
- #endif
-
- #define LUCCROSSSECTION_DEFARGS \
- LUCOPENGLDRAWINGOBJECT_DEFARGS
-
- #define LUCCROSSSECTION_PASSARGS \
- LUCOPENGLDRAWINGOBJECT_PASSARGS
-
- lucCrossSection* _lucCrossSection_New( LUCCROSSSECTION_DEFARGS );
-
- void _lucCrossSection_Delete( void* drawingObject ) ;
- void _lucCrossSection_Print( void* drawingObject, Stream* stream ) ;
-
- /* 'Stg_Component' implementations */
- void* _lucCrossSection_DefaultNew( Name name ) ;
- void _lucCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
- void _lucCrossSection_Build( void* drawingObject, void* data ) ;
- void _lucCrossSection_Initialise( void* drawingObject, void* data ) ;
- void _lucCrossSection_Execute( void* drawingObject, void* data );
- void _lucCrossSection_Destroy( void* drawingObject, void* data ) ;
-
- void _lucCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context );
- void _lucCrossSection_BuildDisplayList( void* drawingObject, void* _context );
-
- double lucCrossSection_GetValue(void* crossSection, double min, double max);
- lucCrossSection* lucCrossSection_Set(void* crossSection, double val, Axis axis, Bool interpolate);
-
-#endif
-
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/CrossSection.meta
--- a/DrawingObjects/src/CrossSection.meta Tue Jan 19 15:26:41 2010 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
-<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
-
-<param name="Name">lucCrossSection</param>
-<param name="Author">Owen Kaluza</param>
-<param name="Organisation">AuScope</param>
-<param name="Project">gLucifer</param>
-<param name="Location">./gLucifer/DrawingObjects/src/</param>
-<param name="Project Web">http://www.auscope.monash.edu.au/codex/gLucifer.html</param>
-<param name="Copyright">Copyright (c) 2009, AuScope</param>
-<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">lucOpenGLDrawingObject</param>
-<param name="Reference"></param>
-<param name="Summary"></param>
-<param name="Description">Abstract class defining a cross section</param>
-
-<!--Now the interesting stuff-->
-
-
-<list name="Params">
- <struct>
- <param name="Name">crossSection</param>
- <param name="Type">String</param>
- <param name="Default">""</param>
- <param name="Description">The description of the plane in the format: "axis=value". e.g. x=1.5 will describe a Y-Z plane where the X coordinate is 1.5. The axis is case insensitive. To specify plane dynamically based on current minimum/maximum global coords use "axis=min", "axis=max" or "axis=value%".</param>
- </struct>
-</list>
-
-<list name="Dependencies">
- <struct>
- <param name="Essential">True</param>
- <param name="Name">FieldVariable</param>
- <param name="Type">FieldVariable</param>
- <param name="Description">The field you want to cross-section.</param>
- </struct>
-</list>
-<!-- Add an exmaple XML if possible -->
-<param name="Example">
-<![CDATA[
- <struct name="crosssection">
- <param name="Type">lucCrossSection</param>
- <param name="crossSection">z=50%</param>
- </struct>
-]]>
-</param>
-
-
-
-
-</StGermainData>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/DrawingObjects.h
--- a/DrawingObjects/src/DrawingObjects.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/DrawingObjects.h Fri Feb 05 12:57:55 2010 -0800
@@ -52,7 +52,6 @@
#include "ColourBar.h"
#include "FieldVariableBorder.h"
#include "Isosurface.h"
-#include "CrossSection.h"
#include "ScalarFieldCrossSection.h"
#include "ScalarField.h"
#include "VectorArrowCrossSection.h"
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Eigenvectors.c
--- a/DrawingObjects/src/Eigenvectors.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Eigenvectors.c Fri Feb 05 12:57:55 2010 -0800
@@ -50,6 +50,7 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
#include "types.h"
#include "OpenGLDrawingObject.h"
@@ -91,6 +92,19 @@ void _lucEigenvectors_Print( void* drawi
_lucEigenvectorsCrossSection_Print( self, stream );
}
+void* _lucEigenvectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucEigenvectors* self = (lucEigenvectors*)drawingObject;
+ lucEigenvectors* newDrawingObject;
+
+ newDrawingObject = _lucEigenvectorsCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
+
void* _lucEigenvectors_DefaultNew( Name name ) {
/* Variables set in this function */
SizeT _sizeOfSelf = sizeof(lucEigenvectors);
@@ -100,13 +114,13 @@ void* _lucEigenvectors_DefaultNew( Name
Stg_Class_CopyFunction* _copy = NULL;
Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucEigenvectors_DefaultNew;
Stg_Component_ConstructFunction* _construct = _lucEigenvectors_AssignFromXML;
- Stg_Component_BuildFunction* _build = _lucEigenvectorsCrossSection_Build;
- Stg_Component_InitialiseFunction* _initialise = _lucEigenvectorsCrossSection_Initialise;
- Stg_Component_ExecuteFunction* _execute = _lucEigenvectorsCrossSection_Execute;
- Stg_Component_DestroyFunction* _destroy = _lucEigenvectorsCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucOpenGLDrawingObject_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucOpenGLDrawingObject_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ Stg_Component_BuildFunction* _build = _lucEigenvectors_Build;
+ Stg_Component_InitialiseFunction* _initialise = _lucEigenvectors_Initialise;
+ Stg_Component_ExecuteFunction* _execute = _lucEigenvectors_Execute;
+ Stg_Component_DestroyFunction* _destroy = _lucEigenvectors_Destroy;
+ lucDrawingObject_SetupFunction* _setup = _lucEigenvectors_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucEigenvectors_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucEigenvectors_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucEigenvectors_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -124,22 +138,46 @@ void _lucEigenvectors_AssignFromXML( voi
_lucEigenvectors_Init( self );
}
+void _lucEigenvectors_Build( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Initialise( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Execute( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Destroy( void* drawingObject, void* data ) {}
+
+void _lucEigenvectors_Setup( void* drawingObject, void* _context ) {
+ lucEigenvectors* self = (lucEigenvectors*)drawingObject;
+
+ _lucEigenvectorsCrossSection_Setup( self, _context );
+}
+
+void _lucEigenvectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucEigenvectors* self = (lucEigenvectors*)drawingObject;
+
+ _lucEigenvectorsCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucEigenvectors_CleanUp( void* drawingObject, void* _context ) {
+ lucEigenvectors* self = (lucEigenvectors*)drawingObject;
+
+ _lucEigenvectorsCrossSection_CleanUp( self, _context );
+}
+
void _lucEigenvectors_BuildDisplayList( void* drawingObject, void* _context ) {
lucEigenvectors* self = (lucEigenvectors*)drawingObject;
DomainContext* context = (DomainContext*) _context;
Dimension_Index dim = context->dim;
+ lucCrossSection crossSection;
if ( dim == 2 )
{
- _lucEigenvectorsCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, False), dim);
+ _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
}
else
{
double dz = 1/(double)self->resolution[ K_AXIS ];
- self->axis = K_AXIS;
- self->interpolate = True;
- for ( self->value = 0.0 ; self->value < 1.0+dz ; self->value += dz) {
- _lucEigenvectorsCrossSection_DrawCrossSection( self, dim );
+ crossSection.axis = K_AXIS;
+ crossSection.interpolate = True;
+ for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
+ _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, &crossSection);
}
}
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Eigenvectors.h
--- a/DrawingObjects/src/Eigenvectors.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Eigenvectors.h Fri Feb 05 12:57:55 2010 -0800
@@ -75,11 +75,19 @@
void _lucEigenvectors_Delete( void* drawingObject ) ;
void _lucEigenvectors_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucEigenvectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucEigenvectors_DefaultNew( Name name ) ;
void _lucEigenvectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
-
+ void _lucEigenvectors_Build( void* drawingObject, void* data ) ;
+ void _lucEigenvectors_Initialise( void* drawingObject, void* data ) ;
+ void _lucEigenvectors_Execute( void* drawingObject, void* data );
+ void _lucEigenvectors_Destroy( void* drawingObject, void* data ) ;
+
+ void _lucEigenvectors_Setup( void* drawingObject, void* _context ) ;
+ void _lucEigenvectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucEigenvectors_CleanUp( void* drawingObject, void* _context ) ;
void _lucEigenvectors_BuildDisplayList( void* drawingObject, void* _context ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Eigenvectors.meta
--- a/DrawingObjects/src/Eigenvectors.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Eigenvectors.meta Fri Feb 05 12:57:55 2010 -0800
@@ -13,7 +13,7 @@
<param name="Parent">lucEigenvectorsCrossSection</param>
<param name="Reference"></param>
<param name="Summary"></param>
-<param name="Description">Samples the values of a tensor field in a grid and draws arrows to represent the Eigenvectors. (For more information about parameters and dependencies look at parent class lucEigenvectorCrossSection)...</param>
+<param name="Description">Samples the values of a tensor field in a grid and draws arrows to represent the Eigenvectors. (For more information about partameters and dependencies look at parent class lucEigenvectorCrossSection)...</param>
<!--Now the interesting stuff-->
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/EigenvectorsCrossSection.c
--- a/DrawingObjects/src/EigenvectorsCrossSection.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/EigenvectorsCrossSection.c Fri Feb 05 12:57:55 2010 -0800
@@ -51,8 +51,10 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
#include "types.h"
-#include "CrossSection.h"
+#include "OpenGLDrawingObject.h"
#include "EigenvectorsCrossSection.h"
#include <assert.h>
@@ -75,13 +77,14 @@ lucEigenvectorsCrossSection* _lucEigenve
/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
assert( _sizeOfSelf >= sizeof(lucEigenvectorsCrossSection) );
- self = (lucEigenvectorsCrossSection*) _lucCrossSection_New( LUCCROSSSECTION_PASSARGS );
+ self = (lucEigenvectorsCrossSection*) _lucOpenGLDrawingObject_New( LUCOPENGLDRAWINGOBJECT_PASSARGS );
return self;
}
void _lucEigenvectorsCrossSection_Init(
lucEigenvectorsCrossSection* self,
+ FieldVariable* tensorField,
Dimension_Index dim,
Name leastColourName,
Name middleColourName,
@@ -97,20 +100,22 @@ void _lucEigenvectorsCrossSection_Init(
double scaleEigenValue,
Name leastColourForNegativeName,
Name middleColourForNegativeName,
- Name greatestColourForNegativeName)
+ Name greatestColourForNegativeName,
+ lucCrossSection* crossSection)
{
Stream* errorStream = Journal_MyStream( Error_Type, self );
+ self->tensorField = tensorField;
if ( dim == 2 ) {
- lucColour_FromString( &self->colours[0], leastColourName );
- lucColour_FromString( &self->colours[1], greatestColourName );
+ lucColour_FromString( &self->colour[0], leastColourName );
+ lucColour_FromString( &self->colour[1], greatestColourName );
lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
lucColour_FromString( &self->colourForNegative[1], greatestColourForNegativeName );
}
else {
- lucColour_FromString( &self->colours[0], leastColourName );
- lucColour_FromString( &self->colours[1], middleColourName );
- lucColour_FromString( &self->colours[2], greatestColourName );
+ lucColour_FromString( &self->colour[0], leastColourName );
+ lucColour_FromString( &self->colour[1], middleColourName );
+ lucColour_FromString( &self->colour[2], greatestColourName );
lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
lucColour_FromString( &self->colourForNegative[1], middleColourForNegativeName );
@@ -132,19 +137,35 @@ void _lucEigenvectorsCrossSection_Init(
self->plotEigenVector = plotEigenVector;
self->plotEigenValue = plotEigenValue;
self->scaleEigenValue = scaleEigenValue;
+
+ self->crossSection = crossSection;
}
void _lucEigenvectorsCrossSection_Delete( void* drawingObject ) {
lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
- _lucCrossSection_Delete( self );
+ lucCrossSection_Delete(self->crossSection);
+ _lucOpenGLDrawingObject_Delete( self );
}
void _lucEigenvectorsCrossSection_Print( void* drawingObject, Stream* stream ) {
lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
- _lucCrossSection_Print( self, stream );
+ _lucOpenGLDrawingObject_Print( self, stream );
}
+
+void* _lucEigenvectorsCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+ lucEigenvectorsCrossSection* newDrawingObject;
+
+ newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
void* _lucEigenvectorsCrossSection_DefaultNew( Name name ) {
/* Variables set in this function */
@@ -159,9 +180,9 @@ void* _lucEigenvectorsCrossSection_Defau
Stg_Component_InitialiseFunction* _initialise = _lucEigenvectorsCrossSection_Initialise;
Stg_Component_ExecuteFunction* _execute = _lucEigenvectorsCrossSection_Execute;
Stg_Component_DestroyFunction* _destroy = _lucEigenvectorsCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucOpenGLDrawingObject_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucCrossSection_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ lucDrawingObject_SetupFunction* _setup = _lucEigenvectorsCrossSection_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucEigenvectorsCrossSection_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucEigenvectorsCrossSection_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucEigenvectorsCrossSection_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -172,12 +193,14 @@ void* _lucEigenvectorsCrossSection_Defau
void _lucEigenvectorsCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+ FieldVariable* tensorField;
Index defaultResolution;
IJK resolution;
/* Construct Parent */
- _lucCrossSection_AssignFromXML( self, cf, data );
- strcpy(self->fieldVariableName, "TensorField");
+ _lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+ tensorField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TensorField", FieldVariable, True, data );
defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8 );
resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution );
@@ -186,6 +209,7 @@ void _lucEigenvectorsCrossSection_Assign
_lucEigenvectorsCrossSection_Init(
self,
+ tensorField,
Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 2 ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColour", "black" ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColour", "black" ),
@@ -201,28 +225,47 @@ void _lucEigenvectorsCrossSection_Assign
Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleEigenValue", 1.0 ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColourForNegative", "black" ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColourForNegative", "black" ),
- Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black" ) );
+ Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black" ),
+ lucCrossSection_Read(cf, self->name));
}
-void _lucEigenvectorsCrossSection_Build( void* drawingObject, void* data ) {
- /* Build field variable in parent */
- _lucCrossSection_Build(drawingObject, data);
-}
-
+void _lucEigenvectorsCrossSection_Build( void* drawingObject, void* data ) {}
void _lucEigenvectorsCrossSection_Initialise( void* drawingObject, void* data ) {}
void _lucEigenvectorsCrossSection_Execute( void* drawingObject, void* data ) {}
void _lucEigenvectorsCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucEigenvectorsCrossSection_Setup( void* drawingObject, void* _context ) {
+ lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucEigenvectorsCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucEigenvectorsCrossSection_CleanUp( void* drawingObject, void* _context ) {
+ lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_CleanUp( self, _context );
+}
void _lucEigenvectorsCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
DomainContext* context = (DomainContext*) _context;
- _lucEigenvectorsCrossSection_DrawCrossSection( self, context->dim );
+ _lucEigenvectorsCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
}
-void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim ) {
+void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
- FieldVariable* tensorField = self->fieldVariable;
+ FieldVariable* tensorField = self->tensorField;
+ Axis axis = crossSection->axis;
+ Axis aAxis = (axis == I_AXIS ? J_AXIS : I_AXIS);
+ Axis bAxis = (axis == K_AXIS ? J_AXIS : K_AXIS);
Coord pos;
SymmetricTensor tensor;
Coord globalMin;
@@ -238,18 +281,18 @@ void _lucEigenvectorsCrossSection_DrawCr
glLineWidth(self->lineWidth);
- dA = (globalMax[ self->axis1 ] - globalMin[ self->axis1 ])/(double)self->resolution[ self->axis1 ];
- dB = (globalMax[ self->axis2 ] - globalMin[ self->axis2 ])/(double)self->resolution[ self->axis2 ];
+ dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
+ dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
- pos[self->axis] = lucCrossSection_GetValue(self, globalMin[self->axis], globalMax[self->axis]);
- Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", self->axis, pos[self->axis]);
+ pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
+ Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
- for ( pos[ self->axis1 ] = globalMin[ self->axis1 ] + dA * 0.5 ; pos[ self->axis1 ] < globalMax[ self->axis1 ] ; pos[ self->axis1 ] += dA ) {
- for ( pos[ self->axis2 ] = globalMin[ self->axis2 ] + dB * 0.5 ; pos[ self->axis2 ] < globalMax[ self->axis2 ] ; pos[ self->axis2 ] += dB ) {
+ for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
+ for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
- if ( pos[ self->axis1 ] < localMin[ self->axis1 ] || pos[ self->axis1 ] >= localMax[ self->axis1 ] )
+ if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
continue;
- if ( pos[ self->axis2 ] < localMin[ self->axis2 ] || pos[ self->axis2 ] >= localMax[ self->axis2 ] )
+ if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
continue;
/* Get Value of Tensor at this point in space */
@@ -259,7 +302,7 @@ void _lucEigenvectorsCrossSection_DrawCr
if(self->plotEigenVector){
for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
- lucColour_SetOpenGLColour( &self->colours[ dim_I ] );
+ lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
if(self->useEigenValue){
luc_DrawVector( dim, pos, eigenvectorList[ dim_I ].vector,
(eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue), self->arrowHeadSize );
@@ -278,7 +321,7 @@ void _lucEigenvectorsCrossSection_DrawCr
/* colour for negative values, one for each dim as well */
if ( eigenvectorList[ dim_I ].eigenvalue >= 0) {
pointSize = eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue;
- lucColour_SetOpenGLColour( &self->colours[ dim_I ] );
+ lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
}
else {
lucColour_SetOpenGLColour( &self->colourForNegative[ dim_I ] );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/EigenvectorsCrossSection.h
--- a/DrawingObjects/src/EigenvectorsCrossSection.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/EigenvectorsCrossSection.h Fri Feb 05 12:57:55 2010 -0800
@@ -43,7 +43,7 @@
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "CrossSection.h"
+#include <glucifer/Base/CrossSection.h>
#ifndef __lucEigenvectorsCrossSection_h__
#define __lucEigenvectorsCrossSection_h__
@@ -52,28 +52,30 @@
extern const Type lucEigenvectorsCrossSection_Type;
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
- #define __lucEigenvectorsCrossSection \
- /* Macro defining parent goes here - This means you can cast this class as its parent */ \
- __lucCrossSection \
- /* Virtual functions go here */ \
- /* Other info */ \
- lucColour colours[3]; \
- /* Colour used to display negative EigenValues */ \
- lucColour colourForNegative[3]; \
- IJK resolution; \
- double arrowHeadSize; \
- double lengthScale; \
- float lineWidth; \
- /* Specifies if the eigenvalue is used to draw the vector - default true */ \
- Bool useEigenValue; \
- /* Value used to draw the vector if the eigenvalue is not used */ \
- double notEigenValue; \
- /* Specifies if the EigenVector and/or EigenValues are to be drawn */ \
- /* Default is True for EigenVector, False for EigenValues */ \
- Bool plotEigenVector; \
- Bool plotEigenValue; \
- /* Used to scale the EigenValue if needed */ \
- double scaleEigenValue; \
+ #define __lucEigenvectorsCrossSection \
+ /* Macro defining parent goes here - This means you can cast this class as its parent */ \
+ __lucOpenGLDrawingObject \
+ /* Virtual functions go here */ \
+ /* Other info */\
+ FieldVariable* tensorField; \
+ lucColour colour[3]; \
+ /* Colour used to display negative EigenValues */ \
+ lucColour colourForNegative[3]; \
+ IJK resolution; \
+ double arrowHeadSize; \
+ double lengthScale; \
+ float lineWidth; \
+ lucCrossSection* crossSection; \
+ /* Specifies if the eigenvalue is used to draw the vector - default true */ \
+ Bool useEigenValue; \
+ /* Value used to draw the vector if the eigenvalue is not used */ \
+ double notEigenValue; \
+ /* Specifies if the EigenVector and/or EigenValues are to be drawn */ \
+ /* Default is True for EigenVector, False for EigenValues */ \
+ Bool plotEigenVector; \
+ Bool plotEigenValue; \
+ /* Used to scale the EigenValue if needed */ \
+ double scaleEigenValue;
struct lucEigenvectorsCrossSection { __lucEigenvectorsCrossSection };
@@ -85,15 +87,16 @@
#endif
#define LUCEIGENVECTORSCROSSSECTION_DEFARGS \
- LUCCROSSSECTION_DEFARGS
+ LUCOPENGLDRAWINGOBJECT_DEFARGS
#define LUCEIGENVECTORSCROSSSECTION_PASSARGS \
- LUCCROSSSECTION_PASSARGS
+ LUCOPENGLDRAWINGOBJECT_PASSARGS
lucEigenvectorsCrossSection* _lucEigenvectorsCrossSection_New( LUCEIGENVECTORSCROSSSECTION_DEFARGS );
void _lucEigenvectorsCrossSection_Delete( void* drawingObject ) ;
void _lucEigenvectorsCrossSection_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucEigenvectorsCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucEigenvectorsCrossSection_DefaultNew( Name name ) ;
@@ -103,8 +106,12 @@
void _lucEigenvectorsCrossSection_Execute( void* drawingObject, void* data );
void _lucEigenvectorsCrossSection_Destroy( void* drawingObject, void* data ) ;
+ void _lucEigenvectorsCrossSection_Setup( void* drawingObject, void* _context ) ;
+ void _lucEigenvectorsCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucEigenvectorsCrossSection_CleanUp( void* drawingObject, void* _context ) ;
+
void _lucEigenvectorsCrossSection_BuildDisplayList( void* drawingObject, void* _context ) ;
- void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim );
+ void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection );
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/EigenvectorsCrossSection.meta
--- a/DrawingObjects/src/EigenvectorsCrossSection.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/EigenvectorsCrossSection.meta Fri Feb 05 12:57:55 2010 -0800
@@ -10,7 +10,7 @@
<param name="Project Web">http://mcc.monash.edu.au/gLucifer</param>
<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">lucCrossSection</param>
+<param name="Parent">lucOpenGLDrawingObject</param>
<param name="Reference"></param>
<param name="Summary"></param>
<param name="Description">Samples the values of a tensor field in a plane and draws arrows to represent the Eigenvectors.</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/FeVariableSurface.c
--- a/DrawingObjects/src/FeVariableSurface.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/FeVariableSurface.c Fri Feb 05 12:57:55 2010 -0800
@@ -162,7 +162,7 @@ void _lucFeVariableSurface_AssignFromXML
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black" ),
Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireframe", False ),
(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 ),
- (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleHeight", 1.0 ) );
+ (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleHeight", 0.0 ) );
}
void _lucFeVariableSurface_Build( void* drawingObject, void* data ) {}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/FieldVariableBorder.c
--- a/DrawingObjects/src/FieldVariableBorder.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/FieldVariableBorder.c Fri Feb 05 12:57:55 2010 -0800
@@ -193,13 +193,12 @@ void _lucFieldVariableBorder_BuildDispla
/* Initialise OpenGL stuff */
glDisable(GL_LIGHTING);
- glEnable(GL_DEPTH_TEST);
/* Line smoothing will not work correctly with depth testing enabled*/
- //glDisable(GL_DEPTH_TEST);
- //glEnable(GL_LINE_SMOOTH);
- //glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
- //glEnable(GL_BLEND);
- //glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_DEPTH_TEST);
+ glEnable(GL_LINE_SMOOTH);
+ glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glEnable(GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ) ;
lucColour_SetOpenGLColour( &self->colour );
@@ -227,7 +226,7 @@ void _lucFieldVariableBorder_BuildDispla
}
/* Clean up OpenGL stuff */
- //glEnable(GL_DEPTH_TEST);
+ glEnable(GL_DEPTH_TEST);
glPolygonMode ( GL_FRONT_AND_BACK, GL_FILL ) ;
glEnable( GL_LIGHTING );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/HistoricalSwarmTrajectory.c
--- a/DrawingObjects/src/HistoricalSwarmTrajectory.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/HistoricalSwarmTrajectory.c Fri Feb 05 12:57:55 2010 -0800
@@ -223,7 +223,7 @@ void _lucHistoricalSwarmTrajectory_Setup
particle = (GlobalParticle*)Swarm_ParticleAt( swarm, lParticle_I );
particleExt = ExtensionManager_Get( swarm->particleExtensionMgr, particle, self->particleExtHandle );
- particleExt->historyCoordList = (Coord*)(particleExt + sizeof( lucHistoricalSwarmTrajectory_ParticleExt ));
+ particleExt->historyCoordList = particleExt + sizeof( lucHistoricalSwarmTrajectory_ParticleExt );
memcpy( particleExt->historyCoordList[ currentTimestep ], particle->coord, sizeof(Coord) );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Init.c
--- a/DrawingObjects/src/Init.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Init.c Fri Feb 05 12:57:55 2010 -0800
@@ -60,7 +60,6 @@ Bool lucDrawingObjects_Init() {
Stg_ComponentRegister_Add( componentRegister, lucColourBar_Type, (Name)"0", _lucColourBar_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucFieldVariableBorder_Type, (Name)"0", _lucFieldVariableBorder_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucIsosurface_Type, (Name)"0", _lucIsosurface_DefaultNew );
- Stg_ComponentRegister_Add( componentRegister, lucCrossSection_Type, (Name)"0", _lucCrossSection_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucScalarFieldCrossSection_Type, (Name)"0", _lucScalarFieldCrossSection_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucScalarField_Type, (Name)"0", _lucScalarField_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucVectorArrowCrossSection_Type, (Name)"0", _lucVectorArrowCrossSection_DefaultNew );
@@ -78,22 +77,22 @@ Bool lucDrawingObjects_Init() {
Stg_ComponentRegister_Add( componentRegister, lucMeshViewer_Type, (Name)"0", _lucMeshViewer_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucTitle_Type, (Name)"0", _lucTitle_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucAxis_Type, (Name)"0", _lucAxis_DefaultNew );
- Stg_ComponentRegister_Add( componentRegister, lucTimeStep_Type, (Name)"0", _lucTimeStep_DefaultNew );
+ Stg_ComponentRegister_Add( componentRegister, lucTimeStep_Type, (Name)"0", _lucTimeStep_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMeshCrossSection_Type, (Name)"0", _lucScalarFieldOnMeshCrossSection_DefaultNew );
Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMesh_Type, (Name)"0", _lucScalarFieldOnMesh_DefaultNew );
/* Register Parents for type checking */
RegisterParent( lucOpenGLDrawingObject_Type, lucDrawingObject_Type );
- RegisterParent( lucCrossSection_Type, lucOpenGLDrawingObject_Type );
- RegisterParent( lucScalarFieldCrossSection_Type, lucCrossSection_Type );
- RegisterParent( lucScalarFieldOnMeshCrossSection_Type, lucCrossSection_Type );
- RegisterParent( lucVectorArrowCrossSection_Type, lucCrossSection_Type );
- RegisterParent( lucEigenvectorsCrossSection_Type, lucCrossSection_Type );
+ RegisterParent( lucScalarFieldCrossSection_Type, lucOpenGLDrawingObject_Type );
RegisterParent( lucScalarField_Type, lucScalarFieldCrossSection_Type );
- RegisterParent( lucScalarFieldOnMesh_Type, lucScalarFieldOnMeshCrossSection_Type );
+ RegisterParent( lucScalarFieldOnMeshCrossSection_Type, lucOpenGLDrawingObject_Type );
+ RegisterParent( lucScalarFieldOnMesh_Type, lucScalarFieldOnMeshCrossSection_Type );
+ RegisterParent( lucVectorArrowCrossSection_Type, lucOpenGLDrawingObject_Type );
RegisterParent( lucVectorArrows_Type, lucVectorArrowCrossSection_Type );
+ RegisterParent( lucEigenvectorsCrossSection_Type, lucOpenGLDrawingObject_Type );
RegisterParent( lucEigenvectors_Type, lucEigenvectorsCrossSection_Type );
+
RegisterParent( lucColourBar_Type, lucDrawingObject_Type );
RegisterParent( lucFieldVariableBorder_Type, lucOpenGLDrawingObject_Type );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Isosurface.c
--- a/DrawingObjects/src/Isosurface.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Isosurface.c Fri Feb 05 12:57:55 2010 -0800
@@ -213,17 +213,17 @@ void _lucIsosurface_Destroy( void* drawi
void _lucIsosurface_Destroy( void* drawingObject, void* data ) {}
void _lucIsosurface_Setup( void* drawingObject, void* _context ) {
- lucIsosurface* self = (lucIsosurface*)drawingObject;
- DomainContext* context = (DomainContext*) _context;
- FieldVariable* isosurfaceField = self->isosurfaceField;
- int i, j, k;
- int nx, ny, nz;
- double dx, dy, dz;
- Vertex*** vertex;
- Coord pos;
- Coord min;
- Coord max;
- Dimension_Index dim = context->dim;
+ lucIsosurface* self = (lucIsosurface*)drawingObject;
+ DomainContext* context = (DomainContext*) _context;
+ FieldVariable* isosurfaceField = self->isosurfaceField;
+ int i, j, k;
+ int nx, ny, nz;
+ double dx, dy, dz;
+ Vertex*** vertex;
+ Coord pos;
+ Coord min;
+ Coord max;
+ Dimension_Index dim = context->dim;
lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
@@ -254,7 +254,7 @@ void _lucIsosurface_Setup( void* drawing
pos[ K_AXIS ] = min[ K_AXIS ] + dz * (double ) k;
memcpy( vertex[i][j][k].pos, pos, 3 * sizeof(double) );
-
+
if ( i == 0 )
pos[ I_AXIS ] = min[ I_AXIS ] + 0.001 * dx;
if ( j == 0 )
@@ -267,10 +267,7 @@ void _lucIsosurface_Setup( void* drawing
pos[ J_AXIS ] = max[ J_AXIS ] - 0.001 * dy;
if ( k == nz - 1 )
pos[ K_AXIS ] = max[ K_AXIS ] - 0.001 * dz;
-
- if (!FieldVariable_InterpolateValueAt( isosurfaceField, pos, &vertex[i][j][k].value ))
- /* FieldVariable_InterpolateValueAt returns OTHER_PROC if point not found in mesh, so zero value */
- vertex[i][j][k].value = 0;
+ FieldVariable_InterpolateValueAt( isosurfaceField, pos, &vertex[i][j][k].value );
}
}
}
@@ -368,8 +365,7 @@ void _lucIsosurface_BuildDisplayList( vo
else
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
- /* Set up Face Culling - default is no culling so surface visible from both sides */
- glDisable( GL_CULL_FACE );
+ /* Set up Face Culling */
if (self->cullBackFace) {
if (self->cullFrontFace)
glCullFace( GL_FRONT_AND_BACK );
@@ -393,7 +389,8 @@ void _lucIsosurface_BuildDisplayList( vo
else if ( colourMap )
lucColourMap_CalibrateFromFieldVariable( colourMap, self->isosurfaceField );
- glFrontFace(GL_CCW);
+
+ glFrontFace(GL_CW);
glBegin(GL_TRIANGLES);
if ( ! self->colourMap || ! colourField ) {
@@ -419,15 +416,14 @@ void _lucIsosurface_BuildDisplayList( vo
glVertex3dv(currentTriangle->pos1);
/* Plot Second Vertex */
+ lucIsosurface_GetColourForPos( self, currentTriangle->pos3, min, max, fudgeFactor );
+ glNormal3dv(currentTriangle->normal3);
+ glVertex3dv(currentTriangle->pos3);
+
+ /* Plot Third Vertex */
lucIsosurface_GetColourForPos( self, currentTriangle->pos2, min, max, fudgeFactor );
glNormal3dv(currentTriangle->normal2);
glVertex3dv(currentTriangle->pos2);
-
- /* Plot Third Vertex */
- lucIsosurface_GetColourForPos( self, currentTriangle->pos3, min, max, fudgeFactor );
- glNormal3dv(currentTriangle->normal3);
- glVertex3dv(currentTriangle->pos3);
-
}
glEnd();
}
@@ -909,7 +905,6 @@ void lucIsosurface_Normals( lucIsosurfac
vertex[i][j][k-1].value, vertex[i][j][k].value, vertex[i][j][k+1].value,
vertex[i][j][k-1].pos[2], vertex[i][j][k].pos[2], vertex[i][j][k+1].pos[2]);
}
-
StGermain_VectorNormalise(vertex[i][j][k].normal, 3);
}
}
@@ -968,16 +963,16 @@ void lucIsosurface_DrawWalls( lucIsosurf
int nz = self->resolution[ K_AXIS ];
int i, j, k;
Vertex ** points;
- Vertex * midVerticies;
+ Vertex * midVertices;
char order;
/* Allocate Memory */
points = Memory_Alloc_Array( Vertex* , 8, "array for marching squares");
- midVerticies = Memory_Alloc_Array( Vertex , 4, "array for marching squares");
- points[LEFT] = &midVerticies[0];
- points[RIGHT] = &midVerticies[1];
- points[TOP] = &midVerticies[2];
- points[BOTTOM] = &midVerticies[3];
+ midVertices = Memory_Alloc_Array( Vertex , 4, "array for marching squares");
+ points[LEFT] = &midVertices[0];
+ points[RIGHT] = &midVertices[1];
+ points[TOP] = &midVertices[2];
+ points[BOTTOM] = &midVertices[3];
for ( i = 0 ; i < nx - 1 ; i++ ) {
for ( j = 0 ; j < ny - 1 ; j++ ) {
@@ -1020,7 +1015,7 @@ void lucIsosurface_DrawWalls( lucIsosurf
}
}
Memory_Free( points );
- Memory_Free( midVerticies );
+ Memory_Free( midVertices );
}
void lucIsosurface_SetupPointsX( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
@@ -1069,8 +1064,8 @@ void lucIsosurface_AddWallTriangle( lucI
if (order == gLucifer_CCW) {
memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
- memcpy( self->triangleList[n].pos3, points[c]->pos, 3*sizeof(double) );
- memcpy( self->triangleList[n].pos2, points[b]->pos, 3*sizeof(double) );
+ memcpy( self->triangleList[n].pos2, points[c]->pos, 3*sizeof(double) );
+ memcpy( self->triangleList[n].pos3, points[b]->pos, 3*sizeof(double) );
}
else {
memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
@@ -1078,7 +1073,7 @@ void lucIsosurface_AddWallTriangle( lucI
memcpy( self->triangleList[n].pos3, points[c]->pos, 3*sizeof(double) );
}
- /* Calculate Normal */
+ /* Calculate Normal */
StGermain_NormalToPlane( self->triangleList[n].normal1 ,
self->triangleList[n].pos1, self->triangleList[n].pos2, self->triangleList[n].pos3 );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/Isosurface.meta
--- a/DrawingObjects/src/Isosurface.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/Isosurface.meta Fri Feb 05 12:57:55 2010 -0800
@@ -21,7 +21,7 @@
<param name="Name">resolution</param>
<param name="Type">UnsignedInt</param>
<param name="Default">64</param>
- <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of verticies in each direction.</param>
+ <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of vertices in each direction.</param>
</struct>
<struct>
<param name="Name">resolutionX</param>
@@ -81,7 +81,7 @@
<param name="Name">maskType</param>
<param name="Type">String</param>
<param name="Default">GreaterThan</param>
- <param name="Description">When testing whether to draw a triangle in the surface - this mask compares the value of a field at the verticies of the triangle and compares it to a value. This is the nature of the comparison. It can be "GreaterThan", "LessThan" or "EqualTo".</param>
+ <param name="Description">When testing whether to draw a triangle in the surface - this mask compares the value of a field at the vertices of the triangle and compares it to a value. This is the nature of the comparison. It can be "GreaterThan", "LessThan" or "EqualTo".</param>
</struct>
<struct>
<param name="Name">maskValue</param>
@@ -108,7 +108,7 @@
<param name="Essential">No</param>
<param name="Name">ColourMap</param>
<param name="Type">lucColourMap</param>
- <param name="Description">You may colour each of the verticies of the isosurface with a colour map if you specify it here. This will override the 'colour' given as a parameter.</param>
+ <param name="Description">You may colour each of the vertices of the isosurface with a colour map if you specify it here. This will override the 'colour' given as a parameter.</param>
</struct>
<struct>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/MeshViewer.c
--- a/DrawingObjects/src/MeshViewer.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/MeshViewer.c Fri Feb 05 12:57:55 2010 -0800
@@ -86,25 +86,19 @@ lucMeshViewer* _lucMeshViewer_New( LUCM
}
void _lucMeshViewer_Init(
- lucMeshViewer* self,
+ lucMeshViewer* self,
Mesh* mesh,
Name localColourName,
Name shadowColourName,
Name vacantColourName,
- float lineWidth,
- char* skipEdges )
+ float lineWidth )
{
- self->mesh = mesh;
- lucColour_FromString( &self->localColour, localColourName );
- lucColour_FromString( &self->shadowColour, shadowColourName );
- lucColour_FromString( &self->vacantColour, vacantColourName );
- self->lineWidth = lineWidth;
-
- /* Specify axis-aligned mesh edges that should not be plotted with character string representing axis */
- if (strchr(skipEdges, 'x') || strchr(skipEdges, 'X')) self->skipXedges = True; else self->skipXedges = False;
- if (strchr(skipEdges, 'y') || strchr(skipEdges, 'Y')) self->skipYedges = True; else self->skipYedges = False;
- if (strchr(skipEdges, 'z') || strchr(skipEdges, 'Z')) self->skipZedges = True; else self->skipZedges = False;
-
+ self->mesh = mesh;
+ lucColour_FromString( &self->localColour, localColourName );
+ lucColour_FromString( &self->shadowColour, shadowColourName );
+ lucColour_FromString( &self->vacantColour, vacantColourName );
+ self->lineWidth = lineWidth;
+
assert( Stg_Class_IsInstance( mesh, Mesh_Type ) );
self->renderEdges = NULL;
@@ -183,8 +177,7 @@ void _lucMeshViewer_AssignFromXML( void*
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"localColour", "black" ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"shadowColour", "blue" ),
Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"vacantColour", "Grey" ),
- (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 ),
- Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"skipEdges", "")
+ (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 )
);
}
@@ -440,16 +433,14 @@ void lucMeshViewer_RenderLocal( void* dr
assert( self->renderEdges );
/* Shortcuts. */
- glDisable(GL_LIGHTING);
- glDisable(GL_LINE_SMOOTH);
- /*glDisable(GL_DEPTH_TEST); /* depth testing and line smoothing do not work well together */
+ glDisable(GL_LIGHTING); /* lighting is just not set up correctly */
mesh = self->mesh;
/* Pick the correct dimension. */
if( Mesh_GetDimSize( mesh ) == 3 )
- vertexFunc =(vertexFuncType*) glVertex3dv;
+ vertexFunc = glVertex3dv;
else
- vertexFunc = (vertexFuncType*) glVertex2dv;
+ vertexFunc = glVertex2dv;
/* Set color. */
@@ -470,8 +461,6 @@ void lucMeshViewer_RenderLocal( void* dr
/* Render edges */
self->renderEdges( self, vertexFunc );
-
- glEnable(GL_DEPTH_TEST);
/* For now we are doing any text printing in the Draw call as fonts have their own display lists and coord system */
#if 0
@@ -604,15 +593,8 @@ void lucMeshViewer_RenderEdges_WithInc(
incVerts = IArray_GetPtr( inc );
assert( nIncVerts == 2 );
- //vertexFunc( Mesh_GetVertex( self->mesh, incVerts[0] ) );
- //vertexFunc( Mesh_GetVertex( self->mesh, incVerts[1] ) );
- double *vertex1, *vertex2;
- vertex1 = Mesh_GetVertex( self->mesh, incVerts[0] );
- vertex2 = Mesh_GetVertex( self->mesh, incVerts[1] );
- if (!EdgeSkip(self, vertex1, vertex2)) {
- vertexFunc(vertex1);
- vertexFunc(vertex2);
- }
+ vertexFunc( Mesh_GetVertex( self->mesh, incVerts[0] ) );
+ vertexFunc( Mesh_GetVertex( self->mesh, incVerts[1] ) );
}
glEnd();
glEnable(GL_LIGHTING);
@@ -632,35 +614,11 @@ void lucMeshViewer_RenderEdges( lucMeshV
glDisable(GL_LIGHTING);
glBegin( GL_LINES );
for( e_i = 0; e_i < nEdges; e_i++ ) {
- //vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][0] ) );
- //vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][1] ) );
- double *vertex1, *vertex2;
- vertex1 = Mesh_GetVertex( self->mesh, edges[e_i][0] );
- vertex2 = Mesh_GetVertex( self->mesh, edges[e_i][1] );
- if (!EdgeSkip(self, vertex1, vertex2)) {
- vertexFunc(vertex1);
- vertexFunc(vertex2);
- }
+ vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][0] ) );
+ vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][1] ) );
}
glEnd();
glEnable(GL_LIGHTING);
}
-Bool EdgeSkip(lucMeshViewer* self, double* v1, double* v2)
-{
- /* Skip where Y+Z unchanging (x-axis aligned horizontal edges) */
- if (self->skipXedges && v1[J_AXIS] == v2[J_AXIS] && v1[K_AXIS] == v2[K_AXIS])
- return True;
- /* Skip where X+Z unchanging (y-axis aligned vertical edges) */
- if (self->skipYedges && v1[I_AXIS] == v2[I_AXIS] && v1[K_AXIS] == v2[K_AXIS])
- return True;
-
- /* Skip where X+Y unchanging (z-axis aligned horizontal edges) */
- if (self->skipZedges && v1[I_AXIS] == v2[I_AXIS] && v1[J_AXIS] == v2[J_AXIS])
- return True;
-
- return False;
-}
-
-
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/MeshViewer.h
--- a/DrawingObjects/src/MeshViewer.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/MeshViewer.h Fri Feb 05 12:57:55 2010 -0800
@@ -77,10 +77,7 @@
Bool nodeNumbers; \
Bool elementNumbers; \
Bool displayNodes; \
- float lineWidth; \
- Bool skipXedges; \
- Bool skipYedges; \
- Bool skipZedges; \
+ float lineWidth;
struct lucMeshViewer { __lucMeshViewer };
@@ -130,7 +127,6 @@
void lucMeshViewer_BuildEdges( lucMeshViewer* self );
void lucMeshViewer_RenderEdges_WithInc( lucMeshViewer* self, vertexFuncType* vertexFunc );
void lucMeshViewer_RenderEdges( lucMeshViewer* self, vertexFuncType* vertexFunc );
- Bool EdgeSkip(lucMeshViewer* self, double* v1, double* v2);
void lucMeshViewer_PrintAllNodesNumber( void* drawingObject );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/MeshViewer.meta
--- a/DrawingObjects/src/MeshViewer.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/MeshViewer.meta Fri Feb 05 12:57:55 2010 -0800
@@ -55,12 +55,6 @@
<param name="Description">If True, all the element numbers will be drawn. (Not currently implemented)</param>
</struct>
- <struct>
- <param name="Name">skipEdges</param>
- <param name="Type">String</param>
- <param name="Default">""</param>
- <param name="Description">Specify one or more axis (x, y or z) in this parameter and edges of the mesh aligned to those axis will not be drawn</param>
- </struct>
</list>
<list name="Dependencies">
@@ -80,7 +74,6 @@
<param name="Mesh">linearMesh</param>
<param name="displayNodes">true</param>
<param name="localColour">blue</param>
- <param name="skipEdges">Y</param>
</struct>
]]>
</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarField.c
--- a/DrawingObjects/src/ScalarField.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarField.c Fri Feb 05 12:57:55 2010 -0800
@@ -51,6 +51,7 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
#include "types.h"
#include "OpenGLDrawingObject.h"
@@ -81,9 +82,11 @@ lucScalarField* _lucScalarField_New( LU
return self;
}
-void _lucScalarField_Init(lucScalarField* self, Bool useMesh)
+void _lucScalarField_Init(
+ lucScalarField* self,
+ Bool cullFace )
{
- self->useMesh = useMesh;
+ self->cullFace = cullFace;
}
void _lucScalarField_Delete( void* drawingObject ) {
@@ -98,6 +101,19 @@ void _lucScalarField_Print( void* drawin
_lucScalarFieldCrossSection_Print( self, stream );
}
+void* _lucScalarField_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+ lucScalarField* newDrawingObject;
+
+ newDrawingObject = _lucScalarFieldCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
+
void* _lucScalarField_DefaultNew( Name name ) {
/* Variables set in this function */
SizeT _sizeOfSelf = sizeof(lucScalarField);
@@ -107,13 +123,13 @@ void* _lucScalarField_DefaultNew( Name n
Stg_Class_CopyFunction* _copy = NULL;
Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucScalarField_DefaultNew;
Stg_Component_ConstructFunction* _construct = _lucScalarField_AssignFromXML;
- Stg_Component_BuildFunction* _build = _lucScalarFieldCrossSection_Build;
- Stg_Component_InitialiseFunction* _initialise = _lucScalarFieldCrossSection_Initialise;
- Stg_Component_ExecuteFunction* _execute = _lucScalarFieldCrossSection_Execute;
- Stg_Component_DestroyFunction* _destroy = _lucScalarFieldCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucScalarFieldCrossSection_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucOpenGLDrawingObject_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ Stg_Component_BuildFunction* _build = _lucScalarField_Build;
+ Stg_Component_InitialiseFunction* _initialise = _lucScalarField_Initialise;
+ Stg_Component_ExecuteFunction* _execute = _lucScalarField_Execute;
+ Stg_Component_DestroyFunction* _destroy = _lucScalarField_Destroy;
+ lucDrawingObject_SetupFunction* _setup = _lucScalarField_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucScalarField_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucScalarField_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucScalarField_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -128,44 +144,89 @@ void _lucScalarField_AssignFromXML( void
/* Construct Parent */
_lucScalarFieldCrossSection_AssignFromXML( self, cf, data );
- _lucScalarField_Init(self, Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useMesh", False ) );
+ _lucScalarField_Init(
+ self,
+ Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True ) );
+
+ self->useMesh = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useMesh", False );
+}
+
+void _lucScalarField_Build( void* drawingObject, void* data ) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+
+ /* Call parent function */
+ _lucScalarFieldCrossSection_Build( self, data );
+}
+void _lucScalarField_Initialise( void* drawingObject, void* data ) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+
+ /* Call parent function */
+ _lucScalarFieldCrossSection_Initialise( self, data );
+}
+void _lucScalarField_Execute( void* drawingObject, void* data ) {}
+void _lucScalarField_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarField_Setup( void* drawingObject, void* _context ) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+
+ _lucScalarFieldCrossSection_Setup( self, _context );
+}
+
+void _lucScalarField_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+
+ _lucScalarFieldCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucScalarField_CleanUp( void* drawingObject, void* _context ) {
+ lucScalarField* self = (lucScalarField*)drawingObject;
+
+ _lucScalarFieldCrossSection_CleanUp( self, _context );
}
void _lucScalarField_BuildDisplayList( void* drawingObject, void* _context ) {
lucScalarField* self = (lucScalarField*)drawingObject;
DomainContext* context = (DomainContext*) _context;
+ lucCrossSection crossSection;
+
if (context->dim == 2)
{
+
if( self->useMesh )
lucScalarField_DrawWithMesh( self );
else {
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, False), GL_CCW);
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
}
}
else
{
- /* Cross sections at minimums, default winding for faces */
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, I_AXIS, True), GL_CCW);
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, J_AXIS, True), GL_CCW);
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, True), GL_CCW);
+ if ( self->cullFace ) glEnable(GL_CULL_FACE);
+
+ glFrontFace(GL_CCW);
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, I_AXIS, True));
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, J_AXIS, True));
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, True));
- /* Cross sections at maximums, reverse winding for faces */
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 1.0, I_AXIS, True), GL_CW);
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 1.0, J_AXIS, True), GL_CW);
- lucScalarFieldCrossSection_DrawCrossSection( lucCrossSection_Set(self, 1.0, K_AXIS, True), GL_CW);
+ glFrontFace(GL_CW);
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, I_AXIS, True));
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, J_AXIS, True));
+ lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, K_AXIS, True));
+
+ glDisable(GL_CULL_FACE);
}
}
void lucScalarField_DrawWithMesh( lucScalarField* self ) {
- FeVariable* var = (FeVariable*)self->fieldVariable;
- FeMesh* mesh = var->feMesh;
- lucColourMap* cmap = self->colourMap;
- IArray* inc;
- double value;
- unsigned nElements;
- double xi[3], vertex[3];
- int ii, jj, kk;
+ FeVariable* var = (FeVariable*)self->fieldVariable;
+ FeMesh* mesh = var->feMesh;
+ lucColourMap* cmap = self->colourMap;
+ IArray* inc;
+ double value;
+ unsigned /* nodes,*/ nElements/*, curNode */;
+ /* int nodeMap[4] = {0, 1, 3, 2}; */
+ double xi[3], vertex[3];
+ int ii, jj, kk;
lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
glDisable( GL_LIGHTING );
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarField.h
--- a/DrawingObjects/src/ScalarField.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarField.h Fri Feb 05 12:57:55 2010 -0800
@@ -56,7 +56,8 @@
__lucScalarFieldCrossSection \
/* Virtual functions go here */ \
/* Other info */\
- Bool useMesh;
+ Bool cullFace; \
+ Bool useMesh;
struct lucScalarField { __lucScalarField };
@@ -76,10 +77,19 @@
void _lucScalarField_Delete( void* drawingObject ) ;
void _lucScalarField_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucScalarField_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucScalarField_DefaultNew( Name name ) ;
void _lucScalarField_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
+ void _lucScalarField_Build( void* drawingObject, void* data ) ;
+ void _lucScalarField_Initialise( void* drawingObject, void* data ) ;
+ void _lucScalarField_Execute( void* drawingObject, void* data );
+ void _lucScalarField_Destroy( void* drawingObject, void* data ) ;
+
+ void _lucScalarField_Setup( void* drawingObject, void* _context ) ;
+ void _lucScalarField_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucScalarField_CleanUp( void* drawingObject, void* _context ) ;
void _lucScalarField_BuildDisplayList( void* drawingObject, void* _context ) ;
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldCrossSection.c
--- a/DrawingObjects/src/ScalarFieldCrossSection.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldCrossSection.c Fri Feb 05 12:57:55 2010 -0800
@@ -52,8 +52,10 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
#include "types.h"
-#include "CrossSection.h"
+#include "OpenGLDrawingObject.h"
#include "ScalarFieldCrossSection.h"
#include <assert.h>
@@ -72,37 +74,54 @@ lucScalarFieldCrossSection* _lucScalarFi
/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
assert( _sizeOfSelf >= sizeof(lucScalarFieldCrossSection) );
- self = (lucScalarFieldCrossSection*) _lucCrossSection_New( LUCCROSSSECTION_PASSARGS );
+ self = (lucScalarFieldCrossSection*) _lucOpenGLDrawingObject_New( LUCOPENGLDRAWINGOBJECT_PASSARGS );
return self;
}
void _lucScalarFieldCrossSection_Init(
lucScalarFieldCrossSection* self,
+ Name fieldVariableName,
lucColourMap* colourMap,
IJK resolution,
+ lucCrossSection* crossSection,
XYZ minCropValues,
- XYZ maxCropValues,
- Bool cullFace )
+ XYZ maxCropValues )
{
+// self->fieldVariable = fieldVariable;
+ self->fieldVariableName = fieldVariableName;
self->colourMap = colourMap;
memcpy( self->resolution, resolution, sizeof(IJK) );
memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
- self->cullFace = cullFace;
+ self->crossSection = crossSection;
}
void _lucScalarFieldCrossSection_Delete( void* drawingObject ) {
lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
- _lucCrossSection_Delete( self );
+ lucCrossSection_Delete(self->crossSection);
+ _lucOpenGLDrawingObject_Delete( self );
}
void _lucScalarFieldCrossSection_Print( void* drawingObject, Stream* stream ) {
lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
- _lucCrossSection_Print( self, stream );
+ _lucOpenGLDrawingObject_Print( self, stream );
}
+
+void* _lucScalarFieldCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
+ lucScalarFieldCrossSection* newDrawingObject;
+
+ newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
void* _lucScalarFieldCrossSection_DefaultNew( Name name ) {
/* Variables set in this function */
@@ -118,8 +137,8 @@ void* _lucScalarFieldCrossSection_Defaul
Stg_Component_ExecuteFunction* _execute = _lucScalarFieldCrossSection_Execute;
Stg_Component_DestroyFunction* _destroy = _lucScalarFieldCrossSection_Destroy;
lucDrawingObject_SetupFunction* _setup = _lucScalarFieldCrossSection_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucCrossSection_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ lucDrawingObject_DrawFunction* _draw = _lucScalarFieldCrossSection_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucScalarFieldCrossSection_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucScalarFieldCrossSection_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -133,12 +152,19 @@ void _lucScalarFieldCrossSection_AssignF
lucColourMap* colourMap;
Index defaultResolution;
IJK resolution;
+ Name fieldVariableName;
XYZ minCropValues;
XYZ maxCropValues;
- Bool cullFace;
/* Construct Parent */
- _lucCrossSection_AssignFromXML( self, cf, data );
+ _lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+ fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName" );
+
+ /* This variable is now construct in build phase.
+ fieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
+ */
+
colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data ) ;
@@ -154,25 +180,25 @@ void _lucScalarFieldCrossSection_AssignF
maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL );
maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL );
maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL );
-
- cullFace = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True );
_lucScalarFieldCrossSection_Init(
self,
+ fieldVariableName,
colourMap,
resolution,
+ lucCrossSection_Read(cf, self->name),
minCropValues,
- maxCropValues,
- cullFace );
+ maxCropValues );
}
void _lucScalarFieldCrossSection_Build( void* drawingObject, void* data ) {
lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
+ AbstractContext* context = self->context;
+ Stg_ComponentFactory* cf = context->CF;
Stream* errorStream = Journal_Register( Error_Type, (Name)self->type );
- /* Build field variable in parent */
- _lucCrossSection_Build(self, data);
-
+ /* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
+ self->fieldVariable = Stg_ComponentFactory_ConstructByName( cf, (Name)self->fieldVariableName, FieldVariable, True, data );
Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
"can only visualise FieldVariables with 1 component. Did you mean to visualise the "
@@ -191,16 +217,30 @@ void _lucScalarFieldCrossSection_Setup(
_lucOpenGLDrawingObject_Setup( self, _context );
}
+void _lucScalarFieldCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
+ _lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucScalarFieldCrossSection_CleanUp( void* drawingObject, void* _context ) {
+ lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
+ _lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
void _lucScalarFieldCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
- lucScalarFieldCrossSection_DrawCrossSection( self, GL_CCW );
+ lucScalarFieldCrossSection_DrawCrossSection( self, self->crossSection );
}
#define FUDGE_FACTOR 0.0001
-void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, int direction) {
+void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, lucCrossSection* crossSection ) {
lucScalarFieldCrossSection* self = (lucScalarFieldCrossSection*)drawingObject;
FieldVariable* fieldVariable = self->fieldVariable;
+ Axis axis = crossSection->axis;
+ Axis aAxis;
+ Axis bAxis;
Coord min, globalMin;
Coord max, globalMax;
Coord pos;
@@ -214,22 +254,16 @@ void lucScalarFieldCrossSection_DrawCros
double bLength;
Dimension_Index dim_I;
- /* set polygon face winding */
- glFrontFace(direction);
- /* Visible from both sides? */
- if ( self->cullFace )
- glEnable(GL_CULL_FACE);
- else
- glDisable(GL_CULL_FACE);
-
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- if (fieldVariable->dim == 2)
- glDisable(GL_LIGHTING);
- else
- glEnable(GL_LIGHTING);
-
- aResolution = self->resolution[ self->axis1 ];
- bResolution = self->resolution[ self->axis2 ];
+ /* Ensure the field is synchronised. */
+ lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
+
+ glDisable(GL_LIGHTING);
+
+ aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
+ bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
+
+ aResolution = self->resolution[ aAxis ];
+ bResolution = self->resolution[ bAxis ];
FieldVariable_GetMinAndMaxGlobalCoords( fieldVariable, globalMin, globalMax );
FieldVariable_GetMinAndMaxLocalCoords( fieldVariable, min, max );
@@ -241,22 +275,20 @@ void lucScalarFieldCrossSection_DrawCros
}
/* Find position of cross section */
- pos[self->axis] = lucCrossSection_GetValue(self, globalMin[self->axis], globalMax[self->axis]);
+ pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
Journal_DPrintfL( self->debugStream, 2,
"%s called on field %s, with res[A] as %u, res[B] as %u, axis of cross section as %d, crossSection value as %g\n",
- __func__, fieldVariable->name, aResolution, bResolution, self->axis, pos[self->axis]);
+ __func__, fieldVariable->name, aResolution, bResolution, axis, pos[axis]);
+
/* Create normal */
- normal[self->axis] = 1.0;
- normal[self->axis1] = 0.0;
- normal[self->axis2] = 0.0;
- /* Flip normal to face opposite direction if cross-section past mid-point in 3d */
- if (fieldVariable->dim == 3 && pos[self->axis] >= globalMin[self->axis] + 0.5 * globalMax[self->axis] - globalMin[self->axis])
- normal[self->axis] = -1.0;
+ normal[axis] = 1.0;
+ normal[aAxis] = 0.0;
+ normal[bAxis] = 0.0;
glNormal3fv( normal );
- aLength = (max[self->axis1] - min[self->axis1])/(double)aResolution;
- bLength = (max[self->axis2] - min[self->axis2])/(double)bResolution;
+ aLength = (max[aAxis] - min[aAxis])/(double)aResolution;
+ bLength = (max[bAxis] - min[bAxis])/(double)bResolution;
Journal_DPrintfL( self->debugStream, 2, "Calculated aLength as %g, bLength as %g\n", aLength, bLength );
@@ -266,40 +298,38 @@ void lucScalarFieldCrossSection_DrawCros
glBegin(GL_QUAD_STRIP);
for ( bIndex = 0 ; bIndex < bResolution + 2 ; bIndex++ ) {
/* Get position */
- pos[ self->axis1 ] = min[ self->axis1 ] + (double)aIndex * aLength;
- pos[ self->axis2 ] = min[ self->axis2 ] + (double)bIndex * bLength;
+ pos[ aAxis ] = min[ aAxis ] + (double)aIndex * aLength;
+ pos[ bAxis ] = min[ bAxis ] + (double)bIndex * bLength;
memcpy( interpolationCoord, pos, sizeof(Coord) );
- if ( pos[ self->axis2 ] >= max[ self->axis2 ] ) {
- pos[ self->axis2 ] = max[ self->axis2 ];
- interpolationCoord[ self->axis2 ] = max[ self->axis2 ] - FUDGE_FACTOR/bLength;
+ if ( pos[ bAxis ] >= max[ bAxis ] ) {
+ pos[ bAxis ] = max[ bAxis ];
+ interpolationCoord[ bAxis ] = max[ bAxis ] - FUDGE_FACTOR/bLength;
}
- if (pos[ self->axis1 ] >= max[ self->axis1 ]) {
- pos[ self->axis1 ] = max[ self->axis1 ];
- interpolationCoord[ self->axis1 ] = max[ self->axis1 ] - FUDGE_FACTOR/aLength;
+ if (pos[ aAxis ] >= max[ aAxis ]) {
+ pos[ aAxis ] = max[ aAxis ];
+ interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
}
/* Plot bottom left corner of coloured tile */
lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
/* Plot top left corner of coloured tile */
- pos[ self->axis1 ] += aLength;
- if (pos[ self->axis1 ] >= max[ self->axis1 ]) {
- pos[ self->axis1 ] = max[ self->axis1 ];
- interpolationCoord[ self->axis1 ] = max[ self->axis1 ] - FUDGE_FACTOR/aLength;
+ pos[ aAxis ] += aLength;
+ if (pos[ aAxis ] >= max[ aAxis ]) {
+ pos[ aAxis ] = max[ aAxis ];
+ interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
}
else
- interpolationCoord[ self->axis1 ] = pos[ self->axis1 ];
+ interpolationCoord[ aAxis ] = pos[ aAxis ];
lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
}
glEnd();
}
- glEnable(GL_LIGHTING);
- glEnable(GL_CULL_FACE);
- glFrontFace(GL_CCW);
+ glEnable(GL_LIGHTING);
}
Bool lucScalarFieldCrossSection_PlotColouredVertex( void* drawingObject, Coord interpolationCoord, Coord plotCoord ) {
@@ -309,43 +339,27 @@ Bool lucScalarFieldCrossSection_PlotColo
lucColourMap* cmap = self->colourMap;
double quantity;
-// static double ttime1, ttime2;
-// double time2, time1 = MPI_Wtime();
-
Journal_DPrintfL( self->debugStream, 3, "%s called at interpolationCoord (%g,%g,%g) - ",
__func__, interpolationCoord[0], interpolationCoord[1], interpolationCoord[2] );
/* Interpolate value to this position */
result = FieldVariable_InterpolateValueAt( fieldVariable, interpolationCoord, &quantity );
-// ttime1 += (MPI_Wtime() - time1);
-// time2 = MPI_Wtime();
-
if ( LOCAL == result || SHADOW == result ) {
/* Get colour for this value from colour map */
lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
Journal_DPrintfL( self->debugStream, 3, "%s is %g there.\n", fieldVariable->name, quantity );
- Journal_DPrintfL( self->debugStream, 3, "Plotting At Vertex (%g,%g,%g).\n", plotCoord[0], plotCoord[1], plotCoord[2] );
+
+ Journal_DPrintfL( self->debugStream, 3, "Plotting At Vertex (%g,%g,%g).\n",
+ plotCoord[0], plotCoord[1], plotCoord[2] );
/* Plot Vertex */
glVertex3dv(plotCoord);
-// ttime2 += (MPI_Wtime() - time2);
-// fprintf(stderr, "Plotting At Vertex (%g,%g,%g). (ttime1 %f ttime2 %f)\n",
-// plotCoord[0], plotCoord[1], plotCoord[2] , ttime1, ttime2);
-
return True;
}
-// ttime2 += (MPI_Wtime() - time2);
-// fprintf( stderr, "%s NOT FOUND THERE. (ttime1 %f ttime2 %f)\n", fieldVariable->name, ttime1, ttime2);
-
- if (self->context->nproc == 1)
- Journal_DPrintfL( self->errorStream, 3,
- "%s Could not interpolate value at %f,%f,%f, returned OTHER_PROC yet running on 1 processor!\n",
- fieldVariable->name, interpolationCoord[0], interpolationCoord[1], interpolationCoord[2] );
-
- Journal_DPrintfL( self->debugStream, 3, "%s InterpolateValueAt: NOT FOUND.\n", fieldVariable->name );
+ Journal_DPrintfL( self->debugStream, 3, "%s NOT FOUND THERE.\n", fieldVariable->name );
/* If value could not be interpolated return warning */
return False;
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldCrossSection.h
--- a/DrawingObjects/src/ScalarFieldCrossSection.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldCrossSection.h Fri Feb 05 12:57:55 2010 -0800
@@ -43,7 +43,7 @@
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "CrossSection.h"
+#include <glucifer/Base/CrossSection.h>
#ifndef __lucScalarFieldCrossSection_h__
#define __lucScalarFieldCrossSection_h__
@@ -54,14 +54,16 @@
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
#define __lucScalarFieldCrossSection \
/* Macro defining parent goes here - This means you can cast this class as its parent */ \
- __lucCrossSection \
+ __lucOpenGLDrawingObject \
/* Virtual functions go here */ \
/* Other info */\
+ FieldVariable* fieldVariable; \
+ Name fieldVariableName; \
lucColourMap* colourMap; \
IJK resolution; \
+ lucCrossSection* crossSection; \
XYZ minCropValues; \
XYZ maxCropValues; \
- Bool cullFace; \
struct lucScalarFieldCrossSection { __lucScalarFieldCrossSection };
@@ -72,10 +74,10 @@
#endif
#define LUCSCALARFIELDCROSSSECTION_DEFARGS \
- LUCCROSSSECTION_DEFARGS
+ LUCOPENGLDRAWINGOBJECT_DEFARGS
#define LUCSCALARFIELDCROSSSECTION_PASSARGS \
- LUCCROSSSECTION_PASSARGS
+ LUCOPENGLDRAWINGOBJECT_PASSARGS
lucScalarFieldCrossSection* _lucScalarFieldCrossSection_New( LUCSCALARFIELDCROSSSECTION_DEFARGS );
@@ -92,9 +94,12 @@
void _lucScalarFieldCrossSection_Destroy( void* drawingObject, void* data ) ;
void _lucScalarFieldCrossSection_Setup( void* drawingObject, void* _context ) ;
+ void _lucScalarFieldCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucScalarFieldCrossSection_CleanUp( void* drawingObject, void* _context ) ;
+
void _lucScalarFieldCrossSection_BuildDisplayList( void* drawingObject, void* _context ) ;
- void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, int direction );
+ void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, lucCrossSection* crossSection );
Bool lucScalarFieldCrossSection_PlotColouredVertex( void* drawingObject, Coord interpolationCoord, Coord plotCoord ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldCrossSection.meta
--- a/DrawingObjects/src/ScalarFieldCrossSection.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldCrossSection.meta Fri Feb 05 12:57:55 2010 -0800
@@ -10,7 +10,7 @@
<param name="Project Web">http://mcc.monash.edu.au/gLucifer</param>
<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">lucCrossSection</param>
+<param name="Parent">lucOpenGLDrawingObject</param>
<param name="Reference"></param>
<param name="Summary"></param>
<param name="Description">Tiles a plane with colours derived from the value of a scalar field at the vertex of each tile.</param>
@@ -23,7 +23,7 @@
<param name="Name">resolution</param>
<param name="Type">UnsignedInt</param>
<param name="Default">128</param>
- <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of verticies in each direction.</param>
+ <param name="Description">The default value for the resolutionX, resolutionY and resolutionZ. If these values aren't set the sampling grid will be uniform with this number of vertices in each direction.</param>
</struct>
<struct>
<param name="Name">resolutionX</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldOnMesh.c
--- a/DrawingObjects/src/ScalarFieldOnMesh.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldOnMesh.c Fri Feb 05 12:57:55 2010 -0800
@@ -78,8 +78,11 @@ lucScalarFieldOnMesh* _lucScalarFieldOnM
return self;
}
-void _lucScalarFieldOnMesh_Init( lucScalarFieldOnMesh* self)
+void _lucScalarFieldOnMesh_Init(
+ lucScalarFieldOnMesh* self,
+ Bool cullFace )
{
+ self->cullFace = cullFace;
}
void _lucScalarFieldOnMesh_Delete( void* drawingObject ) {
@@ -94,6 +97,19 @@ void _lucScalarFieldOnMesh_Print( void*
_lucScalarFieldOnMeshCrossSection_Print( self, stream );
}
+void* _lucScalarFieldOnMesh_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+ lucScalarFieldOnMesh* newDrawingObject;
+
+ newDrawingObject = _lucScalarFieldOnMeshCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
+
void* _lucScalarFieldOnMesh_DefaultNew( Name name ) {
/* Variables set in this function */
SizeT _sizeOfSelf = sizeof(lucScalarFieldOnMesh);
@@ -103,13 +119,13 @@ void* _lucScalarFieldOnMesh_DefaultNew(
Stg_Class_CopyFunction* _copy = NULL;
Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucScalarFieldOnMesh_DefaultNew;
Stg_Component_ConstructFunction* _construct = _lucScalarFieldOnMesh_AssignFromXML;
- Stg_Component_BuildFunction* _build = _lucScalarFieldOnMeshCrossSection_Build;
- Stg_Component_InitialiseFunction* _initialise = _lucScalarFieldOnMeshCrossSection_Initialise;
- Stg_Component_ExecuteFunction* _execute = _lucScalarFieldOnMeshCrossSection_Execute;
- Stg_Component_DestroyFunction* _destroy = _lucScalarFieldOnMeshCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucScalarFieldOnMeshCrossSection_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucOpenGLDrawingObject_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ Stg_Component_BuildFunction* _build = _lucScalarFieldOnMesh_Build;
+ Stg_Component_InitialiseFunction* _initialise = _lucScalarFieldOnMesh_Initialise;
+ Stg_Component_ExecuteFunction* _execute = _lucScalarFieldOnMesh_Execute;
+ Stg_Component_DestroyFunction* _destroy = _lucScalarFieldOnMesh_Destroy;
+ lucDrawingObject_SetupFunction* _setup = _lucScalarFieldOnMesh_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucScalarFieldOnMesh_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucScalarFieldOnMesh_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucScalarFieldOnMesh_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -124,7 +140,42 @@ void _lucScalarFieldOnMesh_AssignFromXML
/* Construct Parent */
_lucScalarFieldOnMeshCrossSection_AssignFromXML( self, cf, data );
- _lucScalarFieldOnMesh_Init(self);
+ _lucScalarFieldOnMesh_Init(
+ self,
+ Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True ) );
+}
+
+void _lucScalarFieldOnMesh_Build( void* drawingObject, void* data ) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+
+ /* Call parent function */
+ _lucScalarFieldOnMeshCrossSection_Build( self, data );
+}
+void _lucScalarFieldOnMesh_Initialise( void* drawingObject, void* data ) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+
+ /* Call parent function */
+ _lucScalarFieldOnMeshCrossSection_Initialise( self, data );
+}
+void _lucScalarFieldOnMesh_Execute( void* drawingObject, void* data ) {}
+void _lucScalarFieldOnMesh_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarFieldOnMesh_Setup( void* drawingObject, void* _context ) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+
+ _lucScalarFieldOnMeshCrossSection_Setup( self, _context );
+}
+
+void _lucScalarFieldOnMesh_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+
+ _lucScalarFieldOnMeshCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucScalarFieldOnMesh_CleanUp( void* drawingObject, void* _context ) {
+ lucScalarFieldOnMesh* self = (lucScalarFieldOnMesh*)drawingObject;
+
+ _lucScalarFieldOnMeshCrossSection_CleanUp( self, _context );
}
void _lucScalarFieldOnMesh_BuildDisplayList( void* drawingObject, void* _context ) {
@@ -136,20 +187,23 @@ void _lucScalarFieldOnMesh_BuildDisplayL
vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
if (fieldVariable->dim == 2) {
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, False), GL_CCW);
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
}
else {
- /* Cross sections at minimums, default winding for faces */
- self->flipNormals = False;
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, I_AXIS, False), GL_CCW);
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, J_AXIS, False), GL_CCW);
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, False), GL_CCW);
+ if ( self->cullFace )
+ glEnable(GL_CULL_FACE);
+
+ glFrontFace(GL_CCW);
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, I_AXIS );
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ J_AXIS ] - 1, J_AXIS );
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
+
+ glFrontFace(GL_CW);
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ I_AXIS ] - 1, I_AXIS );
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, J_AXIS );
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ K_AXIS ] - 1, K_AXIS );
- /* Cross sections at maximums, reverse winding for faces and flip normals to face backwards */
- self->flipNormals = True;
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, vertGrid->sizes[ I_AXIS ] - 1, I_AXIS, False), GL_CW);
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, vertGrid->sizes[ J_AXIS ] - 1, J_AXIS, False), GL_CW);
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( lucCrossSection_Set(self, vertGrid->sizes[ K_AXIS ] - 1, K_AXIS, False), GL_CW);
+ glDisable(GL_CULL_FACE);
}
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldOnMesh.h
--- a/DrawingObjects/src/ScalarFieldOnMesh.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldOnMesh.h Fri Feb 05 12:57:55 2010 -0800
@@ -56,6 +56,7 @@
__lucScalarFieldOnMeshCrossSection \
/* Virtual functions go here */ \
/* Other info */\
+ Bool cullFace; \
struct lucScalarFieldOnMesh { __lucScalarFieldOnMesh };
@@ -75,10 +76,19 @@
void _lucScalarFieldOnMesh_Delete( void* drawingObject ) ;
void _lucScalarFieldOnMesh_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucScalarFieldOnMesh_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucScalarFieldOnMesh_DefaultNew( Name name ) ;
void _lucScalarFieldOnMesh_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
+ void _lucScalarFieldOnMesh_Build( void* drawingObject, void* data ) ;
+ void _lucScalarFieldOnMesh_Initialise( void* drawingObject, void* data ) ;
+ void _lucScalarFieldOnMesh_Execute( void* drawingObject, void* data );
+ void _lucScalarFieldOnMesh_Destroy( void* drawingObject, void* data ) ;
+
+ void _lucScalarFieldOnMesh_Setup( void* drawingObject, void* _context ) ;
+ void _lucScalarFieldOnMesh_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucScalarFieldOnMesh_CleanUp( void* drawingObject, void* _context ) ;
void _lucScalarFieldOnMesh_BuildDisplayList( void* drawingObject, void* _context ) ;
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldOnMeshCrossSection.c
--- a/DrawingObjects/src/ScalarFieldOnMeshCrossSection.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldOnMeshCrossSection.c Fri Feb 05 12:57:55 2010 -0800
@@ -58,7 +58,7 @@
#include <glucifer/RenderingEngines/RenderingEngines.h>
#include "types.h"
-#include "CrossSection.h"
+#include "OpenGLDrawingObject.h"
#include "ScalarFieldOnMeshCrossSection.h"
#include <assert.h>
@@ -77,38 +77,53 @@ lucScalarFieldOnMeshCrossSection* _lucSc
/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
assert( _sizeOfSelf >= sizeof(lucScalarFieldOnMeshCrossSection) );
- self = (lucScalarFieldOnMeshCrossSection*) _lucCrossSection_New( LUCCROSSSECTION_PASSARGS );
+ self = (lucScalarFieldOnMeshCrossSection*) _lucOpenGLDrawingObject_New( LUCOPENGLDRAWINGOBJECT_PASSARGS );
return self;
}
void _lucScalarFieldOnMeshCrossSection_Init(
lucScalarFieldOnMeshCrossSection* self,
+ Name fieldVariableName,
lucColourMap* colourMap,
+ Node_Index crossSection_I,
+ Axis crossSectionAxis,
XYZ minCropValues,
- XYZ maxCropValues,
- Bool wireFrame,
- Bool cullFace )
+ XYZ maxCropValues )
{
+// self->fieldVariable = fieldVariable;
+ self->fieldVariableName = fieldVariableName;
self->colourMap = colourMap;
- self->cullFace = cullFace;
- self->wireFrame = wireFrame;
+ self->crossSection_I = crossSection_I;
+ self->crossSectionAxis = crossSectionAxis;
memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
- self->flipNormals = False;
}
void _lucScalarFieldOnMeshCrossSection_Delete( void* drawingObject ) {
lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
- _lucCrossSection_Delete( self );
+ _lucOpenGLDrawingObject_Delete( self );
}
void _lucScalarFieldOnMeshCrossSection_Print( void* drawingObject, Stream* stream ) {
lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
- _lucCrossSection_Print( self, stream );
+ _lucOpenGLDrawingObject_Print( self, stream );
}
+
+void* _lucScalarFieldOnMeshCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+ lucScalarFieldOnMeshCrossSection* newDrawingObject;
+
+ newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
void* _lucScalarFieldOnMeshCrossSection_DefaultNew( Name name ) {
/* Variables set in this function */
@@ -124,8 +139,8 @@ void* _lucScalarFieldOnMeshCrossSection_
Stg_Component_ExecuteFunction* _execute = _lucScalarFieldOnMeshCrossSection_Execute;
Stg_Component_DestroyFunction* _destroy = _lucScalarFieldOnMeshCrossSection_Destroy;
lucDrawingObject_SetupFunction* _setup = _lucScalarFieldOnMeshCrossSection_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucCrossSection_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ lucDrawingObject_DrawFunction* _draw = _lucScalarFieldOnMeshCrossSection_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucScalarFieldOnMeshCrossSection_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucScalarFieldOnMeshCrossSection_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -137,14 +152,30 @@ void _lucScalarFieldOnMeshCrossSection_A
void _lucScalarFieldOnMeshCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
lucColourMap* colourMap;
+ char axisChar;
+ Node_Index value = 0;
+ Axis axis = 0;
+ Name crossSectionName;
+ Name fieldVariableName;
XYZ minCropValues;
XYZ maxCropValues;
- Bool wireFrame, cullFace;
/* Construct Parent */
- _lucCrossSection_AssignFromXML( self, cf, data );
+ _lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+ fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName" );
+
+ /* This variable is now constructed in the build phase
+ fieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
+ */
+
colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data );
+
+ crossSectionName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"crossSection", "" );
+ if ( sscanf( crossSectionName, "%c=%d", &axisChar, &value ) == 2 ) {
+ if ( toupper( axisChar ) >= 'X' )
+ axis = toupper( axisChar ) - 'X';
+ }
/* Get Values with which to crop the cross section */
minCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropX", -HUGE_VAL );
@@ -153,16 +184,15 @@ void _lucScalarFieldOnMeshCrossSection_A
maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL );
maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL );
maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL );
- wireFrame = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireFrame", False );
- cullFace = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True );
_lucScalarFieldOnMeshCrossSection_Init(
self,
+ fieldVariableName,
colourMap,
+ value,
+ axis,
minCropValues,
- maxCropValues,
- wireFrame,
- cullFace );
+ maxCropValues );
}
void _lucScalarFieldOnMeshCrossSection_Build( void* drawingObject, void* data ) {
@@ -171,8 +201,10 @@ void _lucScalarFieldOnMeshCrossSection_B
Mesh* mesh;
Stream* errorStream = Journal_Register( Error_Type, (Name)self->type );
- /* Build field variable in parent */
- _lucCrossSection_Build(self, data);
+
+ /* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
+ feVariable = Stg_ComponentFactory_ConstructByName( self->context->CF, (Name)self->fieldVariableName, FeVariable, True, 0 /* dummy */ );
+ self->fieldVariable = (FieldVariable* ) feVariable;
Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
@@ -180,8 +212,8 @@ void _lucScalarFieldOnMeshCrossSection_B
"magnitude of the given field?\n", __func__, self->fieldVariable->name,
self->fieldVariable->fieldComponentCount, self->type );
- feVariable = (FeVariable*)self->fieldVariable;
- mesh = (Mesh*)feVariable->feMesh;
+ Stg_Component_Build( feVariable, data, False );
+ mesh = (Mesh*) feVariable->feMesh;
/* Store the Vertex Grid */
self->vertexGridHandle = ExtensionManager_GetHandle( mesh->info, (Name)"vertexGrid" );
@@ -204,174 +236,98 @@ void _lucScalarFieldOnMeshCrossSection_S
_lucOpenGLDrawingObject_Setup( self, _context );
}
+void _lucScalarFieldOnMeshCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+ _lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucScalarFieldOnMeshCrossSection_CleanUp( void* drawingObject, void* _context ) {
+ lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+ _lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
void _lucScalarFieldOnMeshCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
- lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, GL_CCW);
+ lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, self->crossSection_I, self->crossSectionAxis );
}
-void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, MeshVertex* vert) {
+void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, Node_LocalIndex crossSection_I, Axis axis ) {
lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+ FeVariable* fieldVariable = (FeVariable*) self->fieldVariable;
+ Mesh* mesh = (Mesh*) fieldVariable->feMesh;
+ Axis aAxis;
+ Axis bAxis;
+ Grid* vertGrid;
+ IJK node_ijk;
+ float normal[3];
+ Node_GlobalIndex node_gI;
+ Node_DomainIndex node_dI_1, node_dI_2;
+ Node_DomainIndex nDomainNodes;
- /* Get colour for vertex */
- lucColourMap_SetOpenGLColourFromValue( self->colourMap, vert->value);
-
- if (!self->wireFrame && self->fieldVariable->dim == 3)
- glNormal3dv(vert->normal);
-
- /* Plot vertex */
- if ( self->fieldVariable->dim == 2 )
- glVertex2dv( vert->pos );
- else
- glVertex3dv( vert->pos );
-}
-
-Bool lucMeshVertex_SumNormal( double normal[3], MeshVertex* v1, MeshVertex* v2, MeshVertex* v3, Bool flip) {
- /* Utility function for calculating per vertex normals, pass vertices of four triangles
- * surrounding the vertex you want to calculate the normal for and they will be summed */
- double tempnormal[3];
- if (v1 == NULL || v2 == NULL || v3 == NULL) return False;
- StGermain_NormalToPlane( tempnormal, v1->pos, v2->pos, v3->pos);
- if (flip == False) {
- normal[0] += tempnormal[0];
- normal[1] += tempnormal[1];
- normal[2] += tempnormal[2];
- } else {
- normal[0] -= tempnormal[0];
- normal[1] -= tempnormal[1];
- normal[2] -= tempnormal[2];
- }
- return True;
-}
-
-void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, int direction ) {
- lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
- FeVariable* fieldVariable = (FeVariable*) self->fieldVariable;
- Mesh* mesh = (Mesh*) fieldVariable->feMesh;
- Node_LocalIndex crossSection_I = self->value;
- Grid* vertGrid;
- IJK node_ijk;
- Node_GlobalIndex node_gI;
- Node_DomainIndex node_dI;
- Node_DomainIndex nDomainNodes;
- int i,j;
-
+ glDisable(GL_LIGHTING);
+
+ /* Get Axis Directions */
+ aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
+ bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
+
vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
Journal_DPrintfL( self->debugStream, 2,
"%s called on field %s, with axis of cross section as %d, crossSection_I as %d\n",
- __func__, fieldVariable->name, self->axis, crossSection_I );
+ __func__, fieldVariable->name, axis, crossSection_I );
+ /* Create normal */
+ normal[axis] = 1.0;
+ normal[aAxis] = 0.0;
+ normal[bAxis] = 0.0;
+ glNormal3fv( normal );
+
nDomainNodes = Mesh_GetDomainSize( mesh, MT_VERTEX );
- /* set polygon face winding */
- glFrontFace(direction);
- /* Visible from both sides? */
- if ( self->cullFace )
- glEnable(GL_CULL_FACE);
- else
- glDisable(GL_CULL_FACE);
-
- if (self->wireFrame) {
- /* Edges only */
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_LIGHTING);
- } else {
- /* Filled */
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glEnable(GL_LIGHTING);
- }
-
- /* Get mesh cross section vertices */
- MeshVertex* vertices[ vertGrid->sizes[ self->axis1 ] ] [ vertGrid->sizes[ self->axis2 ] ];
- node_ijk[ self->axis ] = crossSection_I;
- for ( i = 0 ; i < vertGrid->sizes[ self->axis1 ]; i++ ) {
- node_ijk[ self->axis1 ] = i;
- for ( j = 0 ; j < vertGrid->sizes[ self->axis2 ]; j++ ) {
- node_ijk[ self->axis2 ] = j;
+ /* Plots cross section */
+ node_ijk[ axis ] = crossSection_I;
+ for ( node_ijk[ aAxis ] = 0 ; node_ijk[ aAxis ] < vertGrid->sizes[ aAxis ] - 1 ; node_ijk[ aAxis ]++ ) {
+ glBegin(GL_QUAD_STRIP);
+ for ( node_ijk[ bAxis ] = 0 ; node_ijk[ bAxis ] < vertGrid->sizes[ bAxis ] ; node_ijk[ bAxis ]++ ) {
node_gI = Grid_Project( vertGrid, node_ijk );
/* Get Local Node Index */
- if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI ) || node_dI >= nDomainNodes ) {
- vertices[i][j] = NULL; /* Flag not on this proc */
- continue;
- }
+ if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_1 ) || node_dI_1 >= nDomainNodes ){
+ continue;
+ }
+
+ node_ijk[ aAxis ]++;
+ node_gI = Grid_Project( vertGrid, node_ijk );
+ /* Get Local Node Index */
+ if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_2 ) || node_dI_2 >= nDomainNodes ){
+ continue;
+ }
+ lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_1 );
+ lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_2 );
+ node_ijk[ aAxis ]--;
- vertices[i][j] = Memory_Alloc(MeshVertex, "Mesh Vertex");
- FeVariable_GetValueAtNode( fieldVariable, node_dI, &vertices[i][j]->value );
- memcpy( &vertices[i][j]->pos, fieldVariable->feMesh->verts[node_dI], 3 * sizeof(double) );
- vertices[i][j]->normal[0] = vertices[i][j]->normal[1] = vertices[i][j]->normal[2] = 0; /* Zero normal */
+ /* TODO Cropping */
}
+ glEnd();
}
-
- /* Calc normals for irregular meshes per vertex by averaging four surrounding triangle normals */
- if (!self->wireFrame && self->fieldVariable->dim == 3) {
- for ( i = 0 ; i < vertGrid->sizes[ self->axis1 ]; i++ ) {
- for ( j = 0 ; j < vertGrid->sizes[ self->axis2 ]; j++ ) {
- /* Get sum of normal vectors */
- if (vertices[i][j] == NULL) continue;
-
- if (i > 0) {
- if (j > 0)
- /* Look back in both axis \| */
- lucMeshVertex_SumNormal(vertices[i][j]->normal, vertices[i][j], vertices[i-1][j], vertices[i][j-1], self->flipNormals);
-
- if (j < vertGrid->sizes[ self->axis2 ] - 1)
- /* Look back in self->axis1, forward in self->axis2 /| */
- lucMeshVertex_SumNormal(vertices[i][j]->normal, vertices[i][j], vertices[i][j+1], vertices[i-1][j], self->flipNormals);
- }
-
- if (i < vertGrid->sizes[ self->axis1 ] - 1) {
- if (j > 0)
- /* Look forward in self->axis1, back in self->axis2 |/ */
- lucMeshVertex_SumNormal(vertices[i][j]->normal, vertices[i][j], vertices[i][j-1], vertices[i+1][j], self->flipNormals);
-
- if (j < vertGrid->sizes[ self->axis2 ] - 1)
- /* Look forward both axis |\ */
- lucMeshVertex_SumNormal(vertices[i][j]->normal, vertices[i][j], vertices[i+1][j], vertices[i][j+1], self->flipNormals);
- }
-
- StGermain_VectorNormalise(vertices[i][j]->normal, 3);
- }
- }
- } else {
- /* Default plane normal */
- double normal[3];
- normal[self->axis1] = 0.0;
- normal[self->axis2] = 0.0;
- normal[self->axis] = 1.0;
- if (self->flipNormals == True) normal[self->axis] = -1.0;
- glNormal3dv(normal);
- }
-
- /* Plot quad strip vertices */
- for ( i = 0 ; i < vertGrid->sizes[ self->axis1 ]; i++ ) {
- glBegin(GL_QUAD_STRIP);
- for ( j = 0 ; j < vertGrid->sizes[ self->axis2 ]; j++ ) {
- if (vertices[i][j] != NULL) {
- if (i+1 < vertGrid->sizes[ self->axis1 ] && vertices[i+1][j] != NULL) {
- lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, vertices[i][j]);
- lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, vertices[i+1][j]);
- /* TODO Cropping - implement cropping for all in generic CrossSection object? */
- }
- Memory_Free(vertices[i][j]);
- }
- }
- glEnd();
- }
-
- glEnable(GL_LIGHTING);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- glEnable(GL_CULL_FACE);
- glFrontFace(GL_CCW);
-
- /* Plot normals - for debugging /
- for ( i = 0 ; i < vertGrid->sizes[ self->axis1 ]; i++ ) {
- for ( j = 0 ; j < vertGrid->sizes[ self->axis2 ]; j++ ) {
- if (vertices[i][j] != NULL) {
- luc_DrawNormalVector( vertices[i][j]->pos, vertices[i][j]->normal, 1000.0);
- Memory_Free(vertices[i][j]);
- }
- }
- }*/
+ glEnable(GL_LIGHTING);
}
+void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, Node_LocalIndex lNode_I ) {
+ lucScalarFieldOnMeshCrossSection* self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+ FeVariable* fieldVariable = (FeVariable*) self->fieldVariable;
+ lucColourMap* cmap = self->colourMap;
+ double quantity;
+
+ /* Get colour for vertex */
+ FeVariable_GetValueAtNode( fieldVariable, lNode_I, &quantity );
+ lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
+
+ /* Plot vertex */
+ if ( fieldVariable->dim == 2 )
+ glVertex2dv( fieldVariable->feMesh->verts[lNode_I] );
+ else
+ glVertex3dv( fieldVariable->feMesh->verts[lNode_I] );
+}
+
+
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldOnMeshCrossSection.h
--- a/DrawingObjects/src/ScalarFieldOnMeshCrossSection.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldOnMeshCrossSection.h Fri Feb 05 12:57:55 2010 -0800
@@ -43,16 +43,9 @@
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "CrossSection.h"
#ifndef __lucScalarFieldOnMeshCrossSection_h__
#define __lucScalarFieldOnMeshCrossSection_h__
-
-typedef struct {
- double value;
- double pos[3];
- double normal[3];
-} MeshVertex;
/** Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
extern const Type lucScalarFieldOnMeshCrossSection_Type;
@@ -60,16 +53,17 @@ typedef struct {
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
#define __lucScalarFieldOnMeshCrossSection \
/* Macro defining parent goes here - This means you can cast this class as its parent */ \
- __lucCrossSection \
+ __lucOpenGLDrawingObject \
/* Virtual functions go here */ \
/* Other info */\
+ FieldVariable* fieldVariable; \
+ Name fieldVariableName; \
lucColourMap* colourMap; \
+ Node_Index crossSection_I; \
+ Axis crossSectionAxis; \
XYZ minCropValues; \
XYZ maxCropValues; \
- Bool cullFace; \
- Bool wireFrame; \
ExtensionInfo_Index vertexGridHandle; \
- Bool flipNormals; \
struct lucScalarFieldOnMeshCrossSection { __lucScalarFieldOnMeshCrossSection };
@@ -80,15 +74,16 @@ typedef struct {
#endif
#define LUCSCALARFIELDONMESHCROSSSECTION_DEFARGS \
- LUCCROSSSECTION_DEFARGS
+ LUCOPENGLDRAWINGOBJECT_DEFARGS
#define LUCSCALARFIELDONMESHCROSSSECTION_PASSARGS \
- LUCCROSSSECTION_PASSARGS
+ LUCOPENGLDRAWINGOBJECT_PASSARGS
lucScalarFieldOnMeshCrossSection* _lucScalarFieldOnMeshCrossSection_New( LUCSCALARFIELDONMESHCROSSSECTION_DEFARGS );
void _lucScalarFieldOnMeshCrossSection_Delete( void* drawingObject ) ;
void _lucScalarFieldOnMeshCrossSection_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucScalarFieldOnMeshCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucScalarFieldOnMeshCrossSection_DefaultNew( Name name ) ;
@@ -99,11 +94,15 @@ typedef struct {
void _lucScalarFieldOnMeshCrossSection_Destroy( void* drawingObject, void* data ) ;
void _lucScalarFieldOnMeshCrossSection_Setup( void* drawingObject, void* _context ) ;
+ void _lucScalarFieldOnMeshCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucScalarFieldOnMeshCrossSection_CleanUp( void* drawingObject, void* _context ) ;
+
void _lucScalarFieldOnMeshCrossSection_BuildDisplayList( void* drawingObject, void* _context ) ;
- void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, int direction ) ;
+ void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, Node_LocalIndex crossSection_I, Axis axis ) ;
Bool lucScalarFieldOnMeshCrossSection_PlotColouredVertex( void* drawingObject, Coord interpolationCoord, Coord plotCoord ) ;
- void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, MeshVertex* vert);
+ void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, Node_LocalIndex lNode_I ) ;
+
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/ScalarFieldOnMeshCrossSection.meta
--- a/DrawingObjects/src/ScalarFieldOnMeshCrossSection.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/ScalarFieldOnMeshCrossSection.meta Fri Feb 05 12:57:55 2010 -0800
@@ -10,7 +10,7 @@
<param name="Project Web">http://mcc.monash.edu.au/gLucifer</param>
<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">lucCrossSection</param>
+<param name="Parent">lucOpenGLDrawingObject</param>
<param name="Reference"></param>
<param name="Summary"></param>
<param name="Description">Tiles a plane with colours derived from the value of a scalar field at the vertex of each tile.</param>
@@ -58,12 +58,6 @@
<param name="Default">+infinity</param>
<param name="Description">The maximum z value that it'll plot for this cross-secion.</param>
</struct>
- <struct>
- <param name="Name">wireFrame</param>
- <param name="Type">Bool</param>
- <param name="Default">False</param>
- <param name="Description">Draw a wireframe mesh only, don't fill in.</param>
- </struct>
</list>
<list name="Dependencies">
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/TextureMap.c
--- a/DrawingObjects/src/TextureMap.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/TextureMap.c Fri Feb 05 12:57:55 2010 -0800
@@ -59,6 +59,14 @@
#include <glu.h>
#include <string.h>
+#ifdef HAVE_TIFF
+#include <tiffio.h>
+#endif
+
+#ifdef HAVE_LIBJPEG
+#include <jpeglib.h>
+#endif
+
#ifndef MASTER
#define MASTER 0
#endif
@@ -78,6 +86,12 @@ lucTextureMap* _lucTextureMap_New( LUCT
return self;
}
+
+Bool IsPowerOfTwo (int value)
+{
+ return (value & -value) == value;
+}
+
void _lucTextureMap_Init(
lucTextureMap* self,
@@ -120,6 +134,12 @@ void _lucTextureMap_Init(
/* Open and read Image */
self->inputFormat = lucInputFormat_Register_CreateFromFileName( lucInputFormat_Register_Singleton, imageName );
self->pixelData = lucInputFormat_Input( self->inputFormat, imageName, &self->imageWidth, &self->imageHeight );
+
+ Journal_Firewall( IsPowerOfTwo (self->imageWidth) && IsPowerOfTwo (self->imageHeight),
+ Journal_MyStream( Error_Type, self ),
+ "In func '%s for %s '%s'\n"
+ "Image dimensions (%u x %u) are not in powers of 2 - Cannot create OpenGL texture map.\n",
+ __func__, self->type, self->name, self->imageWidth, self->imageHeight );
}
void _lucTextureMap_Delete( void* drawingObject ) {
@@ -272,7 +292,6 @@ void _lucTextureMap_BuildDisplayList( vo
glFlush();
glDisable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/VectorArrowCrossSection.c
--- a/DrawingObjects/src/VectorArrowCrossSection.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/VectorArrowCrossSection.c Fri Feb 05 12:57:55 2010 -0800
@@ -52,8 +52,10 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
#include "types.h"
-#include "CrossSection.h"
+#include "OpenGLDrawingObject.h"
#include "VectorArrowCrossSection.h"
#include <assert.h>
@@ -76,22 +78,27 @@ lucVectorArrowCrossSection* _lucVectorAr
/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
assert( _sizeOfSelf >= sizeof(lucVectorArrowCrossSection) );
- self = (lucVectorArrowCrossSection*) _lucCrossSection_New( LUCCROSSSECTION_PASSARGS );
+ self = (lucVectorArrowCrossSection*) _lucOpenGLDrawingObject_New( LUCOPENGLDRAWINGOBJECT_PASSARGS );
return self;
}
void _lucVectorArrowCrossSection_Init(
lucVectorArrowCrossSection* self,
+ FieldVariable* vectorVariable,
+ Name colourName,
IJK resolution,
double arrowHeadSize,
double maximum,
Bool dynamicRange,
double lengthScale,
- float lineWidth)
+ float lineWidth,
+ lucCrossSection* crossSection)
{
Stream* errorStream = Journal_MyStream( Error_Type, self );
+ self->vectorVariable = vectorVariable;
+ lucColour_FromString( &self->colour, colourName );
memcpy( self->resolution, resolution, sizeof(IJK) );
self->arrowHeadSize = arrowHeadSize;
Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
@@ -101,18 +108,33 @@ void _lucVectorArrowCrossSection_Init(
self->dynamicRange = dynamicRange;
self->lengthScale = lengthScale;
self->lineWidth = lineWidth;
+ self->crossSection = crossSection;
}
void _lucVectorArrowCrossSection_Delete( void* drawingObject ) {
lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
- _lucCrossSection_Delete( self );
+ lucCrossSection_Delete(self->crossSection);
+ _lucOpenGLDrawingObject_Delete( self );
}
void _lucVectorArrowCrossSection_Print( void* drawingObject, Stream* stream ) {
lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
- _lucCrossSection_Print( self, stream );
+ _lucOpenGLDrawingObject_Print( self, stream );
}
+
+void* _lucVectorArrowCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+ lucVectorArrowCrossSection* newDrawingObject;
+
+ newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
void* _lucVectorArrowCrossSection_DefaultNew( Name name ) {
/* Variables set in this function */
@@ -127,9 +149,9 @@ void* _lucVectorArrowCrossSection_Defaul
Stg_Component_InitialiseFunction* _initialise = _lucVectorArrowCrossSection_Initialise;
Stg_Component_ExecuteFunction* _execute = _lucVectorArrowCrossSection_Execute;
Stg_Component_DestroyFunction* _destroy = _lucVectorArrowCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucOpenGLDrawingObject_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucCrossSection_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ lucDrawingObject_SetupFunction* _setup = _lucVectorArrowCrossSection_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucVectorArrowCrossSection_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucVectorArrowCrossSection_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucVectorArrowCrossSection_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -140,13 +162,14 @@ void* _lucVectorArrowCrossSection_Defaul
void _lucVectorArrowCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+ FieldVariable* vectorVariable;
Index defaultResolution;
IJK resolution;
/* Construct Parent */
- _lucCrossSection_AssignFromXML( self, cf, data );
- strcpy(self->fieldVariableName, "VectorVariable");
+ _lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+ vectorVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VectorVariable", FieldVariable, True, data );
defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8 );
resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution );
resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution );
@@ -154,33 +177,56 @@ void _lucVectorArrowCrossSection_AssignF
_lucVectorArrowCrossSection_Init(
self,
+ vectorVariable,
+ Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black" ),
resolution,
Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3 ),
Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0 ),
Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", True ),
Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3 ),
- (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 ) );
+ (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 ),
+ lucCrossSection_Read(cf, self->name));
+
+
}
-void _lucVectorArrowCrossSection_Build( void* drawingObject, void* data ) {
- /* Build field variable in parent */
- _lucCrossSection_Build(drawingObject, data);
-}
-
+void _lucVectorArrowCrossSection_Build( void* drawingObject, void* data ) {}
void _lucVectorArrowCrossSection_Initialise( void* drawingObject, void* data ) {}
void _lucVectorArrowCrossSection_Execute( void* drawingObject, void* data ) {}
void _lucVectorArrowCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucVectorArrowCrossSection_Setup( void* drawingObject, void* _context ) {
+ lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucVectorArrowCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucVectorArrowCrossSection_CleanUp( void* drawingObject, void* _context ) {
+ lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+
+ _lucOpenGLDrawingObject_CleanUp( self, _context );
+}
void _lucVectorArrowCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
DomainContext* context = (DomainContext*) _context;
- _lucVectorArrowCrossSection_DrawCrossSection( self, context->dim );
+ _lucVectorArrowCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
}
-void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim ) {
+void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
- FieldVariable* vectorVariable = self->fieldVariable;
+ FieldVariable* vectorVariable = self->vectorVariable;
+ Axis axis = crossSection->axis;
+ Axis aAxis = (axis == I_AXIS ? J_AXIS : I_AXIS);
+ Axis bAxis = (axis == K_AXIS ? J_AXIS : K_AXIS);
Coord pos;
XYZ vector;
Coord globalMin;
@@ -198,6 +244,8 @@ void _lucVectorArrowCrossSection_DrawCro
"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
"can only visualse FieldVariables with %d components.\n", __func__, vectorVariable->name,
vectorVariable->fieldComponentCount, self->type, vectorVariable->dim );
+
+ lucOpenGLDrawingObject_SyncShadowValues( self, vectorVariable );
if ( True == self->dynamicRange ) {
scaleValue = 1 / FieldVariable_GetMaxGlobalFieldMagnitude( vectorVariable );
@@ -222,18 +270,18 @@ void _lucVectorArrowCrossSection_DrawCro
glLineWidth(self->lineWidth);
- dA = (globalMax[ self->axis1 ] - globalMin[ self->axis1 ])/(double)self->resolution[ self->axis1 ];
- dB = (globalMax[ self->axis2 ] - globalMin[ self->axis2 ])/(double)self->resolution[ self->axis2 ];
+ dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
+ dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
- pos[self->axis] = lucCrossSection_GetValue(self, globalMin[self->axis], globalMax[self->axis]);
- Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", self->axis, pos[self->axis]);
+ pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
+ Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
- for ( pos[ self->axis1 ] = globalMin[ self->axis1 ] + dA * 0.5 ; pos[ self->axis1 ] < globalMax[ self->axis1 ] ; pos[ self->axis1 ] += dA ) {
- for ( pos[ self->axis2 ] = globalMin[ self->axis2 ] + dB * 0.5 ; pos[ self->axis2 ] < globalMax[ self->axis2 ] ; pos[ self->axis2 ] += dB ) {
+ for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
+ for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
- if ( pos[ self->axis1 ] < localMin[ self->axis1 ] || pos[ self->axis1 ] >= localMax[ self->axis1 ] )
+ if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
continue;
- if ( pos[ self->axis2 ] < localMin[ self->axis2 ] || pos[ self->axis2 ] >= localMax[ self->axis2 ] )
+ if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
continue;
/* Get Value of Vector */
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/VectorArrowCrossSection.h
--- a/DrawingObjects/src/VectorArrowCrossSection.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/VectorArrowCrossSection.h Fri Feb 05 12:57:55 2010 -0800
@@ -43,7 +43,7 @@
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include "CrossSection.h"
+#include <glucifer/Base/CrossSection.h>
#ifndef __lucVectorArrowCrossSection_h__
#define __lucVectorArrowCrossSection_h__
@@ -54,15 +54,18 @@
/** Class contents - this is defined as a macro so that sub-classes of this class can use this macro at the start of the definition of their struct */
#define __lucVectorArrowCrossSection \
/* Macro defining parent goes here - This means you can cast this class as its parent */ \
- __lucCrossSection \
+ __lucOpenGLDrawingObject \
/* Virtual functions go here */ \
/* Other info */\
+ FieldVariable* vectorVariable; \
+ lucColour colour; \
IJK resolution; \
double arrowHeadSize; \
double maximum; \
Bool dynamicRange; \
double lengthScale; \
float lineWidth; \
+ lucCrossSection* crossSection; \
struct lucVectorArrowCrossSection { __lucVectorArrowCrossSection };
@@ -73,15 +76,16 @@
#endif
#define LUCVECTORARROWCROSSSECTION_DEFARGS \
- LUCCROSSSECTION_DEFARGS
+ LUCOPENGLDRAWINGOBJECT_DEFARGS
#define LUCVECTORARROWCROSSSECTION_PASSARGS \
- LUCCROSSSECTION_PASSARGS
+ LUCOPENGLDRAWINGOBJECT_PASSARGS
lucVectorArrowCrossSection* _lucVectorArrowCrossSection_New( LUCVECTORARROWCROSSSECTION_DEFARGS );
void _lucVectorArrowCrossSection_Delete( void* drawingObject ) ;
void _lucVectorArrowCrossSection_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucVectorArrowCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucVectorArrowCrossSection_DefaultNew( Name name ) ;
@@ -91,8 +95,12 @@
void _lucVectorArrowCrossSection_Execute( void* drawingObject, void* data );
void _lucVectorArrowCrossSection_Destroy( void* drawingObject, void* data ) ;
+ void _lucVectorArrowCrossSection_Setup( void* drawingObject, void* _context ) ;
+ void _lucVectorArrowCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucVectorArrowCrossSection_CleanUp( void* drawingObject, void* _context ) ;
+
void _lucVectorArrowCrossSection_BuildDisplayList( void* drawingObject, void* _context ) ;
- void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim );
+ void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection );
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/VectorArrowCrossSection.meta
--- a/DrawingObjects/src/VectorArrowCrossSection.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/VectorArrowCrossSection.meta Fri Feb 05 12:57:55 2010 -0800
@@ -10,7 +10,7 @@
<param name="Project Web">http://mcc.monash.edu.au/gLucifer</param>
<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">lucCrossSection</param>
+<param name="Parent">lucOpenGLDrawingObject</param>
<param name="Reference"></param>
<param name="Summary"></param>
<param name="Description">Samples the values of a vector field in a plane and draws arrows to represent the direction and scaled to represent the magnitude.</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/VectorArrows.c
--- a/DrawingObjects/src/VectorArrows.c Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/VectorArrows.c Fri Feb 05 12:57:55 2010 -0800
@@ -50,6 +50,7 @@
#include <glucifer/Base/Base.h>
#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
#include "types.h"
#include "OpenGLDrawingObject.h"
@@ -91,6 +92,19 @@ void _lucVectorArrows_Print( void* drawi
_lucVectorArrowCrossSection_Print( self, stream );
}
+void* _lucVectorArrows_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+ lucVectorArrows* self = (lucVectorArrows*)drawingObject;
+ lucVectorArrows* newDrawingObject;
+
+ newDrawingObject = _lucVectorArrowCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+ /* TODO */
+ abort();
+
+ return (void*) newDrawingObject;
+}
+
+
void* _lucVectorArrows_DefaultNew( Name name ) {
/* Variables set in this function */
SizeT _sizeOfSelf = sizeof(lucVectorArrows);
@@ -100,13 +114,13 @@ void* _lucVectorArrows_DefaultNew( Name
Stg_Class_CopyFunction* _copy = NULL;
Stg_Component_DefaultConstructorFunction* _defaultConstructor = _lucVectorArrows_DefaultNew;
Stg_Component_ConstructFunction* _construct = _lucVectorArrows_AssignFromXML;
- Stg_Component_BuildFunction* _build = _lucVectorArrowCrossSection_Build;
- Stg_Component_InitialiseFunction* _initialise = _lucVectorArrowCrossSection_Initialise;
- Stg_Component_ExecuteFunction* _execute = _lucVectorArrowCrossSection_Execute;
- Stg_Component_DestroyFunction* _destroy = _lucVectorArrowCrossSection_Destroy;
- lucDrawingObject_SetupFunction* _setup = _lucOpenGLDrawingObject_Setup;
- lucDrawingObject_DrawFunction* _draw = _lucOpenGLDrawingObject_Draw;
- lucDrawingObject_CleanUpFunction* _cleanUp = _lucOpenGLDrawingObject_CleanUp;
+ Stg_Component_BuildFunction* _build = _lucVectorArrows_Build;
+ Stg_Component_InitialiseFunction* _initialise = _lucVectorArrows_Initialise;
+ Stg_Component_ExecuteFunction* _execute = _lucVectorArrows_Execute;
+ Stg_Component_DestroyFunction* _destroy = _lucVectorArrows_Destroy;
+ lucDrawingObject_SetupFunction* _setup = _lucVectorArrows_Setup;
+ lucDrawingObject_DrawFunction* _draw = _lucVectorArrows_Draw;
+ lucDrawingObject_CleanUpFunction* _cleanUp = _lucVectorArrows_CleanUp;
lucOpenGLDrawingObject_BuildDisplayListFunction* _buildDisplayList = _lucVectorArrows_BuildDisplayList;
/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
@@ -124,22 +138,46 @@ void _lucVectorArrows_AssignFromXML( voi
_lucVectorArrows_Init( self );
}
+void _lucVectorArrows_Build( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Initialise( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Execute( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Destroy( void* drawingObject, void* data ) {}
+
+void _lucVectorArrows_Setup( void* drawingObject, void* _context ) {
+ lucVectorArrows* self = (lucVectorArrows*)drawingObject;
+
+ _lucVectorArrowCrossSection_Setup( self, _context );
+}
+
+void _lucVectorArrows_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+ lucVectorArrows* self = (lucVectorArrows*)drawingObject;
+
+ _lucVectorArrowCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucVectorArrows_CleanUp( void* drawingObject, void* _context ) {
+ lucVectorArrows* self = (lucVectorArrows*)drawingObject;
+
+ _lucVectorArrowCrossSection_CleanUp( self, _context );
+}
+
void _lucVectorArrows_BuildDisplayList( void* drawingObject, void* _context ) {
lucVectorArrows* self = (lucVectorArrows*)drawingObject;
DomainContext* context = (DomainContext*) _context;
Dimension_Index dim = context->dim;
+ lucCrossSection crossSection;
if ( dim == 2 )
{
- _lucVectorArrowCrossSection_DrawCrossSection( lucCrossSection_Set(self, 0.0, K_AXIS, False), dim);
+ _lucVectorArrowCrossSection_DrawCrossSection(self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
}
else
{
double dz = 1/(double)self->resolution[ K_AXIS ];
- self->axis = K_AXIS;
- self->interpolate = True;
- for ( self->value = 0.0 ; self->value < 1.0+dz ; self->value += dz) {
- _lucVectorArrowCrossSection_DrawCrossSection( self, dim);
+ crossSection.axis = K_AXIS;
+ crossSection.interpolate = True;
+ for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
+ _lucVectorArrowCrossSection_DrawCrossSection( self, dim, &crossSection);
}
}
}
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/VectorArrows.h
--- a/DrawingObjects/src/VectorArrows.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/VectorArrows.h Fri Feb 05 12:57:55 2010 -0800
@@ -75,11 +75,19 @@
void _lucVectorArrows_Delete( void* drawingObject ) ;
void _lucVectorArrows_Print( void* drawingObject, Stream* stream ) ;
+ void* _lucVectorArrows_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) ;
/* 'Stg_Component' implementations */
void* _lucVectorArrows_DefaultNew( Name name ) ;
void _lucVectorArrows_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data );
+ void _lucVectorArrows_Build( void* drawingObject, void* data ) ;
+ void _lucVectorArrows_Initialise( void* drawingObject, void* data ) ;
+ void _lucVectorArrows_Execute( void* drawingObject, void* data );
+ void _lucVectorArrows_Destroy( void* drawingObject, void* data ) ;
+ void _lucVectorArrows_Setup( void* drawingObject, void* _context ) ;
+ void _lucVectorArrows_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) ;
+ void _lucVectorArrows_CleanUp( void* drawingObject, void* _context ) ;
void _lucVectorArrows_BuildDisplayList( void* drawingObject, void* _context ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 DrawingObjects/src/types.h
--- a/DrawingObjects/src/types.h Tue Jan 19 15:26:41 2010 -0800
+++ b/DrawingObjects/src/types.h Fri Feb 05 12:57:55 2010 -0800
@@ -50,7 +50,6 @@
typedef struct lucOpenGLDrawingObject lucOpenGLDrawingObject;
typedef struct lucFieldVariableBorder lucFieldVariableBorder;
- typedef struct lucCrossSection lucCrossSection;
typedef struct lucScalarFieldCrossSection lucScalarFieldCrossSection;
typedef struct lucScalarField lucScalarField;
typedef struct lucColourBar lucColourBar;
@@ -69,7 +68,7 @@
typedef struct lucHistoricalSwarmTrajectory lucHistoricalSwarmTrajectory;
typedef struct lucSwarmRGBColourViewer lucSwarmRGBColourViewer;
typedef struct lucMeshViewer lucMeshViewer;
- typedef struct lucTitle lucTitle;
+ typedef struct lucTitle lucTitle;
typedef struct lucAxis lucAxis;
typedef struct lucTimeStep lucTimeStep;
typedef struct lucScalarFieldOnMeshCrossSection lucScalarFieldOnMeshCrossSection;
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/EncoderLibavcodec.c
--- a/OutputFormats/src/EncoderLibavcodec.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/EncoderLibavcodec.c Fri Feb 05 12:57:55 2010 -0800
@@ -243,10 +243,7 @@ void _lucEncoderLibavcodec_AssignFromXML
AbstractContext* context;
/* Construct Parent */
- self->extension = "mpeg";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
- self->transparent = False; /* Not supported */
-
+ lucOutputFormat_InitAll( self, "mpeg" );
window = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data ) ;
context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data ) ;
@@ -268,8 +265,7 @@ void _lucEncoderLibavcodec_Execute( void
void _lucEncoderLibavcodec_Execute( void* outputFormat, void* data ) {}
void _lucEncoderLibavcodec_Destroy( void* outputFormat, void* data ) {}
-void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixData ) {
- lucPixel* pixelData = (lucPixel)pixData;
+void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucEncoderLibavcodec* self = (lucEncoderLibavcodec*) outputFormat;
AVFrame* frame = (AVFrame*) self->frame;
Pixel_Index width = window->width;
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/EncoderLibavcodec.h
--- a/OutputFormats/src/EncoderLibavcodec.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/EncoderLibavcodec.h Fri Feb 05 12:57:55 2010 -0800
@@ -92,7 +92,7 @@
void _lucEncoderLibavcodec_Execute( void* outputFormat, void* data );
void _lucEncoderLibavcodec_Destroy( void* outputFormat, void* data ) ;
- void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif /* HAVE_LIBAVCODEC */
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/EncoderLibfame.c
--- a/OutputFormats/src/EncoderLibfame.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/EncoderLibfame.c Fri Feb 05 12:57:55 2010 -0800
@@ -241,9 +241,7 @@ void _lucEncoderLibfame_AssignFromXML( v
AbstractContext* context;
/* Construct Parent */
- self->extension = "mpeg";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
- self->transparent = False; /* Not supported */
+ lucOutputFormat_InitAll( self, "mpeg" );
window = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data ) ;
context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data ) ;
@@ -265,7 +263,7 @@ void _lucEncoderLibfame_Execute( void* o
void _lucEncoderLibfame_Execute( void* outputFormat, void* data ) {}
void _lucEncoderLibfame_Destroy( void* outputFormat, void* data ) {}
-void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucEncoderLibfame* self = (lucEncoderLibfame*) outputFormat;
Pixel_Index width = window->width;
unsigned int quarterpixels = self->quarterpixels;
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/EncoderLibfame.h
--- a/OutputFormats/src/EncoderLibfame.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/EncoderLibfame.h Fri Feb 05 12:57:55 2010 -0800
@@ -100,7 +100,7 @@
void _lucEncoderLibfame_Execute( void* outputFormat, void* data );
void _lucEncoderLibfame_Destroy( void* outputFormat, void* data ) ;
- void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif /* HAVE_LIBFAME */
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputJPEG.c
--- a/OutputFormats/src/OutputJPEG.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputJPEG.c Fri Feb 05 12:57:55 2010 -0800
@@ -133,9 +133,7 @@ void _lucOutputJPEG_AssignFromXML( void*
lucOutputJPEG* self = (lucOutputJPEG*)outputFormat;
/* Construct Parent */
- self->extension = "jpeg";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
- self->transparent = False; /* Not supported */
+ lucOutputFormat_InitAll( self, "jpeg" );
_lucOutputJPEG_Init(
self,
@@ -147,7 +145,7 @@ void _lucOutputJPEG_Execute( void* outpu
void _lucOutputJPEG_Execute( void* outputFormat, void* data ) {}
void _lucOutputJPEG_Destroy( void* outputFormat, void* data ) {}
-void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputJPEG* self = (lucOutputJPEG*) outputFormat;
Pixel_Index width = window->width;
Pixel_Index height = window->height;
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputJPEG.h
--- a/OutputFormats/src/OutputJPEG.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputJPEG.h Fri Feb 05 12:57:55 2010 -0800
@@ -87,7 +87,7 @@
void _lucOutputJPEG_Execute( void* outputFormat, void* data );
void _lucOutputJPEG_Destroy( void* outputFormat, void* data ) ;
- void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputPNG.c
--- a/OutputFormats/src/OutputPNG.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputPNG.c Fri Feb 05 12:57:55 2010 -0800
@@ -128,8 +128,7 @@ void _lucOutputPNG_AssignFromXML( void*
lucOutputPNG* self = (lucOutputPNG*)outputFormat;
/* Construct Parent */
- self->extension = "png";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
+ lucOutputFormat_InitAll( self, "png" );
_lucOutputPNG_Init( self );
}
@@ -151,7 +150,7 @@ void lucImagePNG_Write(png_structp png_p
Journal_Write( stream, (void*) data, 1, length );
}
-void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputPNG* self = (lucOutputPNG*) outputFormat;
Pixel_Index width = window->width;
Pixel_Index height = window->height;
@@ -163,13 +162,7 @@ void _lucOutputPNG_Output( void* outputF
png_infop pngInfo;
Pixel_Index pixel_I;
int result;
- int colour_type = PNG_COLOR_TYPE_RGB;
- if (self->transparent) {
- rowStride = width * 4; /* Don't pad lines! pack alignment is set to 1 */
- colour_type = PNG_COLOR_TYPE_RGBA;
- }
-
for ( pixel_I = 0 ; pixel_I < height ; pixel_I++ )
row_pointers[pixel_I] = (png_bytep) &pixels[rowStride * (height - pixel_I - 1)];
@@ -188,7 +181,7 @@ void _lucOutputPNG_Output( void* outputF
png_set_IHDR(pngWrite, pngInfo,
width, height,
8,
- colour_type,
+ PNG_COLOR_TYPE_RGB,
PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,
PNG_FILTER_TYPE_DEFAULT);
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputPNG.h
--- a/OutputFormats/src/OutputPNG.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputPNG.h Fri Feb 05 12:57:55 2010 -0800
@@ -86,7 +86,7 @@
void _lucOutputPNG_Execute( void* outputFormat, void* data );
void _lucOutputPNG_Destroy( void* outputFormat, void* data ) ;
- void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputPNG.meta
--- a/OutputFormats/src/OutputPNG.meta Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputPNG.meta Fri Feb 05 12:57:55 2010 -0800
@@ -29,7 +29,6 @@
<param name="Example"><![CDATA[
<struct name="imageOutput">
<param name="Type">lucOutputPNG</param>
- <param name="transparent">true</param>
</struct>]]>
</param>
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputPPM.c
--- a/OutputFormats/src/OutputPPM.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputPPM.c Fri Feb 05 12:57:55 2010 -0800
@@ -126,9 +126,7 @@ void _lucOutputPPM_AssignFromXML( void*
lucOutputPPM* self = (lucOutputPPM*)outputFormat;
/* Construct Parent */
- self->extension = "ppm";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
- self->transparent = False; /* Not supported */
+ lucOutputFormat_InitAll( self, "ppm" );
_lucOutputPPM_Init( self );
}
@@ -138,8 +136,7 @@ void _lucOutputPPM_Execute( void* output
void _lucOutputPPM_Execute( void* outputFormat, void* data ) {}
void _lucOutputPPM_Destroy( void* outputFormat, void* data ) {}
-void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixData ) {
- lucPixel* pixelData = (lucPixel*)pixData;
+void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputPPM* self = (lucOutputPPM*)outputFormat;
Pixel_Index windowWidth = window->width;
Pixel_Index windowHeight = window->height;
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputPPM.h
--- a/OutputFormats/src/OutputPPM.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputPPM.h Fri Feb 05 12:57:55 2010 -0800
@@ -86,7 +86,7 @@
void _lucOutputPPM_Execute( void* outputFormat, void* data );
void _lucOutputPPM_Destroy( void* outputFormat, void* data ) ;
- void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputTIFF.c
--- a/OutputFormats/src/OutputTIFF.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputTIFF.c Fri Feb 05 12:57:55 2010 -0800
@@ -130,9 +130,7 @@ void _lucOutputTIFF_AssignFromXML( void*
lucOutputTIFF* self = (lucOutputTIFF*)outputFormat;
/* Construct Parent */
- self->extension = "tiff";
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
- self->transparent = False; /* Not supported */
+ lucOutputFormat_InitAll( self, "tiff" );
_lucOutputTIFF_Init( self );
}
@@ -142,7 +140,7 @@ void _lucOutputTIFF_Execute( void* outpu
void _lucOutputTIFF_Execute( void* outputFormat, void* data ) {}
void _lucOutputTIFF_Destroy( void* outputFormat, void* data ) {}
-void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputTIFF* self = (lucOutputTIFF*) outputFormat;
Pixel_Index width = window->width;
Pixel_Index height = window->height;
@@ -167,7 +165,7 @@ void _lucOutputTIFF_Output( void* output
TIFFSetField(file, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(file, TIFFTAG_IMAGEDESCRIPTION, window->name );
- linePtr = (lucPixel*)pixelData;
+ linePtr = pixelData;
for ( line_I = height - 1; line_I != (Pixel_Index) -1 ; line_I--) {
if (TIFFWriteScanline(file, linePtr, line_I, 0) < 0) {
TIFFClose(file);
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputTIFF.h
--- a/OutputFormats/src/OutputTIFF.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputTIFF.h Fri Feb 05 12:57:55 2010 -0800
@@ -85,7 +85,7 @@
void _lucOutputTIFF_Execute( void* outputFormat, void* data );
void _lucOutputTIFF_Destroy( void* outputFormat, void* data ) ;
- void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputVECTOR.c
--- a/OutputFormats/src/OutputVECTOR.c Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputVECTOR.c Fri Feb 05 12:57:55 2010 -0800
@@ -171,7 +171,7 @@ void _lucOutputVECTOR_AssignFromXML( voi
_lucOutputVECTOR_Init( self, cf );
/* Construct Parent */
- _lucOutputFormat_AssignFromXML( outputFormat, cf, data);
+ lucOutputFormat_InitAll( self, self->format);
}
@@ -180,7 +180,7 @@ void _lucOutputVECTOR_Execute( void* out
void _lucOutputVECTOR_Execute( void* outputFormat, void* data ) {}
void _lucOutputVECTOR_Destroy( void* outputFormat, void* data ) {}
-void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) {
+void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
lucOutputVECTOR* self = (lucOutputVECTOR*) outputFormat;
Pixel_Index width = window->width;
Pixel_Index height = window->height;
@@ -214,7 +214,7 @@ void _lucOutputVECTOR_Output( void* outp
/* return to glRenderMode(GL_RENDER), and complete writing output file */
state = gl2psEndPage();
if(state == 5)
- Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
+ Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
\nConsider increasing the OutputVECTOR buffersize. \
\nVector image will not be created correctly.\n\n" );
diff -r fbd4029e4444 -r 6f05d8c665b0 OutputFormats/src/OutputVECTOR.h
--- a/OutputFormats/src/OutputVECTOR.h Tue Jan 19 15:26:41 2010 -0800
+++ b/OutputFormats/src/OutputVECTOR.h Fri Feb 05 12:57:55 2010 -0800
@@ -88,7 +88,7 @@
void _lucOutputVECTOR_Execute( void* outputFormat, void* data );
void _lucOutputVECTOR_Destroy( void* outputFormat, void* data ) ;
- void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, void* pixelData ) ;
+ void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) ;
#endif
diff -r fbd4029e4444 -r 6f05d8c665b0 RenderingEngines/src/OpenGlUtil.c
--- a/RenderingEngines/src/OpenGlUtil.c Tue Jan 19 15:26:41 2010 -0800
+++ b/RenderingEngines/src/OpenGlUtil.c Fri Feb 05 12:57:55 2010 -0800
@@ -100,9 +100,6 @@ void lucPrintString(const char* str)
if (fontcharset > FONT_LARGE || fontcharset < FONT_FIXED) /* Character set valid? */
fontcharset = FONT_FIXED;
- glDisable( GL_CULL_FACE );
- glDisable( GL_LIGHTING );
-
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D); /* Enable Texture Mapping */
glBindTexture(GL_TEXTURE_2D, texture);
@@ -140,47 +137,52 @@ void lucPrint(int x, int y, const char *
void lucPrint3d(double x, double y, double z, const char *str)
{
- /* Calculate projected screen coords in viewport */
- GLdouble modelMatrix[16];
- GLdouble projMatrix[16];
- GLint viewportArray[4];
- double xPos, yPos, depth;
+ /* Calculate projected screen coords in viewport */
+ GLdouble modelMatrix[16];
+ GLdouble projMatrix[16];
+ GLint viewportArray[4];
+ double xPos, yPos, depth;
- glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
- glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
- glGetIntegerv( GL_VIEWPORT, viewportArray );
+ glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
+ glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
+ glGetIntegerv( GL_VIEWPORT, viewportArray );
- gluProject(x, y, z,
- modelMatrix, projMatrix, viewportArray,
- &xPos, &yPos, &depth );
+ gluProject(x, y, z,
+ modelMatrix,
+ projMatrix,
+ viewportArray,
+ &xPos,
+ &yPos,
+ &depth
+ );
- /* Switch to ortho view with 1 unit = 1 pixel and print using calculated screen coords */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
+ /* Switch to ortho view with 1 unit = 1 pixel and print using calculated screen coords */
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
- glOrtho((GLfloat) 0.0, viewportArray[2], viewportArray[3], 0.0, -1.0f,1.0f);
+ glOrtho((GLfloat) 0.0, viewportArray[2], viewportArray[3], 0.0, -1.0f,1.0f);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
- glDisable( GL_DEPTH_TEST );
+ glDisable( GL_DEPTH_TEST );
- /* Print at calculated position, compensating for viewport offset */
- int xs, ys;
- xs = (int)(xPos - viewportArray[0]);
- ys = (int)(viewportArray[3] - yPos - viewportArray[1]);
- if (depth <= 1.0 && xs > 0 && ys > 0 && xs < viewportArray[2] && ys < viewportArray[3])
- lucPrint(xs, ys, str); /* Print if in view */
+ /* Print at calculated position, compensating for viewport offset */
+ int xs, ys;
+ xs = (int)(xPos - viewportArray[0]);
+ ys = (int)(viewportArray[3] - yPos - viewportArray[1]);
+ if (depth <= 1.0 && xs > 0 && ys > 0 && xs < viewportArray[2] && ys < viewportArray[3])
+ lucPrint(xs, ys, str); /* Print if in view */
- /* Restore state */
- glPopMatrix();
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ /* Restore state */
+ glPopMatrix();
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
- glEnable( GL_DEPTH_TEST );
+ glEnable( GL_DEPTH_TEST );
}
void lucSetFontCharset(int charset)
@@ -241,10 +243,12 @@ void lucBuildFont(int glyphsize, int col
float glyphX = 1 / divX; /* Width & height of a glyph in texture coords */
float glyphY = 1 / divY;
GLfloat cx, cy; /* the character coordinates in our texture */
- if (startidx == 0) yoffset = 0;
+
+ if (startidx == 0)
+ yoffset = 0;
glBindTexture(GL_TEXTURE_2D, texture);
- for (i = 0; i < (stopidx - startidx); i++)
- {
+
+ for (i = 0; i < (stopidx - startidx); i++) {
cx = (float) (i % columns) / divX;
cy = yoffset + (float) (i / columns) / divY;
glNewList(fontbase + startidx + i, GL_COMPILE);
@@ -362,7 +366,7 @@ void lucViewportInfo_SetOpenGLCamera( lu
/*Declarations for the lucStereoAsymetric part*/
double ratio, radians, wd2, ndfl;
- double left, right, top, bottom;
+ double left, right, top, bottom, near=0.1, far=1000;
#define DTOR 0.0174532925
GLenum pname = GL_STEREO;
GLboolean stereo_enabled;
@@ -413,7 +417,7 @@ void lucViewportInfo_SetOpenGLCamera( lu
right = ratio * wd2 - 0.5* camera->eyeSeparation * ndfl;
top = wd2;
bottom = -wd2;
- glFrustum(left, right, bottom, top, viewport->nearClipPlane, viewport->farClipPlane);
+ glFrustum(left, right, bottom, top, near, far);
glMatrixMode(GL_MODELVIEW);
/*glDrawBuffer(GL_BACK_RIGHT);*/
@@ -436,7 +440,7 @@ void lucViewportInfo_SetOpenGLCamera( lu
right = ratio * wd2 + 0.5* camera->eyeSeparation * ndfl;
top = wd2;
bottom = -wd2;
- glFrustum(left, right, bottom, top, viewport->nearClipPlane, viewport->farClipPlane);
+ glFrustum(left, right, bottom, top, near, far);
glMatrixMode(GL_MODELVIEW);
glDrawBuffer(GL_BACK);
@@ -456,14 +460,6 @@ void lucViewportInfo_SetOpenGLCamera( lu
/* abort();*/
break;
}
-
- /* Apply scaling factors */
- if (viewport->scaleX != 1.0 || viewport->scaleY != 1.0 || viewport->scaleZ != 1.0) {
- glScalef(viewport->scaleX, viewport->scaleY, viewport->scaleZ);
- /* Enable automatic rescaling of normal vectors when scaling is turned on */
- //glEnable(GL_RESCALE_NORMAL);
- glEnable(GL_NORMALIZE);
- }
}
void luc_OpenGlSquare( Dimension_Index dim, double* pos, double* normal, double* orientation, double width) {
@@ -674,226 +670,112 @@ void luc_OpenGlCircle( Dimension_Index d
}
-void luc_DrawVector3d( double* pos, double* vector, double scale, double headSize, int segment_count )
-{
- /* Length of the drawn vector = vector magnitude * scaling factor */
- float length = scale * StGermain_VectorMagnitude( vector, 3 );
- static int segments; /* Saves segment count */
- static float *x_coords, *y_coords; /* Saves arrays of x,y points on circle for set segment count */
-
- /* Recalc required? Only done first time called and when segment count changes */
- if (segments != segment_count)
- {
- /* Calculate unit circle points when divided into specified segments
- * and store in static variable to re-use every time a vector with the
- * same segment count is drawn */
- segments = segment_count;
- if (x_coords != NULL) Memory_Free(x_coords);
- if (y_coords != NULL) Memory_Free(y_coords);
-
- x_coords = Memory_Alloc_Array( float, (segment_count + 1), "Unit Circle X Coords" );
- y_coords = Memory_Alloc_Array( float, (segment_count + 1), "Unit Circle Y Coords" );
-
- GLfloat angle;
- //fprintf(stderr, "Vector Arrow -- Point %f,%f,%f\n", C[0], C[1], C[2]);
- // Loop around in a circle and specify even points along the circle
- // as the vertices for the triangle fan cone, cone base and arrow shaft
- float angle_inc = 2*M_PI / (float)segment_count;
- int idx;
- for(idx = 0; idx <= segments; idx++)
- {
- angle = angle_inc * (float)idx;
- // Calculate x and y position of the next vertex and cylinder normals (unit circle coords)
- x_coords[idx] = sin(angle);
- y_coords[idx] = cos(angle);
- }
- }
-
- /* Render a 3d arrow, cone with base for head, cylinder for shaft */
- glDisable(GL_CULL_FACE);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
- /* Radius of head */
- double radius = 0.8 * headSize * length;
-
- glPushMatrix();
- /* Vector is centered on pos[x,y,z]
- * Translate to the point of arrow -> position + vector/2 */
- glTranslated(pos[0] + scale * 0.5 * vector[0],
- pos[1] + scale * 0.5 * vector[1],
- pos[2] + scale * 0.5 * vector[2]);
-
- //Rotate to orient the cone
- //...Want to align our z-axis to point along arrow vector:
- // axis of rotation = (z x vec) cosine of angle = (z . vec)
- double z[3] = {0.0, 0.0, 1.0}, axis[3];
- double rangle;
- StGermain_VectorCrossProduct( axis, z, vector );
- rangle = acos(StGermain_VectorDotProduct( z, vector, 3 ));
- rangle = StGermain_RadianToDegree( rangle );
- glRotated(rangle, axis[0], axis[1], axis[2]);
- //fprintf(stderr, "Axis %f,%f,%f angle %f\n", axis[0], axis[1], axis[2], rangle);
-
- //Translate back from point by size of arrowhead
- //thus our working coordinate system origin is at the base of head with z-axis aligned with head
- glTranslated(0.0, 0.0, -radius*2);
-
- /* Render the arrowhead cone and base with two triangle fans */
- /* Don't bother drawing head for tiny vectors */
- double normal[3];
- if ( radius >= 1.0e-10 )
- {
- /* Pinnacle vertex is at point of arrow */
- double pinnacle[3] = {0, 0, radius * 2};
-
- /* First pair of vertices on circle define a triangle when combined with pinnacle */
- double vertex0[3] = {radius * x_coords[0], radius * y_coords[0], 0.0};
- double vertex1[3] = {radius * x_coords[1], radius * y_coords[1], 0.0};
-
- /* Set normal for first triangle */
- StGermain_NormalToPlane( normal, pinnacle, vertex0, vertex1);
-
- int i;
- for (i=0; i<2; i++)
- {
- glBegin(GL_TRIANGLE_FAN);
- //Pinnacle vertex of cone / centre of base circle
- glNormal3dv(normal);
- glVertex3dv(pinnacle);
-
- //Subsequent vertices describe outer edges of cone base
- int v;
- for (v=0; v <= segments; v++)
- {
- /* Calc next vertex from unit circle normal */
- vertex1[0] = radius * x_coords[v];
- vertex1[1] = radius * y_coords[v];
-
- if (i==0 && v > 0)
- {
- StGermain_NormalToPlane( normal, pinnacle, vertex0, vertex1);
- glNormal3dv(normal);
- }
-
- /* Draw vertex */
- glVertex2dv(vertex1);
-
- /* Save previous vertex */
- memcpy( vertex0, vertex1, sizeof(double) * 3 );
- }
- glEnd();
-
- //Flatten cone for circle base -> set common point to share z-coord
- pinnacle[2] = 0;
- //Normal for back of cone
- normal[0] = 0; normal[1] = 0; normal[2] = -1;
- }
- }
-
- /* Render a cylinder quad strip for shaft */
- glBegin(GL_QUAD_STRIP);
- int v;
- double shaft_vertex[3][3];
- for (v=0; v <= segments; v++)
- {
- /* Top of shaft */
- shaft_vertex[0][0] = 0.2 * radius * x_coords[v];
- shaft_vertex[0][1] = 0.2 * radius * y_coords[v];
- shaft_vertex[0][2] = 0.0;
- /* Base of shaft */
- shaft_vertex[1][0] = shaft_vertex[0][0];
- shaft_vertex[1][1] = shaft_vertex[0][1];
- shaft_vertex[1][2] = -length + radius*2; /* Shaft length to base = vector length - head size */
-
- normal[0] = -x_coords[v]; normal[1] = -y_coords[v]; normal[2] = 0;
- glNormal3dv(normal);
- glVertex3dv(shaft_vertex[0]);
- glVertex3dv(shaft_vertex[1]);
- //fprintf(stderr, " idx %d vertex %f,%f,%f --> ", v, shaft_vertex[0][0], shaft_vertex[0][1], shaft_vertex[0][2]);
- //fprintf(stderr, "%f,%f,%f\n", shaft_vertex[1][0], shaft_vertex[1][1], shaft_vertex[1][2]);
- }
- glEnd();
-
- glPopMatrix();
-}
+#define OFFSET2D 0.01
void luc_DrawVector( Dimension_Index dim , double* pos, double* vector, double scale, double headSize ) {
+ Coord A, B, C;
+ Dimension_Index dim_I;
+
+ glDisable(GL_LIGHTING);
+ /* headSize = |BC|/|AC|:
+ i.e. head size of 1.0, means that B -> A,
+ head size of 0.0, means that B ->C */
+
+ /* ASCII art describing vertices for arrow
+ D
+ |\
+ | \
+ | \
+ A O B| \
+ --------------------------------| > C
+ | /
+ | /
+ | /
+ |/
+ E
+ */
+
+ for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
+ A[ dim_I ] = pos[ dim_I ] - scale * 0.5 * vector[ dim_I ];
+ C[ dim_I ] = pos[ dim_I ] + scale * 0.5 * vector[ dim_I ];
+
+ B[ dim_I ] = A[ dim_I ] * headSize + C[ dim_I ] * (1.0 - headSize);
+ }
+ if ( dim == 2 )
+ A[ K_AXIS ] = B[ K_AXIS ] = C[ K_AXIS ] = OFFSET2D;
+
+ /* Draw Line */
+ glBegin(GL_LINES);
+ glVertex3dv( A );
+ glVertex3dv( B );
+ glEnd();
+
+
+ /* Draw Arrow Head */
if ( dim == 2 ) {
- double pos3d[3], vector3d[3];
- pos3d[0] = pos[0]; pos3d[1] = pos[1]; pos3d[2] = 0.0;
- vector3d[0] = vector[0]; vector3d[1] = vector[1]; vector3d[2] = 0.0;
- luc_DrawVector3d(pos3d, vector3d, scale, headSize, 16.0);
+ glBegin(GL_TRIANGLES);
+ glVertex3dv( C );
+ /* Vertex D */
+ glVertex3d(
+ B[ I_AXIS ] + 0.8 * headSize * scale * vector[1],
+ B[ J_AXIS ] - 0.8 * headSize * scale * vector[0],
+ OFFSET2D );
+ /* Vertex E */
+ glVertex3d(
+ B[ I_AXIS ] - 0.8 * headSize * scale * vector[1],
+ B[ J_AXIS ] + 0.8 * headSize * scale * vector[0],
+ OFFSET2D );
+ glEnd();
}
- else
- luc_DrawVector3d(pos, vector, scale, headSize, 16.0);
-}
+ else {
+ double radius = 0.8 * headSize * scale * StGermain_VectorMagnitude( vector, dim );
+ double vector_polar[3], vector_rect[3];
+ double normal_polar[3], normal_rect[3];
+ int theta;
-//Leaving this here for now as is a useful debugging function for plotting visable surface normals
-#define DEG2RAD (M_PI/180.0)
-#define RAD2DEG (180.0/M_PI)
-#define crossProduct(a,b,c) \
- (a)[0] = (b)[1] * (c)[2] - (c)[1] * (b)[2]; \
- (a)[1] = (b)[2] * (c)[0] - (c)[2] * (b)[0]; \
- (a)[2] = (b)[0] * (c)[1] - (c)[0] * (b)[1];
+ /* Don't bother drawing head for tiny vectors */
+ if ( radius < 1.0e-10 )
+ return;
-#define vecmag(v) \
- sqrt((v)[0] * (v)[0] + (v)[1] * (v)[1] + (v)[2] * (v)[2])
-#define dotProduct(v,q) \
- ((v)[0] * (q)[0] + \
- (v)[1] * (q)[1] + \
- (v)[2] * (q)[2])
+ /* normalise vector */
+ memcpy( normal_rect, vector, sizeof(double) * 3 );
+ StGermain_VectorNormalise( normal_rect, dim );
+
+ /* Convert Normal into spherical coordinates */
+ StGermain_RectangularToSpherical( normal_polar, normal_rect, 3 );
+
+ glBegin(GL_TRIANGLE_FAN);
+ /* Vertex C - Point of the triangle fan */
+ glVertex3dv( C );
-#define vectorSubtract(a, b, c) \
- (a)[0] = (b)[0] - (c)[0]; \
- (a)[1] = (b)[1] - (c)[1]; \
- (a)[2] = (b)[2] - (c)[2]; \
-/* Debugging function, draws a small white/red line representing normal */
-void luc_DrawNormalVector( double* pos, double* vector, double scale )
-{
- glDisable(GL_LIGHTING);
- /* Length of the drawn vector = vector magnitude * scaling factor */
- double length = scale * sqrt(dotProduct(vector,vector));
+ for ( theta = 0 ; theta <= 360 ; theta += 1 ) {
+ /* Find vector from centre of circle to edge of circle */
+ vector_polar[0] = radius;
+ vector_polar[1] = StGermain_DegreeToRadian( theta );
+ vector_polar[2] = atan( -1.0/
+ (tan(normal_polar[2])*cos( normal_polar[1] - vector_polar[1] ) ) );
- glPushMatrix();
- /* Vector is centered on pos[x,y,z]
- * Translate to the point of arrow -> position + vector/2 */
- glTranslated(pos[0] + scale * 0.5 * vector[0],
- pos[1] + scale * 0.5 * vector[1],
- pos[2] + scale * 0.5 * vector[2]);
-
- //Rotate to orient the cone
- //...Want to align our z-axis to point along arrow vector:
- // axis of rotation = (z x vec) cosine of angle = (z . vec)
- double z[3] = {0.0, 0.0, 1.0}, axis[3];
- double rangle;
- crossProduct( axis, z, vector );
- rangle = acos(dotProduct( z, vector ));
- rangle = RAD2DEG * rangle;
- glRotated(rangle, axis[0], axis[1], axis[2]);
- //fprintf(stderr, "Axis %f,%f,%f angle %f radius %f\n", axis[0], axis[1], axis[2], rangle, radius);
-
- //Translate back from point by half length
- //thus our working coordinate system origin is halfway down vec with z-axis aligned with head
- glTranslated(0.0, 0.0, -length*0.5);
-
- /* Render vector as two lines, blue base, red at tip */
- glColor3f(1.0, 0.0, 0.0);
- glBegin(GL_LINES);
- glVertex3d(0, 0, 0);
- glVertex3d(0, 0, length*0.5);
- glEnd();
-
- glColor3f(0.0, 0.0, 1.0);
- glBegin(GL_LINES);
- glVertex3d(0, 0, 0);
- glVertex3d(0, 0, -length*0.5);
- glEnd();
-
- glPopMatrix();
+ /* Correct for arctan domain */
+ if ( vector_polar[2] < 0.0 )
+ vector_polar[2] += M_PI;
+
+ /*Convert back to cartesian coordinates */
+ StGermain_SphericalToRectangular( vector_rect, vector_polar, 3 );
+
+ /* Find position vectors of edge of circle */
+ vector_rect[0] += B[0];
+ vector_rect[1] += B[1];
+ vector_rect[2] += B[2];
+
+ /* Plot them */
+ glVertex3dv( vector_rect );
+ }
+ glEnd();
+ }
+
glEnable(GL_LIGHTING);
}
-#define OFFSET2D 0.01
void luc_DrawRod( Dimension_Index dim , double* pos, double* vector, double scale ) {
double magnitude;
diff -r fbd4029e4444 -r 6f05d8c665b0 RenderingEngines/src/RenderingEngineGL.c
--- a/RenderingEngines/src/RenderingEngineGL.c Tue Jan 19 15:26:41 2010 -0800
+++ b/RenderingEngines/src/RenderingEngineGL.c Fri Feb 05 12:57:55 2010 -0800
@@ -148,31 +148,37 @@ void _lucRenderingEngineGL_Destroy( void
void _lucRenderingEngineGL_Destroy( void* renderingEngine, void* data ) {}
void _lucRenderingEngineGL_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
- lucRenderingEngineGL* self = (lucRenderingEngineGL*) renderingEngine;
- lucViewport* viewport;
- Viewport_Index viewport_I;
- Viewport_Index viewportCount = window->viewportCount;
- lucViewportInfo* viewportInfo;
- #ifdef HAVE_GL2PS
- GLint viewport_gl2ps[4], state;
- #endif
+ lucRenderingEngineGL* self = (lucRenderingEngineGL*) renderingEngine;
+ lucViewport* viewport;
+ Viewport_Index viewport_I;
+ Viewport_Index viewportCount = window->viewportCount;
+ lucViewportInfo* viewportInfo;
+ #ifdef HAVE_GL2PS
+ GLint viewport_gl2ps[4];
+ GLint state;
+ #endif
+
Journal_DPrintfL( lucDebug, 2, "In func: %s for %s '%s'\n", __func__, self->type, self->name );
Stream_Indent( lucDebug );
- /* Determine if context is double buffered or not and save flag */
- glGetBooleanv(GL_DOUBLEBUFFER, &self->doubleBuffered);
-
- glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
+ /* Determine if context is double buffered or not and save flag */
+ glGetBooleanv(GL_DOUBLEBUFFER, &self->doubleBuffered);
+ /* Set up OpenGl Colour */
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glEnable(GL_COLOR_MATERIAL);
+ glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ /* glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); -- Done in the viewport now */
+ glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
+ GL_Error_Check
/* Allow Transparency */
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
- /* Interpolate colours between polygon vertices, looks nice but not technically accurate */
- glShadeModel( GL_SMOOTH );
+ /* Interpolate colours between polygon vertices, looks nice but not technically accurate */
+ glShadeModel( GL_SMOOTH );
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_DEPTH_TEST);
lucWindow_Broadcast( window, 0, MPI_COMM_WORLD );
@@ -252,7 +258,7 @@ void _lucRenderingEngineGL_Render( void*
Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );
}
-void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, void *buffer, Bool withAlpha) {
+void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
lucRenderingEngineGL* self = (lucRenderingEngineGL*) renderingEngine;
GLsizei width = window->width;
GLsizei height = window->height;
@@ -269,10 +275,7 @@ void _lucRenderingEngineGL_GetPixelData(
glReadBuffer( self->doubleBuffered ? GL_BACK : GL_FRONT );
/* Actually read the pixels. */
- if (withAlpha)
- glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
- else
- glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
+ glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
}
void lucRenderingEngineGL_WriteViewportText( void* renderingEngine, lucWindow* window, lucViewportInfo* viewportInfo, AbstractContext* context ) {
@@ -307,7 +310,7 @@ void _lucRenderingEngineGL_Clear( void*
glEnable (GL_SCISSOR_TEST);
glClearColor(window->backgroundColour.red, window->backgroundColour.green,
- window->backgroundColour.blue, 0.0); /* window->backgroundColour.opacity );*/
+ window->backgroundColour.blue, window->backgroundColour.opacity );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
diff -r fbd4029e4444 -r 6f05d8c665b0 RenderingEngines/src/RenderingEngineGL.h
--- a/RenderingEngines/src/RenderingEngineGL.h Tue Jan 19 15:26:41 2010 -0800
+++ b/RenderingEngines/src/RenderingEngineGL.h Fri Feb 05 12:57:55 2010 -0800
@@ -95,7 +95,8 @@
void _lucRenderingEngineGL_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) ;
void _lucRenderingEngineGL_Clear( void* renderingEngine, lucWindow* window, Bool clearAll ) ;
- void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, void* buffer, Bool withAlpha ) ;
+ void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) ;
+
void lucRenderingEngineGL_WriteViewportText( void* renderingEngine, lucWindow* window, lucViewportInfo* viewportInfo, AbstractContext* context ) ;
/** Compositing Functions */
diff -r fbd4029e4444 -r 6f05d8c665b0 RenderingEngines/src/RenderingEngineVTK.cxx
--- a/RenderingEngines/src/RenderingEngineVTK.cxx Tue Jan 19 15:26:41 2010 -0800
+++ b/RenderingEngines/src/RenderingEngineVTK.cxx Fri Feb 05 12:57:55 2010 -0800
@@ -278,7 +278,7 @@ void _lucRenderingEngineVTK_Render( void
Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );*/
}
-void _lucRenderingEngineVTK_GetPixelData( void* renderingEngine, lucWindow* window, void* buffer, Bool withAlpha ) {
+void _lucRenderingEngineVTK_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
/* VTKsizei width = window->width;
VTKsizei height = window->height;
diff -r fbd4029e4444 -r 6f05d8c665b0 RenderingEngines/src/RenderingEngineVTK.h
--- a/RenderingEngines/src/RenderingEngineVTK.h Tue Jan 19 15:26:41 2010 -0800
+++ b/RenderingEngines/src/RenderingEngineVTK.h Fri Feb 05 12:57:55 2010 -0800
@@ -91,7 +91,7 @@
void _lucRenderingEngineVTK_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) ;
void _lucRenderingEngineVTK_Clear( void* renderingEngine, lucWindow* window, Bool clearAll ) ;
- void _lucRenderingEngineVTK_GetPixelData( void* renderingEngine, lucWindow* window, void* buffer, Bool withAlpha) ;
+ void _lucRenderingEngineVTK_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) ;
void lucRenderingEngineVTK_DrawTitle( void* renderingEngine, lucWindow* window, lucViewportInfo* viewportInfo ) ;
diff -r fbd4029e4444 -r 6f05d8c665b0 Windowing/src/CarbonWindow.c
--- a/Windowing/src/CarbonWindow.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Windowing/src/CarbonWindow.c Fri Feb 05 12:57:55 2010 -0800
@@ -264,42 +264,15 @@ void lucCarbonWindow_CreateWindow( void*
{ kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassWindow, kEventWindowResizeCompleted},
};
-
- /* OpenGL attributes */
- static GLint attributes[] =
+ static GLint attributes[] = /* OpenGL attributes */
{
- AGL_RGBA,
- AGL_RED_SIZE, 8,
- AGL_GREEN_SIZE, 8,
- AGL_BLUE_SIZE, 8,
- AGL_ALPHA_SIZE, 8,
- AGL_DOUBLEBUFFER,
- AGL_DEPTH_SIZE, 16,
- AGL_STENCIL_SIZE, 1,
- AGL_NONE
+ AGL_RGBA,
+ AGL_GREEN_SIZE, 1,
+ AGL_DOUBLEBUFFER,
+ AGL_DEPTH_SIZE, 16,
+ AGL_STENCIL_SIZE, 1,
+ AGL_NONE
};
- static GLint aaAttributes[] =
- {
- AGL_RGBA,
- AGL_RED_SIZE, 8,
- AGL_GREEN_SIZE, 8,
- AGL_BLUE_SIZE, 8,
- AGL_ALPHA_SIZE, 8,
- AGL_DOUBLEBUFFER,
- AGL_DEPTH_SIZE, 16,
- AGL_STENCIL_SIZE, 1,
- /* Enables MSAA */
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 4,
- /* Enable accumulation buffer /
- AGL_ACCUM_RED_SIZE, 8,
- AGL_ACCUM_GREEN_SIZE, 8,
- AGL_ACCUM_BLUE_SIZE, 8,
- AGL_ACCUM_ALPHA_SIZE, 8,*/
- AGL_NONE
- };
- int* attribs;
- if (self->antialias) attribs = aaAttributes; else attribs = attributes;
lucDebug_PrintFunctionBegin( self, 1 );
@@ -320,10 +293,8 @@ void lucCarbonWindow_CreateWindow( void*
self->handler = NewEventHandlerUPP(lucCarbonWindow_EventHandler);
InstallWindowEventHandler(self->window, self->handler, sizeof(events) / sizeof(events[0]), events, self, 0L);
- if (self->isTimedOut) {
- self->timerHandler = NewEventLoopIdleTimerUPP(lucCarbonWindow_IdleTimer);
- InstallEventLoopIdleTimer(GetMainEventLoop(), kEventDurationSecond * 2, kEventDurationSecond * 1, self->timerHandler, self, &self->timer);
- }
+ self->timerHandler = NewEventLoopIdleTimerUPP(lucCarbonWindow_IdleTimer);
+ InstallEventLoopIdleTimer(GetMainEventLoop(), kEventDurationSecond * 2, kEventDurationSecond * 1, self->timerHandler, self, &self->timer);
GetCurrentProcess(&psn);
/* this is a secret undocumented Mac function that allows code that isn't part of a bundle to be a foreground operation */
@@ -336,7 +307,7 @@ void lucCarbonWindow_CreateWindow( void*
}
/* Create the OpenGL context and bind it to the window or pixelbuffer. */
- format = aglChoosePixelFormat(NULL, 0, attribs);
+ format = aglChoosePixelFormat(NULL, 0, attributes);
self->graphicsContext = NULL;
self->graphicsContext = aglCreateContext(format, NULL);
assert( self->graphicsContext );
@@ -362,10 +333,8 @@ void lucCarbonWindow_DestroyWindow( void
if ( self->window )
{
DisposeEventHandlerUPP( self->handler );
- if (self->isTimedOut) {
- if (self->timer != NULL) RemoveEventLoopTimer( self->timer );
- DisposeEventLoopIdleTimerUPP( self->timerHandler );
- }
+ if (self->timer != NULL) RemoveEventLoopTimer( self->timer );
+ DisposeEventLoopIdleTimerUPP( self->timerHandler );
DisposeWindow( self->window );
}
else
diff -r fbd4029e4444 -r 6f05d8c665b0 Windowing/src/Init.c
--- a/Windowing/src/Init.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Windowing/src/Init.c Fri Feb 05 12:57:55 2010 -0800
@@ -67,47 +67,49 @@ Bool lucWindowing_Init() {
Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
- /* Order of priority for default output window: SDL, OSMesa, X11, Carbon, VTK */
+ /* Order of priority for default output window: OSMesa, X11, SDL, Carbon */
/* SDL will work with OSMesa to allow on/off-screen rendering so if present is first choice */
/* If OSMesa is linked, Carbon and X11 will NOT work as they depend on the system OpenGL */
/* library, which OSMesa replaces. */
- #ifdef HAVE_SDL
- Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
- RegisterParent( lucSDLWindow_Type, lucWindow_Type );
- if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
- Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
- #endif
-
#ifdef HAVE_OSMESA
+ #ifdef HAVE_SDL
+ Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
+ RegisterParent( lucSDLWindow_Type, lucWindow_Type );
+ if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+ Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
+ #endif
Stg_ComponentRegister_Add( componentRegister, lucOSMesaWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew );
RegisterParent( lucOSMesaWindow_Type, lucWindow_Type );
if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew );
+ #else
+ #ifdef HAVE_X11
+ Stg_ComponentRegister_Add( componentRegister, lucX11Window_Type, (Name)"0", _lucX11Window_DefaultNew );
+ RegisterParent( lucX11Window_Type, lucWindow_Type );
+ if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+ Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucX11Window_DefaultNew );
+ #endif
+
+ #ifdef HAVE_SDL
+ Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
+ RegisterParent( lucSDLWindow_Type, lucWindow_Type );
+ if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+ Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew );
+ #endif
#endif
-
- #ifdef HAVE_X11
- Stg_ComponentRegister_Add( componentRegister, lucX11Window_Type, (Name)"0", _lucX11Window_DefaultNew );
- RegisterParent( lucX11Window_Type, lucWindow_Type );
- if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
- Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucX11Window_DefaultNew );
- #endif
#ifdef HAVE_CARBON
+ #ifdef __LP64__ /* Carbon does not support 64-bit, compile with -m32 */
+ Journal_Printf( Journal_Register( ErrorStream_Type, (Name)"Context" ), "CarbonWindow not available on 64bit compile\n", __func__ );
+ #else
Stg_ComponentRegister_Add( componentRegister, lucCarbonWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew );
RegisterParent( lucCarbonWindow_Type, lucWindow_Type );
if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew );
+ #endif
+ #endif
- #endif
-
- #ifdef HAVE_VTK
- Stg_ComponentRegister_Add( componentRegister, lucVTKWindow_Type, (Name)"0", _lucVTKWindow_DefaultNew );
- RegisterParent( lucVTKWindow_Type, lucWindow_Type );
- if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
- Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucVTKWindow_DefaultNew );
- #endif
-
return True;
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Windowing/src/OSMesaWindow.c
--- a/Windowing/src/OSMesaWindow.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Windowing/src/OSMesaWindow.c Fri Feb 05 12:57:55 2010 -0800
@@ -143,8 +143,7 @@ void _lucOSMesaWindow_Initialise( void*
/* Init OSMesa display buffer */
self->pixelBuffer = Memory_Alloc_Array( lucAlphaPixel, self->width * self->height, "OSMesa pixelBuffer" );
- /* 24 bit depth, 1 bit stencil, no accum */
- self->osMesaContext = OSMesaCreateContextExt( OSMESA_RGBA, 24, 1, 0, NULL);
+ self->osMesaContext = OSMesaCreateContextExt( OSMESA_RGBA, 16, 1, 0, NULL); /* 16 bit depth, 1 bit stencil */
OSMesaMakeCurrent( self->osMesaContext, self->pixelBuffer, GL_UNSIGNED_BYTE, self->width, self->height );
diff -r fbd4029e4444 -r 6f05d8c665b0 Windowing/src/SDLWindow.c
--- a/Windowing/src/SDLWindow.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Windowing/src/SDLWindow.c Fri Feb 05 12:57:55 2010 -0800
@@ -38,7 +38,6 @@
*+ Stevan Quenette
*+ Patrick Sunter
*+ Greg Watson
-*+ Owen Kaluza
*+
** $Id: SDLWindow.c 740 2007-10-11 08:05:31Z SteveQuenette $
**
@@ -175,8 +174,7 @@ void _lucSDLWindow_Initialise( void* win
*** For this to work, OSMesa must be linked without/before any other OpenGL implementations. */
#ifdef HAVE_OSMESA
Journal_Printf( Journal_MyStream( Info_Type, self ), "*** Using OSMesa library for OpenGL graphics in SDL Window ***.\n" );
- /* 24 bit depth, 1 bit stencil, 8 bit accum */
- self->osMesaContext = OSMesaCreateContextExt( GL_RGBA, 24, 1, 8, NULL );
+ self->osMesaContext = OSMesaCreateContextExt( GL_RGBA, 16, 1, 0, NULL ); /* 16 bit depth, 1 bit stencil */
if (!self->osMesaContext) {
Journal_Printf( lucError, "In func %s: OSMesaCreateContext failed!\n", __func__);
abort();
@@ -187,12 +185,20 @@ void _lucSDLWindow_Initialise( void* win
self->sdlFlags = SDL_RESIZABLE | SDL_SWSURFACE;
#else
self->sdlFlags = SDL_OPENGL | SDL_RESIZABLE;
+ /* set opengl attributes */
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#endif
/* Create display */
lucSDLWindow_CreateWindow(self);
- if (self->interactive && self->isMaster && self->isTimedOut)
+ if (self->interactive && self->isMaster)
/* Install 1sec idle timer */
self->timer = SDL_AddTimer(1000, lucSDLWindow_IdleTimer, self);
@@ -202,6 +208,9 @@ void _lucSDLWindow_Initialise( void* win
/* Run the parent function to init window... */
_lucWindow_Initialise(window, data);
+
+ /* Refresh display */
+ //_lucSDLWindow_Display(window);
}
void _lucSDLWindow_Execute( void* window, void* data ) {
@@ -214,7 +223,7 @@ void _lucSDLWindow_Execute( void* window
Journal_DPrintfL( lucDebug, 2, "OSMesa make current %d,%d\n", self->width, self->height);
#else
/* Clear background */
- self->renderingEngine->_clear(self, window, True);
+ self->renderingEngine->_clear(self, window, False);
#endif
/* Run the parent function to execute the window... */
_lucWindow_Execute(window, data);
@@ -224,9 +233,9 @@ void _lucSDLWindow_Destroy( void* window
lucSDLWindow* self = (lucSDLWindow*)window;
/* Run the parent function to destroy window... */
- _lucWindow_Destroy(self, data);
+ _lucWindow_Destroy(window, data);
- lucSDLWindow_DeleteWindow(self);
+ lucSDLWindow_DeleteWindow(window);
#ifdef HAVE_OSMESA
/* destroy the context */
@@ -243,19 +252,17 @@ void _lucSDLWindow_Display( void* window
lucSDLWindow* self = (lucSDLWindow*) window;
/* Run the parent function to display window... */
- lucWindow_Display(self);
+ lucWindow_Display(window);
#ifdef HAVE_OSMESA
/* Render in SDL using OSMesa output buffer */
if (self->interactive)
{
- /* Clear window background */
SDL_PixelFormat *fmt = self->screen->format;
lucColour *c = &self->backgroundColour;
SDL_FillRect(self->screen, NULL, SDL_MapRGBA(fmt, (Uint8)(c->red * 255), (Uint8)(c->green * 255),
(Uint8)(c->blue * 255), (Uint8)(c->opacity * 255)));
Journal_DPrintfL( lucDebug, 2, "SDL BLIT SURFACE src %d,%d to dst %d,%d\n\n", self->buffer->w, self->buffer->h, self->screen->w, self->screen->h);
- /* Blit OSMesa output to SDL window */
SDL_BlitSurface(self->buffer,NULL,self->screen,NULL);
SDL_Flip(self->screen);
}
@@ -410,26 +417,6 @@ void lucSDLWindow_CreateWindow( void* wi
}
OSMesaPixelStore(OSMESA_Y_UP,0);
if (!self->interactive || !self->isMaster) return; /* No SDL window required */
- #else
- /* set opengl attributes */
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- if (self->antialias) {
- /* Enable accumulation buffer /
- SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,8);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,8);
- */
- /* Enable 4xsample Antialiasing */
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
- }
#endif
/* Create our rendering surface */
@@ -465,6 +452,7 @@ void lucSDLWindow_DeleteWindow(void *win
if (SDL_useCount < 1)
{
SDL_FreeSurface(self->screen);
+ SDL_Quit();
screen = NULL;
}
}
diff -r fbd4029e4444 -r 6f05d8c665b0 Windowing/src/X11Window.c
--- a/Windowing/src/X11Window.c Tue Jan 19 15:26:41 2010 -0800
+++ b/Windowing/src/X11Window.c Fri Feb 05 12:57:55 2010 -0800
@@ -256,6 +256,7 @@ Bool _lucX11Window_EventProcessor( void*
lucX11Window* self = (lucX11Window*)window;
KeySym ks;
XEvent event;
+ Atom wmDeleteWindow;
static unsigned int button = 0;
static Bool visible = True;
Bool redisplay = True;
@@ -338,17 +339,8 @@ Bool lucX11Window_CreateDisplay( void* w
static int configuration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
static int alphaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
- GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None};
- static int aaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
- GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1,
- /* Multisample anti-aliasing */
- GLX_SAMPLE_BUFFERS, 1, GLX_SAMPLES, 4,
- /* Enable accumulation buffer /
- GLX_ACCUM_RED_SIZE, 1, GLX_ACCUM_GREEN_SIZE, 1, GLX_ACCUM_BLUE_SIZE, 1, GLX_ACCUM_ALPHA_SIZE, 1, None}; */
- None};
- int* config;
- if (self->antialias) config = aaConfiguration; else config = alphaConfiguration;
-
+ GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None};
+
/*********************** Create Display ******************************/
self->display = XOpenDisplay(NULL);
if (self->display == NULL) {
@@ -376,11 +368,11 @@ Bool lucX11Window_CreateDisplay( void* w
}
/* find an OpenGL-capable display - trying different configurations if nessesary */
- self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), config);
+ self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &alphaConfiguration[0]);
self->doubleBuffer = True;
if (self->vi == NULL) {
Journal_Printf( lucError, "In func %s: Couldn't open RGBA Double Buffer display\n", __func__);
- self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), config + 1);
+ self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), &alphaConfiguration[1]);
self->doubleBuffer = False;
}
if (self->vi == NULL) {
@@ -519,16 +511,14 @@ void lucX11Window_CreateInteractiveWindo
if (wmHints) XFree(wmHints);
/* Setup timer */
- if (self->isTimedOut)
- {
- parent = (lucWindow*)window; /* Save parent ref for signal handler... */
- signal(SIGALRM, lucX11Window_Timer);
- struct itimerval timerval;
- timerval.it_value.tv_sec = 1;
- timerval.it_value.tv_usec = 0;
- timerval.it_interval = timerval.it_value;
- setitimer(ITIMER_REAL, &timerval, NULL);
- }
+ parent = (lucWindow*)window; /* Save parent ref for signal handler... */
+ signal(SIGALRM, lucX11Window_Timer);
+ struct itimerval timerval;
+ timerval.it_value.tv_sec = 1;
+ timerval.it_value.tv_usec = 0;
+ timerval.it_interval = timerval.it_value;
+ setitimer(ITIMER_REAL, &timerval, NULL);
+
lucDebug_PrintFunctionEnd( self, 1 );
}
More information about the CIG-COMMITS
mailing list