Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
b8f40245
Commit
b8f40245
authored
Jun 25, 2014
by
Martin Schultz
Browse files
* VertexArrayObjectCreator is now capable of caching and loads also vao
* files
parent
e5e22691
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Creator/VertexArrayObjectCreator.hh
View file @
b8f40245
...
...
@@ -50,6 +50,9 @@ public:
//! links to an external LocationMappings object
inline
VertexArrayObjectCreator
&
externAttributeLocations
(
const
SharedLocationMappings
&
_attributeLocations
)
{
mAttributeLocations
=
_attributeLocations
;
return
*
this
;
}
//! sets the caching mode for this creator
inline
VertexArrayObjectCreator
&
cached
(
bool
_cacheMode
)
{
mCaching
=
_cacheMode
;
return
*
this
;
}
private:
bool
load
(
SharedVertexArrayObject
&
vao
);
...
...
@@ -65,6 +68,7 @@ public:
// =================================================================================================== \/
protected:
SharedLocationMappings
mAttributeLocations
;
bool
mCaching
;
};
}
// OpenGL
...
...
src/ACGL/OpenGL/Creator/VertexArrayObjectCreator.cc
View file @
b8f40245
...
...
@@ -5,7 +5,7 @@
**********************************************************************/
#include
<ACGL/OpenGL/Creator/VertexArrayObjectCreator.hh>
#include
<ACGL/OpenGL/Data/
GeometryData
LoadStore.hh>
#include
<ACGL/OpenGL/Data/
VertexArrayObject
LoadStore.hh>
#ifdef ACGL_SUPPORT_VAO
...
...
@@ -13,41 +13,21 @@ using namespace ACGL;
using
namespace
ACGL
::
OpenGL
;
VertexArrayObjectCreator
::
VertexArrayObjectCreator
(
const
std
::
string
&
_filename
)
:
Resource
::
SingleFileBasedCreator
<
VertexArrayObject
>
(
_filename
,
Base
::
Settings
::
the
()
->
getFullGeometryPath
())
:
Resource
::
SingleFileBasedCreator
<
VertexArrayObject
>
(
_filename
,
Base
::
Settings
::
the
()
->
getFullGeometryPath
()),
mCaching
(
false
)
{
}
VertexArrayObjectCreator
::
VertexArrayObjectCreator
(
const
char
*
_filename
)
:
Resource
::
SingleFileBasedCreator
<
VertexArrayObject
>
(
std
::
string
(
_filename
),
Base
::
Settings
::
the
()
->
getFullGeometryPath
())
:
Resource
::
SingleFileBasedCreator
<
VertexArrayObject
>
(
std
::
string
(
_filename
),
Base
::
Settings
::
the
()
->
getFullGeometryPath
()),
mCaching
(
false
)
{
}
bool
VertexArrayObjectCreator
::
load
(
SharedVertexArrayObject
&
_vao
)
{
SharedGeometryData
tempData
=
loadGeometryData
(
getFullFilePath
()
);
if
(
!
tempData
)
return
false
;
SharedArrayBuffer
sab
=
SharedArrayBuffer
(
new
ArrayBuffer
()
);
for
(
uint_t
i
=
0
;
i
<
tempData
->
mAttributes
.
size
();
++
i
)
{
sab
->
defineAttribute
(
tempData
->
mAttributes
[
i
]
);
}
sab
->
setDataElements
(
tempData
->
getSize
()
/
tempData
->
getStrideSize
(),
tempData
->
getData
()
);
_vao
->
detachAllAttributes
();
_vao
->
attachAllAttributes
(
sab
);
// merge the mappings of the new VAO into the linked LocationMappings object, if present
if
(
mAttributeLocations
)
{
_vao
->
setAttributeLocations
(
mAttributeLocations
);
SharedLocationMappings
vaoAttributeLocations
=
_vao
->
getAttributeLocations
();
mAttributeLocations
->
addLocations
(
vaoAttributeLocations
);
_vao
->
setAttributeLocations
(
mAttributeLocations
);
}
return
true
;
_vao
=
loadVertexArrayObject
(
getFullFilePath
(),
mCaching
);
return
_vao
!=
nullptr
;
}
SharedVertexArrayObject
VertexArrayObjectCreator
::
create
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment