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 <ocean/plankton/VPipeline.hpp>
#include <ocean/GLvish/VGLRenderObject.hpp>
#include <ocean/GLvish/BoundingBox.hpp>
#include <ocean/GLvish/VGLColormap.hpp>
#include <ocean/GLvish/GlossyTexture.hpp>
#include <ocean/GLvish/ArrayTypes.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <ocean/shrimp/VEnum.hpp>
#include <ocean/shrimp/TimeDependent.hpp>
#include <ocean/shrimp/VObjectStatus.hpp>
#include <ocean/shrimp/EaglePhysicalSpaceTVector.hpp>
#include <ocean/Anemonia/FloatOrigin.hpp>
#include <GL/FieldBuffer.hpp>
#include <GL/LineSetRenderer.hpp>
#include <bone/GridActor.hpp>
#include <bone/GridObject.hpp>
#include <bone/FishField.hpp>
#include <bundle/BundleProperty.hpp>
#include <grid/types/LineSet.hpp>
#include <baseop/ExpandBBox.hpp>
#include <baseop/GridField.hpp>
#include <fiberop/Range.hpp>
#include <field/ArrayRef.hpp>
#include <memcore/Chunk.hpp>
namespace
{
{
public:
{}
void enlighten()
{
double p;
for(int i = 0; i < 512 ; i++)
{
col[0] = (1-p)*color1[0] + p*color2[0];
col[1] = (1-p)*color1[1] + p*color2[1];
col[2] = (1-p)*color1[2] + p*color2[2];
}
create_and_bind();
}
{
enable();
}
};
{
struct FieldState : State
{
};
{
return new FieldState();
}
{
{
S->fragments.clear();
}
{
if(!f)
return false;
S->fragments.push_back( f );
return true;
}
} ;
public:
enum { NumberOfInputFields = 1 };
{
{
}
};
, GlossyParameters(this)
, InputField(this, "field" )
, LineWidth(this, "linewidth", 2.0, 1)
, ColStart(this, "col_start", {0.0, 1.0, 0.0, 1.0},2)
, ColEnd (this, "col_end" , {1.0, 0.0, 0.0, 1.0},2)
, GhostyLines(
this,
"ghostylines",
Enum(
"off",
"on"),3 )
, InputRange(
this,
"range",
Range(0,1), 0)
{
}
{
}
bool update(
VRequest&R,
double precision)
override;
static string createChildname(
const string&
parent_name)
{
}
};
{
{
return setStatusError(
Context,
"No grid object found at T=" + String( getTime(
Context) ) );
}
setBoundingBall(
Context, getBoundingBox( *
GF.getGrid() ) );
{
return setStatusError(
Context,
"No line grid found at T=" + String(
GF.getTime() ) );
}
if (!
LS.CartesianVertices)
{
return setStatusError(
Context,
"No grid without cartesian vertices at T=" + String(
GF.getTime() ) );
}
S->theGridOfInterest =
GF.getGrid();
LS.setupStandardFields(
GF.getGrid() );
LS.LineIndices->iterate(
myIt);
else
setStatusError(
Context,
"No LineIndices Field fount at T=" + String(
GF.getTime() ) );
#ifdef VERBOSE
for(size_t i = 0; i < S->fragments.size(); i++ )
cout <<
"Found LineSet-Fragment: " << S->fragments[i]->Name() <<
endl;
#endif
if( S->fragments.empty() )
S->fragments.push_back(
NullPtr() );
{
return setStatusInfo(
Context,
"Lines ready, inspecting " +
FS.getFieldName() );
}
{
}
}
static
{
for(index_t i=0; i<
Output.size(); i++)
{
}
}
{
Eagle::tvector3 TranslationVector;
auto V = getCoordinateTranslation(
Context, TranslationVector);
if (!S)
return false;
if (!S->theGridOfInterest)
return false;
return false;
string Fieldname =
FS.getFieldName();
{
try
{
}
{}
if (!LineTexture)
{
LineTexture->enlighten();
LineTexture->enlighten(GlossyParameters,
Context);
}
}
{
if (!GLColormap::Enable(
Cmap,
TC, 1,
true) )
{
}
}
double width = 1.0;
if( width < 1e-4)
width = 0.01;
else
{
const int ColormapTextureUnit = 1;
#if 0
double m[16] = { 1.0, 0,0, 0,
0,1,0,0,
0,0,1,0,
0,0,0,1 };
#endif
{
#ifdef VERBOSE
#endif
try
{
}
catch(...){}
#if 1
myVBO->isOlderThan( ConnectionAge() ) ||
(
LS.Coords &&
myVBO->isOlderThan( *
LS.Coords) ) ||
(
LS.LineIndices &&
myVBO->isOlderThan( *
LS.LineIndices) ) ||
(TextureField &&
myVBO->isOlderThan( *TextureField) ) ||
#else
if (true)
#endif
{
#ifdef VERBOSE
else
{
if (!
myVBO->getRenderer() )
puts(
"No rendered in VBO");
if (
LS.Coords &&
myVBO->isOlderThan( *
LS.Coords) )
puts(
"Coordinates are newer");
if (
LS.LineIndices &&
myVBO->isOlderThan( *
LS.LineIndices) )
puts(
"Line indices are newer");
if (
myVBO->isOlderThan( ConnectionAge() ) )
puts(
"network connections have changed");
if (TextureField &&
myVBO->isOlderThan( *TextureField) )
puts(
"color field has changed");
if (InputRange.age(
Context ).isNewerThan( *S ) )
puts(
"input range is newer than status");
if (InputRange.age(
Context ).isNewerThan( *
myVBO ) )
puts(
"input range is newer than vbo");
}
#endif
{
puts(
"No coords array retrieved");
return false;
}
{
#ifdef VERBOSE
for(
mi[0] = 0;
mi[0] < 3;
mi[0]++)
#endif
#ifdef VERBOSE
cout <<
"ColoredLines::render() appended tangents: # " <<
TCA->BufferArray::NumberOfElements() <<
endl;
#endif
}
else
{
LS.getLineset().Speak(
"********************LineSet EDGE Sets - WRONG EDGE SET DATA TYPE?");
return false;
}
#ifdef VERBOSE
puts(
"Load a texture coordinate field, maybe?");
#endif
if (TextureField)
{
{
#ifdef VERBOSE
puts(
"Load a texture coordinate field");
#endif
#ifdef VERBOSE
cout <<
"ColoredLines::render() appended texture: # " <<
TCA->BufferArray::NumberOfElements() <<
endl;
#endif
}
else
{
puts(
"NOTE: CANNOT get texture field data?!");
}
}
else
{
puts(
"NOTE: NO texture field!");
}
#ifdef VERBOSE
cout <<
"ColoredLines::render() appended vertices: # " <<
VA->BufferArray::NumberOfElements() <<
endl;
#endif
myVBO->update( ConnectionAge() );
#ifdef VERBOSE
puts(
"CREATING NEW LINE RENDER VBO");
if (TextureField &&
myVBO->isOlderThan( *TextureField) )
{
puts(
" BECAUSE this VBO is older than the associated texture field");
TextureField.
speak(
"ASSOC TEXTURE FIELD");
{
printf(
" FIELDNAME: %s\n",
FS.getFieldName().c_str() );
}
}
else
{
puts(
" BUT texture field has not changed");
}
#endif
}
#ifdef VERBOSE
else
puts(
"USING CACHED LINE RENDER VBO");
#endif
#ifdef VERBOSE
#endif
}
}
return true;
}
{
{
}
};
}
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp __func(_Tp)) const
constexpr _Bind_helper< __is_socketlike< _Func >::value, _Func, _BoundArgs... >::type bind(_Func &&__f, _BoundArgs &&... __args)
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
Base class for iterators over the fragments of a field.
Definition FragmentID.hpp:249
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
A set of lines stored on a Grid.
Definition LineSet.hpp:55
A concrete Grid Property which looks for the existence of a Skeleton of the specified dimension and i...
Definition BundleProperty.hpp:76
void speak(const char *s, const char *prefix="") const noexcept
bool setProperty(const string &theName, const Type &theValue) const
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 ...
Definition fs/init.hpp:20
A helper class to retrieve fields given on a Grid.
Definition GridField.hpp:19
Definition GridInspector.hpp:13
Definition examples/200-SpatialSorting/main.cpp:36
Common base class for objects that render information given on line sets, merely for grouping purpose...
Definition eye/retina/LineSetRenderer.hpp:39