Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Boonthanome Nouanesengsy
VTK
Commits
091552c1
Commit
091552c1
authored
Aug 05, 2015
by
Ken Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to adjust the table size
parent
edc24bde
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
Rendering/Core/vtkPointGaussianMapper.cxx
Rendering/Core/vtkPointGaussianMapper.cxx
+2
-0
Rendering/Core/vtkPointGaussianMapper.h
Rendering/Core/vtkPointGaussianMapper.h
+7
-0
Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapperOpacity.cxx
...ng/OpenGL2/Testing/Cxx/TestPointGaussianMapperOpacity.cxx
+2
-0
Rendering/OpenGL2/vtkOpenGLPointGaussianMapper.cxx
Rendering/OpenGL2/vtkOpenGLPointGaussianMapper.cxx
+8
-5
No files found.
Rendering/Core/vtkPointGaussianMapper.cxx
View file @
091552c1
...
...
@@ -30,6 +30,7 @@ vtkPointGaussianMapper::vtkPointGaussianMapper()
this
->
ScalarOpacityFunction
=
0
;
this
->
DefaultRadius
=
1.0
;
this
->
Emissive
=
1
;
this
->
OpacityTableSize
=
1024
;
}
//-----------------------------------------------------------------------------
...
...
@@ -51,4 +52,5 @@ void vtkPointGaussianMapper::PrintSelf(ostream& os, vtkIndent indent)
os
<<
indent
<<
"SplatShaderCode: "
<<
(
this
->
SplatShaderCode
?
this
->
SplatShaderCode
:
"(none)"
)
<<
"
\n
"
;
os
<<
indent
<<
"Default Radius: "
<<
this
->
DefaultRadius
<<
"
\n
"
;
os
<<
indent
<<
"Emissive: "
<<
this
->
Emissive
<<
"
\n
"
;
os
<<
indent
<<
"OpacityTableSize: "
<<
this
->
OpacityTableSize
<<
"
\n
"
;
}
Rendering/Core/vtkPointGaussianMapper.h
View file @
091552c1
...
...
@@ -57,6 +57,12 @@ public:
void
SetScalarOpacityFunction
(
vtkPiecewiseFunction
*
);
vtkGetObjectMacro
(
ScalarOpacityFunction
,
vtkPiecewiseFunction
);
// Description:
// The size of the table used in computing opacities, used when
// converting a vtkPiecewiseFunction to a table
vtkSetMacro
(
OpacityTableSize
,
int
);
vtkGetMacro
(
OpacityTableSize
,
int
);
// Description:
// Method to set the optional opacity array. If specified this
// array will be used to generate the opacity values.
...
...
@@ -86,6 +92,7 @@ protected:
double
DefaultRadius
;
int
Emissive
;
int
OpacityTableSize
;
private:
vtkPointGaussianMapper
(
const
vtkPointGaussianMapper
&
);
// Not implemented.
...
...
Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapperOpacity.cxx
View file @
091552c1
...
...
@@ -92,6 +92,8 @@ int TestPointGaussianMapperOpacity(int argc, char *argv[])
mapper
->
EmissiveOff
();
// show other shader examples
// the fragment that is rendered is that of a triangle
// large enough to encompass a circle of radius 3
mapper
->
SetSplatShaderCode
(
// this first line keeps the default color opacity calcs
// which you can then modify with additional code below
...
...
Rendering/OpenGL2/vtkOpenGLPointGaussianMapper.cxx
View file @
091552c1
...
...
@@ -597,13 +597,14 @@ void vtkOpenGLPointGaussianMapperHelper::BuildOpacityArray(vtkPolyData *poly)
// if a piecewise function was provided, use it to map the opacities
vtkPiecewiseFunction
*
pwf
=
this
->
Owner
->
GetScalarOpacityFunction
();
float
table
[
1025
];
int
tableSize
=
this
->
Owner
->
GetOpacityTableSize
();
float
*
table
=
new
float
[
tableSize
+
1
];
if
(
pwf
)
{
// build the interpolation table
pwf
->
GetTable
(
range
[
0
],
range
[
1
],
1024
,
table
);
pwf
->
GetTable
(
range
[
0
],
range
[
1
],
tableSize
,
table
);
// duplicate the last value for bilinear interp edge case
table
[
1024
]
=
table
[
1023
];
table
[
tableSize
]
=
table
[
tableSize
-
1
];
}
vtkCellArray
*
verts
=
poly
->
GetVerts
();
...
...
@@ -619,7 +620,7 @@ void vtkOpenGLPointGaussianMapperHelper::BuildOpacityArray(vtkPolyData *poly)
float
value
=
oda
->
GetComponent
(
indices
[
i
],
0
);
if
(
pwf
)
{
float
index
=
1023
.0
*
(
value
-
range
[
0
])
/
(
range
[
1
]
-
range
[
0
]);
float
index
=
(
tableSize
-
1
.0
)
*
(
value
-
range
[
0
])
/
(
range
[
1
]
-
range
[
0
]);
int
iindex
=
static_cast
<
int
>
(
index
);
value
=
(
1.0
-
index
+
iindex
)
*
table
[
iindex
]
+
(
index
-
iindex
)
*
table
[
iindex
+
1
];
}
...
...
@@ -636,7 +637,7 @@ void vtkOpenGLPointGaussianMapperHelper::BuildOpacityArray(vtkPolyData *poly)
float
value
=
oda
->
GetComponent
(
i
,
0
);
if
(
pwf
)
{
float
index
=
1023
.0
*
(
value
-
range
[
0
])
/
(
range
[
1
]
-
range
[
0
]);
float
index
=
(
tableSize
-
1
.0
)
*
(
value
-
range
[
0
])
/
(
range
[
1
]
-
range
[
0
]);
int
iindex
=
static_cast
<
int
>
(
index
);
value
=
(
1.0
-
index
+
iindex
)
*
table
[
iindex
]
+
(
index
-
iindex
)
*
table
[
iindex
+
1
];
}
...
...
@@ -644,6 +645,8 @@ void vtkOpenGLPointGaussianMapperHelper::BuildOpacityArray(vtkPolyData *poly)
count
++
;
}
}
delete
[]
table
;
}
//-------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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