Display a set of lines as specified by the Edge skeleton of a grid.
Display a set of lines as specified by the Edge skeleton of a grid.Refinement levels and fragmented fields not implemented.
#include <bone/FishGrid.hpp>
#include <ocean/GLvish/VGLRenderObject.hpp>
#include <ocean/GLvish/BoundingBox.hpp>
#include <ocean/GLvish/GlossyTexture.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <ocean/shrimp/TimeDependent.hpp>
#include <GL/fieldGL.hpp>
#include <GL/FieldBuffer.hpp>
#include <baseop/ExpandBBox.hpp>
#include <ocean/shrimp/VObjectStatus.hpp>
#include <grid/types/LineSet.hpp>
#include <bundle/BundleProperty.hpp>
#include <GL/LineSetRenderer.hpp>
#include <bone/GridActor.hpp>
namespace
{
{
public:
struct FieldState : State
{
};
RefPtr<State> newState() const override
{
return new FieldState();
}
nLines;
GlossyLines(const string&name, int p, const RefPtr<VCreationPreferences>&VP)
, GlossyParameters(this)
, LineGrid(this, "grid")
, Thickness(this, "thickness", 1.0)
, WhichLine(this, "lineid", -1, 1)
, nLines(this, "nlines", 1, 2)
{
}
void setup(const CreationSlots_t&CreationSlots) override
{
setupTime(CreationSlots);
}
bool update(
VRequest&R,
double precision)
override;
{
return "GlossyLinesOf" + parent_name;
}
};
{
LineGrid << Context >> GS;
double time = SI.getTime();
if (!SI.getGrid())
return setStatusError(
Context,
"No grid object found at T=" +
String(time),
false );
setBoundingBall(
Context, getBoundingBox( *SI.getGrid() ) );
RefPtr<FieldState> S = myState(
Context);
if (!LS)
{
return setStatusError(
Context,
"No line grid found at T=" +
String(time),
false );
}
S->theGridOfInterest = SI.getGrid();
}
{
RefPtr<FieldState> S = getState(
Context);
if (!S) return false;
if (!S->theGridOfInterest)
return false;
RefPtr<ValueSet> GlossyValues =
new ValueSet();
RefPtr<GlossyTexture> LineTexture;
try
{
}
{
Verbose(0) << "Got an GL Exception...";
}
if (!LineTexture)
{
LineTexture->enlighten();
LineTexture->enlighten(GlossyParameters,
Context);
GLCHECK( LineTexture->enlighten );
}
double width = 1.0;
Thickness << Context >> width;
if (width<=0.0) width=0.01;
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glDisable(GL_LIGHTING);
glColor3f(.9,.4,.9);
glEnable( GL_DEPTH_TEST );
glLineWidth(width);
glDisable( GL_BLEND );
glEnable ( GL_COLOR_MATERIAL );
{
RefPtr<ValueSet> myCacheableValues =
new ValueSet();
string VBOKey = "";
RefPtr<VBO> myVBO;
Intercube&CacheObject = *S->theGridOfInterest;
try
{
myVBO =
Context( CacheObject )(
typeid(*this) )( myCacheableValues )(
VERTEXBUFFER(), VBOKey );
}
catch(...){}
Verbose(0) << "glossy lines continue..." << myVBO;
if (!myVBO || !myVBO->getRenderer() ||
(LS.
Coords && myVBO->isOlderThan( *LS.Coords) ) ||
(LS.
LineIndices && myVBO->isOlderThan( *LS.LineIndices) ) )
{
RefPtr<MemBase> Pts = LS.Coords->getData();
if (!Pts)
return false;
RefPtr<BufferArray> VA = GL::FieldBufferVertexArray::create( Pts, true );
myVBO =
Context[ CacheObject ][
typeid(*this) ][ myCacheableValues ] (
VERTEXBUFFER(), VBOKey );
myVBO->clear();
myVBO->append(VA );
#if 1
{
assert( TV->nElements() == Pts->nElements() );
const int TextureUnit = 0;
RefPtr<BufferArray> TCA =
myVBO->append( TCA );
}
#endif
}
RefPtr<GL::LineSetRenderer> R = myVBO->getRenderer();
if (!R)
{
puts("GlossyLines: Renderer Problem");
return false;
}
WhichLine << Context >> R->WhichOneOnly;
nLines << Context >> R->nLines;
myVBO->call();
}
return true;
}
struct GridInspector
{
{
}
};
}
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
Info< Skeleton > getRefinementLevel(double time, int Level, int IndexDepth, const BundlePtr &SpaceTime=BundlePtr(NullPtr()))
Retrieve a skeleton for the given refinement level for the current time.
Definition GridSelector.cpp:14
A set of lines stored on a Grid.
Definition LineSet.hpp:55
index_t NumberOfLines(const RefPtr< FragmentID > &f) const
Return the number of lines stored here.
Definition LineSet.cpp:221
RefPtr< TangentialVector_t > getTangentialVectors(const RefPtr< FragmentID > &f=NullPtr(), const string &FieldName=TangentialVectorFieldName)
Compute tangential vectors in a grid object, which has a set of lines defined.
Definition LineSet.cpp:262
A concrete Grid Property which looks for the existence of a Skeleton of the specified dimension and i...
Definition BundleProperty.hpp:76
bool setProperty(const string &theName, const Type &theValue) 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
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
virtual string createChildname(const string &parent_name) const
Generic template namespace class for results of find() functions throughout the Bundle.
Definition Info.hpp:17
Templated static member function to load data from MemArrays into vertex arrays.
Definition FieldBuffer.hpp:38
Common base class for objects that render information given on line sets, merely for grouping purpose...
Definition eye/retina/LineSetRenderer.hpp:39