Skip to content
GitLab
Menu
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
7f27b3be
Commit
7f27b3be
authored
Jun 25, 2013
by
Robert Menzel
Browse files
moved setResourceName for compatibility and added ArrayBufferCreator
parent
4e4f7f56
Changes
8
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/Creator/ArrayBufferCreator.hh
0 → 100644
View file @
7f27b3be
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#pragma once
#include <ACGL/ACGL.hh>
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/GL.hh>
namespace
ACGL
{
namespace
OpenGL
{
class
ArrayBufferCreator
{
// ==================================================================================================== \/
// ============================================================================================ STRUCTS \/
// ==================================================================================================== \/
public:
struct
AttributeDefine
{
std
::
string
name
;
GLenum
type
;
GLint
dimension
;
GLboolean
normalized
;
GLboolean
isInteger
;
};
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
// ===================================================================================================== \/
public:
typedef
std
::
vector
<
AttributeDefine
>
AttributeDefineVec
;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
public:
ArrayBufferCreator
(
void
)
:
mUsage
(
GL_STATIC_DRAW
),
mElements
(
0
),
mpData
(
NULL
),
mAttributeDefines
()
{}
virtual
~
ArrayBufferCreator
()
{}
// ==================================================================================================== \/
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline
ArrayBufferCreator
&
usage
(
GLenum
_usage
)
{
mUsage
=
_usage
;
return
*
this
;
}
inline
ArrayBufferCreator
&
data
(
const
GLvoid
*
_pData
,
GLsizei
_elements
)
{
mpData
=
_pData
;
mElements
=
_elements
;
return
*
this
;
}
inline
ArrayBufferCreator
&
attribute
(
const
std
::
string
&
_name
,
GLenum
_type
,
GLint
_dimension
,
GLboolean
_normalized
=
GL_FALSE
)
{
AttributeDefine
a
=
{
_name
,
_type
,
_dimension
,
_normalized
,
GL_FALSE
};
mAttributeDefines
.
push_back
(
a
);
return
*
this
;
}
inline
ArrayBufferCreator
&
integerAttribute
(
const
std
::
string
&
_name
,
GLenum
_type
,
GLint
_dimension
)
{
AttributeDefine
a
=
{
_name
,
_type
,
_dimension
,
GL_FALSE
,
GL_TRUE
};
mAttributeDefines
.
push_back
(
a
);
return
*
this
;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
public:
SharedArrayBuffer
create
();
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
protected:
GLenum
mUsage
;
GLsizei
mElements
;
const
GLvoid
*
mpData
;
AttributeDefineVec
mAttributeDefines
;
};
}
// OpenGL
}
// ACGL
include/ACGL/OpenGL/Creator/ShaderCreator.hh
View file @
7f27b3be
...
...
@@ -42,6 +42,8 @@ public:
public:
inline
ShaderCreator
&
type
(
GLenum
_type
)
{
mType
=
_type
;
return
*
this
;
}
ShaderCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
// ===================================================================================================== \/
// ============================================================================================ OVERRIDE \/
// ===================================================================================================== \/
...
...
include/ACGL/OpenGL/Creator/ShaderProgramCreator.hh
View file @
7f27b3be
...
...
@@ -66,6 +66,8 @@ public:
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
ShaderProgramCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
//
// Adding files:
//
...
...
include/ACGL/OpenGL/Creator/Texture2DCreator.hh
View file @
7f27b3be
...
...
@@ -22,6 +22,8 @@ public:
:
Resource
::
SingleFileBasedCreator
<
Texture2D
>
(
_filename
,
Base
::
Settings
::
the
()
->
getFullTexturePath
()
)
{}
virtual
~
Texture2DCreator
()
{}
Texture2DCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
//! try to create a 2D mip-mapped texture
virtual
SharedTexture2D
create
();
...
...
include/ACGL/OpenGL/Creator/VertexArrayObjectCreator.hh
View file @
7f27b3be
...
...
@@ -34,6 +34,8 @@ public:
VertexArrayObjectCreator
(
const
std
::
string
&
_filename
);
VertexArrayObjectCreator
(
const
char
*
_filename
);
VertexArrayObjectCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
template
<
typename
CONTROLLER
>
VertexArrayObjectCreator
(
const
CONTROLLER
&
_fileController
)
:
Resource
::
SingleFileBasedCreator
<
VertexArrayObject
>
(
_fileController
.
getFilename
(),
Base
::
Settings
::
the
()
->
getFullGeometryPath
()),
...
...
include/ACGL/Resource/MultiFileBasedCreator.hh
View file @
7f27b3be
...
...
@@ -63,11 +63,6 @@ public:
return
mResourceName
;
}
//
// Modifying the resource name:
//
MultiFileBasedCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
//! this should create and return the resource
virtual
ptr
::
shared_ptr
<
RESOURCE
>
create
()
=
0
;
...
...
include/ACGL/Resource/SingleFileBasedCreator.hh
View file @
7f27b3be
...
...
@@ -44,11 +44,6 @@ public:
const
std
::
string
&
getFilename
(
void
)
const
{
return
mFilename
;
}
const
std
::
string
&
getFullFilePath
(
void
)
const
{
return
mFullFilePath
;
}
//
// Modifying the resource name:
//
SingleFileBasedCreator
&
setResourceName
(
const
std
::
string
&
_resourceName
)
{
mResourceName
=
_resourceName
;
return
*
this
;
}
//! this should create and return the resource
virtual
ptr
::
shared_ptr
<
RESOURCE
>
create
()
=
0
;
...
...
src/ACGL/OpenGL/Creator/ArrayBufferCreator.cc
0 → 100644
View file @
7f27b3be
/***********************************************************************
* Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#include <ACGL/OpenGL/Creator/ArrayBufferCreator.hh>
using
namespace
ACGL
::
OpenGL
;
SharedArrayBuffer
ArrayBufferCreator
::
create
()
{
SharedArrayBuffer
arrayBuffer
(
new
ArrayBuffer
()
);
for
(
AttributeDefineVec
::
size_type
i
=
0
;
i
<
mAttributeDefines
.
size
();
i
++
)
{
if
(
mAttributeDefines
[
i
].
isInteger
)
{
arrayBuffer
->
defineIntegerAttribute
(
mAttributeDefines
[
i
].
name
,
mAttributeDefines
[
i
].
type
,
mAttributeDefines
[
i
].
dimension
);
}
else
{
arrayBuffer
->
defineAttribute
(
mAttributeDefines
[
i
].
name
,
mAttributeDefines
[
i
].
type
,
mAttributeDefines
[
i
].
dimension
,
mAttributeDefines
[
i
].
normalized
);
}
}
if
(
mpData
!=
NULL
)
{
arrayBuffer
->
bind
();
arrayBuffer
->
setDataElements
(
mElements
,
mpData
,
mUsage
);
}
return
arrayBuffer
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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