Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Carson Brownlee
VTK
Commits
c2654cdd
Commit
c2654cdd
authored
May 01, 2020
by
Carson Brownlee
Browse files
code cleanup
parent
3d45971d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Rendering/RayTracing/CMakeLists.txt
View file @
c2654cdd
...
...
@@ -61,8 +61,6 @@ if (VTK_ENABLE_OSPRAY)
vtk_module_link
(
VTK::RenderingRayTracing
PUBLIC
ospray::ospray
ospray::ospray_module_ispc
openvkl::openvkl_module_ispc_driver
)
if
(
VTKOSPRAY_ENABLE_DENOISER
)
vtk_module_find_package
(
...
...
Rendering/RayTracing/vtkOSPRayPolyDataMapperNode.cxx
View file @
c2654cdd
...
...
@@ -112,16 +112,7 @@ void CellMaterials(vtkOSPRayRendererNode* orn, OSPRenderer oRenderer, vtkPolyDat
float
localOpacity
=
1.
f
;
if
(
width
>=
4
)
{
double
*
color
=
vColors
->
GetTuple
(
i
);
OSPMaterial
oMaterial
;
oMaterial
=
vtkOSPRayMaterialHelpers
::
NewMaterial
(
orn
,
oRenderer
,
"obj"
);
float
diffusef
[]
=
{
static_cast
<
float
>
(
color
[
0
])
/
(
255.0
f
),
static_cast
<
float
>
(
color
[
1
])
/
(
255.0
f
),
static_cast
<
float
>
(
color
[
2
])
/
(
255.0
f
)
};
float
localOpacity
=
1.
f
;
if
(
width
>=
4
)
{
localOpacity
=
static_cast
<
float
>
(
color
[
3
])
/
(
255.0
f
);
}
localOpacity
=
static_cast
<
float
>
(
color
[
3
])
/
(
255.0
f
);
ospSetVec3f
(
oMaterial
,
"kd"
,
diffusef
[
0
],
diffusef
[
1
],
diffusef
[
2
]);
float
specAdjust
=
2.0
f
/
(
2.0
f
+
specPower
);
float
specularf
[]
=
{
specColor
[
0
]
*
specAdjust
,
specColor
[
1
]
*
specAdjust
,
...
...
@@ -813,7 +804,9 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
vtkPolyDataMapperNode
::
TransformPoints
(
act
,
poly
,
_vertices
);
size_t
numPositions
=
_vertices
.
size
()
/
3
;
if
(
numPositions
==
0
)
{
return
;
}
std
::
vector
<
osp
::
vec3f
>
vertices
(
numPositions
);
for
(
size_t
i
=
0
;
i
<
numPositions
;
i
++
)
{
...
...
@@ -1224,10 +1217,8 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
}
}
}
if
(
position
)
ospRelease
(
position
);
if
(
cellMaterials
)
ospRelease
(
cellMaterials
);
ospRelease
(
position
);
ospRelease
(
cellMaterials
);
for
(
auto
it
:
mats
)
{
...
...
Rendering/RayTracing/vtkOSPRayRendererNode.cxx
View file @
c2654cdd
...
...
@@ -969,13 +969,6 @@ void vtkOSPRayRendererNode::PrintSelf(ostream& os, vtkIndent indent)
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
}
// triangle mesh data
static
std
::
vector
<
float
>
vertexTest
=
{
-
1.0
f
,
-
1.0
f
,
3.0
f
,
-
1.0
f
,
1.0
f
,
3.0
f
,
1.0
f
,
-
1.0
f
,
3.0
f
,
0.1
f
,
0.1
f
,
0.3
f
};
static
std
::
vector
<
float
>
colorTest
=
{
0.9
f
,
0.5
f
,
0.5
f
,
1.0
f
,
0.8
f
,
0.8
f
,
0.8
f
,
1.0
f
,
0.8
f
,
0.8
f
,
0.8
f
,
1.0
f
,
0.5
f
,
0.9
f
,
0.5
f
,
1.0
f
};
static
std
::
vector
<
int32_t
>
indexTest
=
{
0
,
1
,
2
,
1
,
2
,
3
};
//----------------------------------------------------------------------------
void
vtkOSPRayRendererNode
::
Traverse
(
int
operation
)
{
...
...
@@ -1016,7 +1009,9 @@ void vtkOSPRayRendererNode::Traverse(int operation)
RTW
::
Backend
*
backend
=
this
->
Internal
->
Backend
;
if
(
backend
==
nullptr
)
{
return
;
}
// lights
// TODO: Carson: free lights
...
...
Rendering/RayTracing/vtkOSPRayVolumeMapperNode.cxx
View file @
c2654cdd
...
...
@@ -368,6 +368,7 @@ void vtkOSPRayVolumeMapperNode::UpdateTransferFunction(
vtkVolumeProperty
*
volProperty
=
vol
->
GetProperty
();
vtkColorTransferFunction
*
colorTF
=
volProperty
->
GetRGBTransferFunction
(
0
);
vtkPiecewiseFunction
*
scalarTF
=
volProperty
->
GetScalarOpacity
(
0
);
vtkVolumeMapper
*
mapper
=
vtkVolumeMapper
::
SafeDownCast
(
this
->
GetRenderable
());
this
->
TFVals
.
resize
(
this
->
NumColors
*
3
);
this
->
TFOVals
.
resize
(
this
->
NumColors
);
...
...
@@ -385,31 +386,32 @@ void vtkOSPRayVolumeMapperNode::UpdateTransferFunction(
colorTF
->
GetTable
(
tfRangeD
[
0
],
tfRangeD
[
1
],
this
->
NumColors
,
&
this
->
TFVals
[
0
]);
// todo: samplingStep should be adjusted for AMR/unstructured
float
scalarOpacityUnitDistance
=
volProperty
->
GetScalarOpacityUnitDistance
();
if
(
scalarOpacityUnitDistance
<
1e-29
)
// avoid div by 0
if
(
mapper
->
GetBlendMode
()
!=
vtkVolumeMapper
::
ISOSURFACE_BLEND
)
{
scalarOpacityUnitDistance
=
1e-29
;
}
for
(
int
i
=
0
;
i
<
this
->
NumColors
;
i
++
)
{
this
->
TFOVals
[
i
]
=
this
->
TFOVals
[
i
]
/
scalarOpacityUnitDistance
*
this
->
SamplingStep
;
float
scalarOpacityUnitDistance
=
volProperty
->
GetScalarOpacityUnitDistance
();
if
(
scalarOpacityUnitDistance
<
1e-29
)
// avoid div by 0
{
scalarOpacityUnitDistance
=
1e-29
;
}
for
(
int
i
=
0
;
i
<
this
->
NumColors
;
i
++
)
{
this
->
TFOVals
[
i
]
=
this
->
TFOVals
[
i
]
/
scalarOpacityUnitDistance
*
this
->
SamplingStep
;
}
}
// if (this->TransferFunction)
// ospRelease(this->TransferFunction);
this
->
TransferFunction
=
ospNewTransferFunction
(
"piecewiseLinear"
);
OSPData
colorData
=
ospNewCopyData1D
(
this
->
NumColors
,
OSP_VEC3F
,
&
this
->
TFVals
[
0
]);
ospCommit
(
colorData
);
ospSetObject
(
this
->
TransferFunction
,
"color"
,
colorData
);
//
ospRelease(colorData);
ospRelease
(
colorData
);
ospSetVec2f
(
this
->
TransferFunction
,
"valueRange"
,
tfRange
.
x
,
tfRange
.
y
);
OSPData
tfAlphaData
=
ospNewCopyData1D
(
this
->
NumColors
,
OSP_FLOAT
,
&
this
->
TFOVals
[
0
]);
ospCommit
(
tfAlphaData
);
ospSetObject
(
this
->
TransferFunction
,
"opacity"
,
tfAlphaData
);
//
ospRelease(tfAlphaData);
ospRelease
(
tfAlphaData
);
ospCommit
(
this
->
TransferFunction
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment