FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Dreibein.cpp
#include <bone/FishSlice.hpp>
#include <bone/FishGrid.hpp>
#include <bone/FishSkeleton.hpp>
#include <ocean/GLvish/VGLRenderObject.hpp>
#include <ocean/GLvish/BoundingBox.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <ocean/shrimp/VEnum.hpp>
#include <baseop/ExpandBBox.hpp>
#include <ocean/GLvish/GlossyTexture.hpp>
using namespace Wizt;
using namespace Fiber;
using namespace Eagle;
class DreiBein : public virtual VGLRenderObject,
public GlossyLines,
public virtual Fish<Slice>,
public virtual Fish<Grid>,
public virtual Fish<Skeleton>
{
public:
struct FieldState : State
{
};
RefPtr<State> newState() const override
{
return new FieldState();
}
TypedSlot<int> Thickness;
DreiBein(const string&name, int p, const RefPtr<VCreationPreferences>&VP)
, GlossyLines(this)
, Thickness(this, "thickness", 50, 0)
, Options(this, "options", VEnum("shaded", "monochrome"), 1)
{}
bool update(VRequest&R, double precision) override;
bool renderGL(VGLRenderContext&Context) const override;
};
/*
Update function: evaluates the current parameter settings
and determines the bounding box information for the entire
representation, plus the field fragments if a field is
specified.
*/
bool DreiBein::update(VRequest&R, double precision)
{
Info<Skeleton> Level = getRefinementLevel(0, R);
if (!Level.getSkeleton() )
{
printf("BoundingBox: update(): No level!\n");
if (S)
{
S->BBox = NullPtr();
}
return true;
}
RefPtr<Representation> LevelRep = Level.getCartesianRepresentation();
assert( LevelRep );
RefPtr<Field> Coords = LevelRep->Positions();
if (!Coords)
return setStatusError(R, "No Coordinates");
if (RefPtr<BoundingBox> BBox = getBoundingBox( Coords ) )
{
// printf(" Fish::BoundingBox([%s]): SETTING BBOX for Context\n", Name().c_str() );
setBoundingBall(R, BBox);
// R.GhostValues.speak("BoundingBox::GhostValues");
S->BBox = BBox;
setBoundingBall(R, BBox);
return setStatusInfo(R, "Bounding box" + String( BBox ) );
}
else
return setStatusError(R, "No Bounding box");
}
/*
The OpenGL render routine.
Retrieves the field state information, draws the
global bounding box of the coordinate field,
plus local bounding boxes for all fragments of the
specified fields.
*/
bool DreiBein::renderGL(VGLRenderContext&Context) const
{
if (!myState)
return false;
if (!MyBBox)
return false;
if (MyBBox->empty() )
return false;
using namespace Eagle::PhysicalSpace;
const point&Min = MyBBox->mincoord(),
&Max = MyBBox->maxcoord();
if (opt("shaded"))
LineTexture = getLineTexture( *myState, Context);
int width = 20;
glLineWidth(width/10.0);
glPointSize(width/10.0);
point X( Max.x(), Min.y(), Min.z() ),
Y( Min.x(), Max.y(), Min.z() ),
Z( Min.x(), Min.y(), Max.z() );
{
GlossyTexture::Render LINERENDER( LineTexture, Context.getCameraSettings(), true );
glColor3f( 1.0, 0.0, 0.0);
glVertex(Min);
glVertex(X);
glColor3f( 0.0, 1.0, 0.0);
glVertex(Min);
glVertex(Y);
glColor3f( 0.0, 0.0, 1.0);
glVertex(Min);
glVertex(Z);
glEnd();
}
return true;
}
myDreiBeinCreator( "Display/Dreibein", ObjectQuality::EXPERIMENTAL );
Definition Dreibein.cpp:29
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
RefPtr< GlossyTexture > getLineTexture(MemCore::Intercube &CacheObject, VGLRenderContext &Context, int TextureUnit=0) const
void setBoundingBall(const RefPtr< ValuePool > &VP, const RefPtr< BoundingBall > &BS) const
RefPtr< State > myState(const WeakPtr< ValuePool > &Context) const
RefPtr< State > & getState(const WeakPtr< ValuePool > &VP) const
string String(const T &Val)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
std::nullptr_t NullPtr
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
DEFAULT_OBJECT
Definition Lytica.hpp:7
bool setStatusInfo(const RefPtr< ValuePool > &Context, const string &what) const
bool setStatusError(const RefPtr< ValuePool > &Context, const string &what, bool AnnouncePublic=false) const