Text archives Help
- From:
- To:
- Subject: [Manta] r2389 - in trunk: SwigInterface scenes/csafe/python scenes/csafe/src
- Date: Wed, 18 Mar 2009 04:20:17 -0600 (MDT)
Author: brownlee
Date: Wed Mar 18 04:20:14 2009
New Revision: 2389
Modified:
trunk/SwigInterface/FloatSpin.py
trunk/scenes/csafe/python/Histogram.py
trunk/scenes/csafe/python/csafe_scene.py
trunk/scenes/csafe/src/CDGridSpheres.cc
trunk/scenes/csafe/src/CDTest.h
Log:
M scenes/csafe/python/Histogram.py
fixing issue with measurements frame not setting crop region
M scenes/csafe/python/csafe_scene.py
adding volume histogram to automatically built histograms
M scenes/csafe/src/CDGridSpheres.cc
re-adding ambient occlusion
M scenes/csafe/src/CDTest.h
changing volume loader to use loaded minmax instead of one
stored in config file or specified. it will now have to be set to a
custom value after loading
M SwigInterface/FloatSpin.py
getting rid of error raised if sent an incorrect increment
value, instead just crop it
Modified: trunk/SwigInterface/FloatSpin.py
==============================================================================
--- trunk/SwigInterface/FloatSpin.py (original)
+++ trunk/SwigInterface/FloatSpin.py Wed Mar 18 04:20:14 2009
@@ -643,7 +643,8 @@
else:
sci_not =
abs(self._value)/pow(10.0,int(math.log(abs(self._value))))
if increment < abs(self._value)/(10.0**self._digits)/sci_not:
- raise "\nERROR: Increment Should Be Greater Or Equal To
value/(10**digits)."
+ increment = abs(self._value)/(10.0**self._digits)/sci_not
+ #raise "\nERROR: Increment Should Be Greater Or Equal To
value/(10**digits)."
self._increment = FixedPoint(str(increment), 20)
self.SetValue(self._value)
Modified: trunk/scenes/csafe/python/Histogram.py
==============================================================================
--- trunk/scenes/csafe/python/Histogram.py (original)
+++ trunk/scenes/csafe/python/Histogram.py Wed Mar 18 04:20:14 2009
@@ -753,6 +753,7 @@
if (self.histogram.parent.group == 0):
if self.transferFPanel.transferFPanel.histogramGroup == self:
self.scene.test.setSphereColorMinMax(self.histogram.varIndex, colorMin,
colorMax)
+ self.scene.test.setClipMinMax(self.histogram.varIndex,
cropMin,cropMax)
else:
print "setting colorminmax vals: " + str(colorMin) + " " +
str(colorMax)
self.scene.test.setVolColorMinMax(float(colorMin),
float(colorMax))
@@ -930,8 +931,6 @@
def UpdateIncrement(self, fs):
val = fs.GetValue()
- print "val: " + str(val)
- print "updating increment to: " + str(abs(val*0.01))
fs.SetIncrement(abs(val*0.01))
def OnZoomMinFS(self, evt):
Modified: trunk/scenes/csafe/python/csafe_scene.py
==============================================================================
--- trunk/scenes/csafe/python/csafe_scene.py (original)
+++ trunk/scenes/csafe/python/csafe_scene.py Wed Mar 18 04:20:14 2009
@@ -346,15 +346,33 @@
#self.test.loadVolNrrds()
if self.scene.autoBuildHistograms:
+ if len(self.scene.nrrdFiles2) > 0:
+ name = "volume"
+ index = 0
+ found = False
+ for i in range(len(self.histoGroups)):
+ if index == self.histoGroups[i].varIndex and
self.histoGroups[i].group == 1:
+ found = True
+ if found == False:
+ hist =
Histogram.HistogramGroup(self.panel,self.scene,index,name,0)
+ hist.group = 1
+ hist.varIndex = 0
+ self.histoGroups.append(hist)
for i in range(self.test.getNumKeyValuePairs()):
key = self.test.getKey(i)
if key.find(".") > 0:
name = key.strip(" index:=")
index = int(self.test.getValue(i))
- hist =
Histogram.HistogramGroup(self.panel,self.scene,index,name,3)
- self.histoGroups.append(hist)
-
+ found = False
+ for i in range(len(self.histoGroups)):
+ if index == self.histoGroups[i].varIndex and
self.histoGroups[i].group == 0:
+ found = True
+ if found == False:
+ hist =
Histogram.HistogramGroup(self.panel,self.scene,index,name,3)
+ self.histoGroups.append(hist)
+
+
self.LayoutWindow()
self.BuildHistograms()
self.scene.numFrames = len(self.scene.nrrdFiles)
@@ -372,8 +390,9 @@
def BuildHistograms(self):
for i in range(len(self.histoGroups)):
index = self.histoGroups[i].varIndex
- if index >= self.test.getNumVars():
- print "ERROR: histogram index out of range"
+ hist = self.histoGroups[i]
+ if (hist.group == 0 and index >= self.test.getNumVars()) or
(hist.group == 1 and index > 0):
+ print "ERROR: histogram " + hist.title + " index " +
str(index) + " out of range"
continue
print "building histogram: " + self.histoGroups[i].title
vol = False
@@ -532,15 +551,17 @@
self.sphereVolCMaps.append(manta_new(RGBAColorMap(1)))
self.defaultTransferF = TransferF.TransferF(self, [], 1, "empty",
manta_new(RGBAColorMap(2)))
self.transferFunctions = []
- if True:
+ if self.scene.readConfiguration == False:
id = 0
- self.transferFunctions.append(TransferF.TransferF(self, [], id,
"InvRainbowIso", manta_new(RGBAColorMap(0))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+1, "InvRainbow", manta_new(RGBAColorMap(1))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+2, "Rainbow", manta_new(RGBAColorMap(2))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+3, "InvGrayscale", manta_new(RGBAColorMap(3))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+4, "InvBlackBody", manta_new(RGBAColorMap(4))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+5, "BlackBody", manta_new(RGBAColorMap(5))))
- self.transferFunctions.append(TransferF.TransferF(self, [],
id+6, "GreyScale", manta_new(RGBAColorMap(6))))
+ self.t0 = TransferF.TransferF(self, [], id, "volume",
self.volCMap)
+ self.transferFunctions.append(self.t0)
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+1, "InvRainbowIso", manta_new(RGBAColorMap(0))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+2, "InvRainbow", manta_new(RGBAColorMap(1))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+3, "Rainbow", manta_new(RGBAColorMap(2))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+4, "InvGrayscale", manta_new(RGBAColorMap(3))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+5, "InvBlackBody", manta_new(RGBAColorMap(4))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+6, "BlackBody", manta_new(RGBAColorMap(5))))
+ self.transferFunctions.append(TransferF.TransferF(self, [],
id+7, "GreyScale", manta_new(RGBAColorMap(6))))
self.tPanel = tPanel = TransferF.TransferFGroup(self.panel, 300,
100, self.defaultTransferF, "empty", self.scene)
self.scene.tPanel = tPanel
Modified: trunk/scenes/csafe/src/CDGridSpheres.cc
==============================================================================
--- trunk/scenes/csafe/src/CDGridSpheres.cc (original)
+++ trunk/scenes/csafe/src/CDGridSpheres.cc Wed Mar 18 04:20:14 2009
@@ -616,13 +616,13 @@
void CDGridSpheres::shade(const RenderContext& context, RayPacket& rays)
const
{
// Compute ambient light
- // ColorArray ambient;
- // activeLights->getAmbientLight()->computeAmbient(context, rays, ambient);
+ ColorArray ambient;
+ activeLights->getAmbientLight()->computeAmbient(context, rays, ambient);
// Shade a bunch of rays that have intersected the same particle
- // lambertianShade(context, rays, ambient);
+ lambertianShade(context, rays, ambient);
- _matl->shade(context, rays);
+ //_matl->shade(context, rays);
}
void CDGridSpheres::lambertianShade(const RenderContext& context, RayPacket&
rays, ColorArray& totalLight) const
@@ -677,7 +677,7 @@
Color result;
for (int j=0;j<Color::NumComponents; ++j)
result[j]=totalLight[j][i]*diffuse.colordata[j][i];
- rays.setColor(i, result+rays.getColor(i));
+ rays.setColor(i, result*rays.getColor(i));
}
}
else
Modified: trunk/scenes/csafe/src/CDTest.h
==============================================================================
--- trunk/scenes/csafe/src/CDTest.h (original)
+++ trunk/scenes/csafe/src/CDTest.h Wed Mar 18 04:20:14 2009
@@ -105,6 +105,7 @@
_maxBound = volumeMaxBound;
_stepSize = 0.0015;
_num_vars = 0;
+ _forceVolumeData = false;
}
~CDTest()
@@ -467,9 +468,20 @@
&min[0], &min[1], &min[2], &max[0], &max[1], &max[2]);
printf("\nfound extent: %f %f %f .. %f %f %f\n", min[0],
min[1],
min[2], max[0], max[1], max[2]);
+ _minBound = min;
+ _maxBound = max;
+ _volSize = max - min;
+ _volPosition = min + _volSize/2.0;
}
}
- Volume<float>* mat = new Volume<float>(grid, _volCMap, BBox(min,
max), _stepSize, 3, NULL, _forceDataMin, _forceDataMax);
+ Volume<float>* mat;
+ if (_forceVolumeData)
+ mat = new Volume<float>(grid, _volCMap, BBox(min, max),
_stepSize, 3, NULL, _forceDataMin, _forceDataMax);
+ else
+ {
+ mat = new Volume<float>(grid, _volCMap, BBox(min, max),
_stepSize, 3, NULL);
+
+ }
Cube* vol = new Cube(mat, min, max);
group->add(vol);
//# group->add(vol);
@@ -901,6 +913,7 @@
*/
void setVolColorMinMax(float min, float max)
{
+ _forceVolumeData = true;
_forceDataMin = min;
_forceDataMax = max;
}
@@ -934,18 +947,18 @@
\param returns min
\param returns max
*/
- void getVolDataMinMax(float& min, float& max)
+ void getVolDataMinMax(float* min, float* max)
{
- min = FLT_MAX;
- max = -FLT_MAX;
+ *min = FLT_MAX;
+ *max = -FLT_MAX;
for(int i =0;i<int(_vols.size());i++)
{
if (_vols[i] == NULL)
continue;
double min1, max1;
_vols[i]->getMinMax(&min1, &max1);
- min = std::min(min, float(min1));
- max = std::max(max, float(max1));
+ *min = std::min(*min, float(min1));
+ *max = std::max(*max, float(max1));
}
}
@@ -1133,6 +1146,7 @@
Vector _volPosition, _volSize;
float _stepSize;
int _num_vars;
+ bool _forceVolumeData;
std::vector<std::pair<string, string> > key_value_pairs;
};
- [Manta] r2389 - in trunk: SwigInterface scenes/csafe/python scenes/csafe/src, brownlee, 03/18/2009
Archive powered by MHonArc 2.6.16.