/usr/include/Nux-4.0/NuxGraphics/GLVertexResourceManager.h is in libnux-4.0-dev 4.0.8+16.04.20160209-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*
* Copyright 2010 Inalogic® Inc.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License, as
* published by the Free Software Foundation; either version 2.1 or 3.0
* of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the applicable version of the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of both the GNU Lesser General Public
* License along with this program. If not, see <http://www.gnu.org/licenses/>
*
* Authored by: Jay Taoko <jaytaoko@inalogic.com>
*
*/
#ifndef GLVERTEXRESOURCEMANAGER_H
#define GLVERTEXRESOURCEMANAGER_H
#include "GLResourceManager.h"
#include "IOpenGLVertexBuffer.h"
#include "IOpenGLIndexBuffer.h"
#include "IOpenGLVertexDeclaration.h"
#include "MeshData.h"
namespace nux
{
class VertexBuffer: public ResourceData
{
NUX_DECLARE_OBJECT_TYPE(VertexBuffer, ResourceData);
public:
VertexBuffer();
virtual ~VertexBuffer();
VertexBuffer(int Size, int Stride);
//! Allocate space for a "num_element", each of size "size".
/*!
@param num_element Number of elements.
@param size Number of byte for every element.
*/
void Allocate(int num_index, int size);
int GetSize() const;
int GetStride() const;
int GetNumElement() const;
const void* GetPtrRawData() const;
void* GetPtrRawData();
public:
std::vector<unsigned char> _Data;
int _Stride;
};
class IndexBuffer: public ResourceData
{
NUX_DECLARE_OBJECT_TYPE(IndexBuffer, ResourceData);
// IndexBuffer is very similar to MeshBuffer except that vertex indices
// are not inter-mixed with other vertex data. So the Stride here should be 2 bytes or 4 bytes.
public:
IndexBuffer();
virtual ~IndexBuffer();
IndexBuffer(int Size, int Stride);
void Allocate(int Size, int Stride);
int GetSize() const;
int GetStride() const;
int GetNumIndex() const;
const void* GetPtrRawData() const;
void* GetPtrRawData();
public:
std::vector<int> _Data;
int _Stride;
int _num_index;
};
class VertexDeclaration: public ResourceData
{
NUX_DECLARE_OBJECT_TYPE(NVertexDeclaration, ResourceData);
public:
VertexDeclaration();
~VertexDeclaration();
void AddVertexComponent(VERTEXELEMENT);
std::vector<VERTEXELEMENT> _declaration;
};
class CachedVertexBuffer: public CachedResourceData
{
NUX_DECLARE_OBJECT_TYPE(CachedVertexBuffer, CachedResourceData);
public:
CachedVertexBuffer(NResourceSet* ResourceManager, VertexBuffer* resource);
~CachedVertexBuffer();
ObjectPtr<IOpenGLVertexBuffer> _vertex_buffer;
bool UpdateResource(ResourceData* Resource);
int GetElementSize() const;
int GetBufferStride() const;
private:
void LoadVertexData(VertexBuffer* vertex_buffer);
int _Size;
int _Stride;
};
class CachedIndexBuffer: public CachedResourceData
{
NUX_DECLARE_OBJECT_TYPE(CachedIndexBuffer, CachedResourceData);
public:
CachedIndexBuffer(NResourceSet* ResourceManager, IndexBuffer* resource);
~CachedIndexBuffer();
ObjectPtr<IOpenGLIndexBuffer> _index_buffer;
bool UpdateResource(ResourceData* Resource);
int GetElementSize() const;
int GetBufferStride() const;
int GetNumIndex() const;
private:
void LoadIndexData(IndexBuffer* index_buffer);
int _Size;
int _Stride;
int _num_index;
};
class CachedVertexDeclaration: public CachedResourceData
{
NUX_DECLARE_OBJECT_TYPE(CachedVertexDeclaration, CachedResourceData);
public:
CachedVertexDeclaration(NResourceSet* ResourceManager, VertexDeclaration* Resource);
~CachedVertexDeclaration();
bool UpdateResource(ResourceData* Resource);
ObjectPtr<IOpenGLVertexDeclaration> _declaration;
};
class CachedMeshBuffer;
class MeshBuffer: public ResourceData
{
NUX_DECLARE_OBJECT_TYPE(MeshBuffer, ResourceData);
public:
MeshBuffer(NUX_FILE_LINE_PROTO);
virtual ~MeshBuffer();
bool Update(const MeshData* mesh_data);
ObjectPtr<CachedMeshBuffer> GetCachedMeshBuffer();
public:
VertexBuffer* _vertex_buffer;
IndexBuffer* _index_buffer;
VertexDeclaration* _vertex_declaration;
NuxMeshPrimitiveType _mesh_primitive_type;
};
class CachedMeshBuffer: public CachedResourceData
{
NUX_DECLARE_OBJECT_TYPE(CachedMeshBuffer, CachedResourceData);
public:
ObjectPtr<CachedVertexBuffer> _cached_vertex_buffer;
ObjectPtr<CachedVertexDeclaration> _cached_vertex_declaration;
ObjectPtr<CachedIndexBuffer> _cached_index_buffer;
NuxMeshPrimitiveType _mesh_primitive_type;
CachedMeshBuffer(NResourceSet* ResourceManager, MeshBuffer* resource);
~CachedMeshBuffer();
bool UpdateResource(ResourceData* Resource);
};
}
#endif // GLVERTEXRESOURCEMANAGER_H
|