For each coordinate field, the bounding box is stored with the field and thus re-used if possible. Also, there might be an field in the same data represention be specified. The bounding box information of this field is then shown in addition. This field may consist of various fragments, such that multiple bounding boxes are shown. The bounding box information is cached at each field fragment.
If values in field coordinates are changed, this is not recognized. Code doing so would have to clear the field's BoundingBox interface.
#include <bone/GridOperatorObject.hpp>
#include <ocean/shrimp/VObjectStatus.hpp>
#include <ocean/shrimp/ColorTypes.hpp>
#include <baseop/ExpandBBox.hpp>
#include <ocean/Anemonia/Programmable.hpp>
#include <ocean/Anemonia/VRenderObject.hpp>
#include <ocean/Anemonia/FloatOrigin.hpp>
#include <grid/CartesianChart.hpp>
namespace
{
{
public:
GridBoundingBox(const string&name, int, const RefPtr<VCreationPreferences>&VP)
, Thickness(this, "thickness", 2.0, 0)
{
}
RefPtr<Fiber::Chart> getChart(
const RefPtr<Fiber::Grid>&G,
const RefPtr<ValuePool>&
Context)
const
{
myChart << Context >> theChart;
}
bool update(
VRequest&R,
double precision)
override;
{
return "BoundingBoxOf" + obj;
}
{
return default_vertex_shader;
}
{
return
"uniform vec4 Color;\n"
"void main (void)\n"
"{\n"
" gl_FragColor = Color;\n"
"}\n"
;
}
};
{
int nLevel = getMaxRefinementLevel(
Context);
if (!Level.getSkeleton() )
{
if (nLevel>0)
return setStatusError(
Context,
"No Vertices found on this grid's level.",
false);
else
return setStatusError(
Context,
"No Vertices found on this grid.",
false);
}
RefPtr<Grid> G = Level.getGrid();
if (!G)
return setStatusError(
Context,
"No Grid found");
RefPtr<Fiber::Chart> myChart = getChart(G,
Context);
if (!myChart)
{
return setStatusError(
Context,
"No Cartesian Coordinates Available.",
false);
}
RefPtr<Field> Coords = Level.getSkeleton()->getField(myChart, FIBER_POSITIONS);
if (!Coords)
return setStatusError(
Context,
"No Coordinates");
if (RefPtr<BoundingBox> BBox = getBoundingBox( Coords ) )
{
}
else
return setStatusError(
Context,
"No Bounding box");
}
{
RefPtr<BoundingBox> MyBBox = getBoundingBall(
Context );
if (!MyBBox or MyBBox->empty() )
return true;
Eagle::tvector3 TranslationVector;
VRenderContext::ModelViewState
MVS = getCoordinateTranslation(
Context, TranslationVector) ;
point
P0 = MyBBox->mincoord() - TranslationVector,
P1 = MyBBox->maxcoord() - TranslationVector;
P000 (
P0.x(),
P0.y(),
P0.z() ),
P001 (
P0.x(),
P0.y(),
P1.z() ),
P010 (
P0.x(),
P1.y(),
P0.z() ),
P011 (
P0.x(),
P1.y(),
P1.z() ),
P100 (
P1.x(),
P0.y(),
P0.z() ),
P101 (
P1.x(),
P0.y(),
P1.z() ),
P110 (
P1.x(),
P1.y(),
P0.z() ),
P111 (
P1.x(),
P1.y(),
P1.z() );
size_t i = 0;
RefPtr<RenderBasin::Program>
ShaderProgram = CompileShader(
Context,
"GridBoundingBox" );
if (!ShaderProgram)
return true;
if (RefPtr<RenderBasin::VertexAttribute> BoxVertices =
{
RenderAnemone->insert( BoxVertices );
RenderAnemone->insert( ShaderProgram );
Color << Context >> color;
RenderAnemone->insert(
Context.createRenderParameter(
"Color", color) );
double width = 2.0;
Thickness << Context >> width;
RenderAnemone->insert(
Context.createRenderParameter(
"glLineWidth", width ) );
RenderAnemone->insert(
Context.Enable(
"GL_LINE_SMOOTH") );
RenderAnemone->insert(
Context.Enable(
"GL_DEPTH_TEST") );
RenderAnemone->insert(
Context.Disable(
"GL_LIGHTING") );
RenderAnemone->wave();
return true;
}
else
{
puts("void GridBoundingBox: CANNOT Create a vertex attribute?");
return true;
}
}
myCreator(
+ VIdentifier("BoundingBox")
+
Help(
"Display the bounding volume of the grid object.")
+
Description(
"Display the boundaries of the data volume occupied "
"by the specific Grid object for the most recent time step. "
"Multiple refinement levels are supported, taking the most recent "
"refinement level for a given time. "
)
,
}
Chart object for cartesian coordinates.
Definition CartesianChart.hpp:15
Identify the edges on a skeleton within a Grid.
Definition Edges.hpp:35
Information per time slice, mainly a set of Grid objects that are accessed via GridID objects.
Definition Slice.hpp:36
bool setProperty(const string &theName, const Type &theValue) const
string String(const T &Val)
MemCore::RefPtr< Eagle::BoundingBox > VBoundingBox
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Wizt::VCreatorProperty< Wizt::VCreatorProperties::DESCRIPTION > Description
Wizt::VCreatorProperty< Wizt::VCreatorProperties::SHORTHELP > Help
Wizt::VCreatorProperty< Wizt::VCreatorProperties::CATEGORY > Category
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
virtual string createChildname(const string &parent_name) const
Definition GridInspector.hpp:13
Generic template namespace class for results of find() functions throughout the Bundle.
Definition Info.hpp:17
Convenience class for objects operating on Grid objects.
Definition GridOperatorObject.hpp:23