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
Andrew Bauer
VTK
Commits
53320c25
Commit
53320c25
authored
Sep 12, 1994
by
Will Schroeder
Browse files
ENH: Changed memory model.
parent
ef9c4593
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/DSMapper.hh
View file @
53320c25
...
...
@@ -43,6 +43,7 @@ public:
// Description:
// Specify the input data to map.
virtual
void
SetInput
(
vlDataSet
*
in
);
void
SetInput
(
vlDataSet
&
in
)
{
this
->
SetInput
(
&
in
);};
virtual
vlDataSet
*
GetInput
();
protected:
...
...
include/Mapper.hh
View file @
53320c25
...
...
@@ -50,16 +50,13 @@ public:
// as each frame is rendered.
virtual
void
Render
(
vlRenderer
*
)
=
0
;
// Description:
// Return bounding box of data in terms of (xmin,xmax, ymin,ymax, zmin,zmax).
// Used in the rendering process to automatically create a camera in the
// proper initial configuration.
virtual
float
*
GetBounds
()
=
0
;
void
SetLookupTable
(
vlLookupTable
*
lut
);
vlGetObjectMacro
(
LookupTable
,
vlLookupTable
);
// Description:
//
Specify a lookup table for the mapper to use.
vlSetObjectMacro
(
LookupTable
,
vlLookupT
able
);
v
lGetObjectMacro
(
LookupTable
,
vl
LookupTable
);
//
Create default lookup table. Generally used to create one when none
// is avail
able
.
v
irtual
void
CreateDefault
LookupTable
(
);
// Description:
// Turn on/off flag to control whether scalar data is used to color objects.
...
...
@@ -73,6 +70,12 @@ public:
vlSetVector2Macro
(
ScalarRange
,
float
)
vlGetVectorMacro
(
ScalarRange
,
float
)
// Description:
// Return bounding box of data in terms of (xmin,xmax, ymin,ymax, zmin,zmax).
// Used in the rendering process to automatically create a camera in the
// proper initial configuration.
virtual
float
*
GetBounds
()
=
0
;
protected:
void
(
*
StartRender
)(
void
*
);
void
*
StartRenderArg
;
...
...
@@ -82,6 +85,7 @@ protected:
int
ScalarsVisible
;
vlTimeStamp
BuildTime
;
float
ScalarRange
[
2
];
int
SelfCreatedLookupTable
;
};
...
...
include/PolyMap.hh
View file @
53320c25
...
...
@@ -40,6 +40,7 @@ public:
// Description:
// Specify the input data to map.
virtual
void
SetInput
(
vlPolyData
*
in
);
void
SetInput
(
vlPolyData
&
in
)
{
this
->
SetInput
(
&
in
);};
virtual
vlPolyData
*
GetInput
();
// Description:
...
...
@@ -72,10 +73,14 @@ protected:
vlGeometryPrimitive
*
Lines
;
vlGeometryPrimitive
*
Polys
;
vlGeometryPrimitive
*
Strips
;
vlRGBArray
*
Colors
;
int
VertsVisibility
;
int
LinesVisibility
;
int
PolysVisibility
;
int
StripsVisibility
;
};
#endif
...
...
src/Actor.cc
View file @
53320c25
...
...
@@ -55,7 +55,6 @@ vlActor::vlActor()
vlActor
::~
vlActor
()
{
if
(
this
->
Mapper
)
this
->
Mapper
->
UnRegister
(
this
);
}
// Description:
...
...
src/DSMapper.cc
View file @
53320c25
...
...
@@ -13,9 +13,6 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Methods to map abstract DataSet through concrete mappers.
//
#include
"DSMapper.hh"
#include
"PolyMap.hh"
...
...
@@ -28,20 +25,9 @@ vlDataSetMapper::vlDataSetMapper()
vlDataSetMapper
::~
vlDataSetMapper
()
{
if
(
this
->
Input
)
{
this
->
Input
->
UnRegister
(
this
);
}
if
(
this
->
GeometryExtractor
)
{
this
->
GeometryExtractor
->
UnRegister
(
this
);
}
if
(
this
->
PolyMapper
)
{
this
->
PolyMapper
->
UnRegister
(
this
);
}
// delete internally created objects.
if
(
this
->
GeometryExtractor
)
delete
this
->
GeometryExtractor
;
if
(
this
->
PolyMapper
)
this
->
PolyMapper
;
}
void
vlDataSetMapper
::
SetInput
(
vlDataSet
*
in
)
...
...
@@ -49,7 +35,6 @@ void vlDataSetMapper::SetInput(vlDataSet *in)
if
(
in
!=
this
->
Input
)
{
this
->
Input
=
in
;
this
->
Input
->
Register
(
this
);
this
->
Modified
();
}
}
...
...
@@ -89,7 +74,7 @@ void vlDataSetMapper::Render(vlRenderer *ren)
//
// Need a lookup table
//
if
(
!
this
->
LookupTable
)
this
->
SetLookupTable
(
new
vl
LookupTable
);
if
(
this
->
LookupTable
==
NULL
)
this
->
CreateDefault
LookupTable
(
);
this
->
LookupTable
->
Build
();
//
// Now can create appropriate mapper
...
...
@@ -101,10 +86,7 @@ void vlDataSetMapper::Render(vlRenderer *ren)
pm
->
SetInput
(
gf
);
this
->
GeometryExtractor
=
gf
;
this
->
GeometryExtractor
->
Register
(
this
);
this
->
PolyMapper
=
pm
;
this
->
PolyMapper
->
Register
(
this
);
}
// update ourselves in case something has changed
...
...
@@ -114,7 +96,6 @@ void vlDataSetMapper::Render(vlRenderer *ren)
this
->
GeometryExtractor
->
SetInput
(
this
->
Input
);
this
->
PolyMapper
->
Render
(
ren
);
}
void
vlDataSetMapper
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
...
...
src/Mapper.cc
View file @
53320c25
...
...
@@ -28,14 +28,14 @@ vlMapper::vlMapper()
this
->
ScalarsVisible
=
1
;
this
->
ScalarRange
[
0
]
=
0.0
;
this
->
ScalarRange
[
1
]
=
1.0
;
this
->
SelfCreatedLookupTable
=
0
;
}
vlMapper
::~
vlMapper
()
{
if
(
this
->
LookupTable
)
{
this
->
LookupTable
->
UnRegister
(
this
);
}
if
(
this
->
SelfCreatedLookupTable
&&
this
->
LookupTable
!=
NULL
)
delete
this
->
LookupTable
;
}
// Description:
...
...
@@ -92,6 +92,26 @@ void vlMapper::SetEndRender(void (*f)(void *), void *arg)
}
}
// Description:
// Specify a lookup table for the mapper to use.
void
vlMapper
::
SetLookupTable
(
vlLookupTable
*
lut
)
{
if
(
this
->
LookupTable
!=
lut
)
{
if
(
this
->
SelfCreatedLookupTable
)
delete
this
->
LookupTable
;
this
->
SelfCreatedLookupTable
=
0
;
this
->
LookupTable
=
lut
;
this
->
Modified
();
}
}
void
vlMapper
::
CreateDefaultLookupTable
()
{
if
(
this
->
SelfCreatedLookupTable
)
delete
this
->
LookupTable
;
this
->
LookupTable
=
new
vlLookupTable
;
this
->
SelfCreatedLookupTable
=
1
;
}
void
vlMapper
::
PrintSelf
(
ostream
&
os
,
vlIndent
indent
)
{
if
(
this
->
ShouldIPrint
(
vlMapper
::
GetClassName
()))
...
...
src/PolyMap.cc
View file @
53320c25
...
...
@@ -25,6 +25,8 @@ vlPolyMapper::vlPolyMapper()
this
->
Lines
=
NULL
;
this
->
Polys
=
NULL
;
this
->
Strips
=
NULL
;
this
->
Colors
=
NULL
;
this
->
VertsVisibility
=
1
;
this
->
LinesVisibility
=
1
;
this
->
PolysVisibility
=
1
;
...
...
@@ -33,10 +35,12 @@ vlPolyMapper::vlPolyMapper()
vlPolyMapper
::~
vlPolyMapper
()
{
if
(
this
->
Input
!=
NULL
)
{
this
->
Input
->
UnRegister
(
this
);
}
//delete internally created objects
if
(
this
->
Verts
!=
NULL
)
delete
this
->
Verts
;
if
(
this
->
Lines
!=
NULL
)
delete
this
->
Lines
;
if
(
this
->
Polys
!=
NULL
)
delete
this
->
Polys
;
if
(
this
->
Strips
!=
NULL
)
delete
this
->
Strips
;
if
(
this
->
Colors
!=
NULL
)
delete
this
->
Colors
;
}
void
vlPolyMapper
::
SetInput
(
vlPolyData
*
in
)
...
...
@@ -44,7 +48,6 @@ void vlPolyMapper::SetInput(vlPolyData *in)
if
(
in
!=
this
->
Input
)
{
this
->
Input
=
in
;
this
->
Input
->
Register
(
this
);
this
->
Modified
();
}
}
...
...
@@ -74,7 +77,6 @@ float *vlPolyMapper::GetBounds()
void
vlPolyMapper
::
Render
(
vlRenderer
*
ren
)
{
vlPointData
*
pd
;
vlRGBArray
*
colors
;
vlScalars
*
scalars
;
int
i
;
char
forceBuild
=
0
;
...
...
@@ -89,9 +91,8 @@ void vlPolyMapper::Render(vlRenderer *ren)
else
this
->
Input
->
Update
();
if
(
!
this
->
LookupTable
)
this
->
SetLookupTable
(
new
vl
LookupTable
);
if
(
this
->
LookupTable
==
NULL
)
this
->
CreateDefault
LookupTable
(
);
this
->
LookupTable
->
Build
();
//
// Now send data down to primitives and draw it
//
...
...
@@ -104,39 +105,40 @@ void vlPolyMapper::Render(vlRenderer *ren)
if
(
this
->
ScalarsVisible
&&
(
pd
=
this
->
Input
->
GetPointData
())
&&
(
scalars
=
pd
->
GetScalars
())
)
{
c
olors
=
new
vlRGBArray
;
c
olors
->
Allocate
(
this
->
Input
->
GetNumberOfPoints
());
if
(
this
->
Colors
==
NULL
)
this
->
C
olors
=
new
vlRGBArray
;
this
->
C
olors
->
Allocate
(
this
->
Input
->
GetNumberOfPoints
());
this
->
LookupTable
->
SetTableRange
(
this
->
ScalarRange
);
for
(
i
=
0
;
i
<
this
->
Input
->
GetNumberOfPoints
();
i
++
)
{
c
olors
->
SetColor
(
i
,
this
->
LookupTable
->
MapValue
(
scalars
->
GetScalar
(
i
)));
this
->
C
olors
->
SetColor
(
i
,
this
->
LookupTable
->
MapValue
(
scalars
->
GetScalar
(
i
)));
}
}
else
{
colors
=
NULL
;
if
(
this
->
Colors
)
delete
this
->
Colors
;
this
->
Colors
=
NULL
;
}
if
(
this
->
VertsVisibility
&&
this
->
Input
->
GetNumberOfVerts
())
{
if
(
!
this
->
Verts
)
this
->
Verts
=
ren
->
GetPrimitive
(
"points"
);
this
->
Verts
->
Build
(
this
->
Input
,
c
olors
);
this
->
Verts
->
Build
(
this
->
Input
,
this
->
C
olors
);
}
if
(
this
->
LinesVisibility
&&
this
->
Input
->
GetNumberOfLines
())
{
if
(
!
this
->
Lines
)
this
->
Lines
=
ren
->
GetPrimitive
(
"lines"
);
this
->
Lines
->
Build
(
this
->
Input
,
c
olors
);
this
->
Lines
->
Build
(
this
->
Input
,
this
->
C
olors
);
}
if
(
this
->
PolysVisibility
&&
this
->
Input
->
GetNumberOfPolys
())
{
if
(
!
this
->
Polys
)
this
->
Polys
=
ren
->
GetPrimitive
(
"polygons"
);
this
->
Polys
->
Build
(
this
->
Input
,
c
olors
);
this
->
Polys
->
Build
(
this
->
Input
,
this
->
C
olors
);
}
if
(
this
->
StripsVisibility
&&
this
->
Input
->
GetNumberOfStrips
())
{
if
(
!
this
->
Strips
)
this
->
Strips
=
ren
->
GetPrimitive
(
"triangle_strips"
);
this
->
Strips
->
Build
(
this
->
Input
,
c
olors
);
this
->
Strips
->
Build
(
this
->
Input
,
this
->
C
olors
);
}
this
->
BuildTime
.
Modified
();
...
...
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