FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
TensorArray.hpp
1#ifndef TENSOR_ARRAY_HPP
2#define TENSOR_ARRAY_HPP
3
4#include <ocean/shrimp/VEnum.hpp>
5
6#include <GL/fieldGL.hpp>
7#include <eye/retina/SplatRenderObject.hpp>
8#include <ocean/GLvish/BufferArray.hpp>
9
10namespace Wizt
11{
12
13using namespace Fiber;
14using namespace Eagle;
15
16
19{
20 int xx_xy_yy,
21 xz_yz_zz;
22};
23
30template <class Type>
32{
33public:
34 typedef Type value_type;
35 typedef typename Type::value_type etype;
36 typedef BufferArray Base_t;
37
38 TensorIDs index;
39
40 TensorArray(const TensorIDs&IDs)
41 : BufferArray(BufferArray::ARRAY_BUFFER)
42 , index(IDs)
43 {}
44
45 bool enable() const override
46 {
47 GLboolean normalized = false;
48 GLVERIFY( glVertexAttribPointer( index.xx_xy_yy, 3, glType<etype>::type, normalized, sizeof(Type), 0) );
49 GLVERIFY( glVertexAttribPointer( index.xz_yz_zz, 3, glType<etype>::type, normalized, sizeof(Type), reinterpret_cast<char*>(0) + 3*sizeof(etype) ) );
50 GLVERIFY( glEnableVertexAttribArray( index.xx_xy_yy ) );
51 GLVERIFY( glEnableVertexAttribArray( index.xz_yz_zz ) );
52 return true;
53 }
54
55 bool disable() const override
56 {
57 glDisableVertexAttribArray( index.xx_xy_yy );
58 glDisableVertexAttribArray( index.xz_yz_zz );
59 return true;
60 }
61};
62
63
68{
69public:
71 typedef VBOArrayType::value_type value_type;
72
73 VBOTensorField(VObject*that, const string&fieldname);
74
76
78 const string&arrayname,
80 const Fiber::MemBase::Creator_t&theCreator) const override;
81};
82
83} // namespace Wizt
84
85#endif // TENSOR_ARRAY_HPP
86
87
88
89
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
xx 0 xy yy 1 2 xz yz zz 3 4 5
Definition TensorArray.hpp:32
Loads a fragment of a tensor field as TensorArray.
Definition TensorArray.hpp:68
RefPtr< BufferArray > createVBOArray(const RefPtr< Fiber::MemBase > &MB, const string &arrayname, const RefPtr< GLProgram > &Shader, const Fiber::MemBase::Creator_t &theCreator) const override
Virtual function to create a vertex array from a given memory array.
Definition TensorArray.cpp:18
A VertexField is a (abstract) gateway from RAM to GPU memory.
Definition VertexField.hpp:71
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 ...
Shader program array indices.
Definition TensorArray.hpp:19