SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SRUtil.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2013 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 /// \author James Hughes
30 /// \date August 2013
31 
32 #ifndef SRUTIL_H
33 #define SRUTIL_H
34 
35 #include <cstdint>
36 #include <string>
37 #include <vector>
38 #include <memory>
39 
40 namespace SCIRun {
41 namespace Gui {
42 
43 // Misc SCIRun utilities.
44 
45 /// \todo Possibly parameterize uint16_t output type for ibo using templates.
46 
47 /// Normal rendering. Expects position and normals to be floats.
48 /// \param vboData The raw VBO that gets sent to spire.
49 /// \param stride Stride between vertices.
50 /// \param normLength Length of the normal.
51 /// \param posOffset Offset to position.
52 /// \param normOffset Offset to the normal.
53 /// \param out_vboData Output VBO data. Format: Position. Where the 3 elements
54 /// inside the position are floats.
55 /// \param out_iboData Output IBO data. Format: uint16_t, GL_LINE.
56 /// \return The number of elements (GL_LINE) in the ibo data.
57 size_t buildNormalRenderingForVBO(std::shared_ptr<std::vector<uint8_t>> vboData,
58  size_t stride, float normLength,
59  std::vector<uint8_t>& out_vboData,
60  std::vector<uint8_t>& out_iboData,
61  size_t posOffset = 0,
62  size_t normOffset = sizeof(float) * 3);
63 
64 } // namespace Gui
65 } // namespace SCIRun
66 
67 #endif
size_t buildNormalRenderingForVBO(std::shared_ptr< std::vector< uint8_t >> vboData, size_t stride, float normalLength, std::vector< uint8_t > &out_vboData, std::vector< uint8_t > &out_iboData, size_t posOffset, size_t normOffset)
Definition: SRUtil.cc:41