Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
444de9ee
Commit
444de9ee
authored
Aug 17, 2013
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started working on internal fallback shaders
parent
fdc6494d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
12 deletions
+48
-12
include/ACGL/HardwareSupport/SimpleRiftController.hh
include/ACGL/HardwareSupport/SimpleRiftController.hh
+6
-4
include/ACGL/Resource/FileManager.hh
include/ACGL/Resource/FileManager.hh
+4
-4
src/ACGL/HardwareSupport/SimpleRiftController.cc
src/ACGL/HardwareSupport/SimpleRiftController.cc
+38
-4
No files found.
include/ACGL/HardwareSupport/SimpleRiftController.hh
View file @
444de9ee
#pragma once
/**
* IMPORTANT:
* IMPORTANT:
DON'T EXPECT THIS CLASS TO HAVE A FINAL AND STABLE API!
*
* This class needs the LibOVR version 0.2.4 or higher to work.
* Headers of this lib need to be placed in the search path.
*
* In addition ACGL_USE_OCULUS_RIFT has to be defined.
*
*
*/
#include <ACGL/ACGL.hh>
#define ACGL_USE_OCULUS_RIFT
#ifdef ACGL_USE_OCULUS_RIFT
#include <ACGL/Math/Math.hh>
...
...
@@ -159,6 +160,7 @@ public:
//! Note: if the user is just looking in the wrong direction, use setNeutralYaw(), if e.g. looking up should be
//! neutral (laying on the ground), this is the way to go.
void
setNeutralPosition
();
void
resetNeutralRotation
()
{
setNeutralPosition
();}
//! Will define the current view direction as the neutral direction but only takes yaw into account.
//! Will also reset the neutral position.
...
...
@@ -167,8 +169,8 @@ public:
private:
ACGL
::
OpenGL
::
Const
SharedShaderProgram
mDistortShaderSideBySide
;
ACGL
::
OpenGL
::
Const
SharedShaderProgram
mDistortShaderTwoTextures
;
ACGL
::
OpenGL
::
SharedShaderProgram
mDistortShaderSideBySide
;
ACGL
::
OpenGL
::
SharedShaderProgram
mDistortShaderTwoTextures
;
bool
mUseDistortion
;
bool
mUseChromaticAberation
;
...
...
include/ACGL/Resource/FileManager.hh
View file @
444de9ee
...
...
@@ -205,8 +205,8 @@ public:
virtual
~
MultiFileManager
(
void
)
{}
template
<
typename
CONTROLLER
>
Const
SharedRESOURCE
get
(
const
CONTROLLER
&
_controller
);
Const
SharedRESOURCE
query
(
const
std
::
string
&
_filename
);
SharedRESOURCE
get
(
const
CONTROLLER
&
_controller
);
SharedRESOURCE
query
(
const
std
::
string
&
_filename
);
bool
exists
(
const
std
::
string
&
_key
);
bool
erase
(
const
std
::
string
&
key
);
void
eraseAll
(
void
);
...
...
@@ -226,7 +226,7 @@ private:
};
template
<
typename
RESOURCE
>
template
<
typename
CONTROLLER
>
typename
MultiFileManager
<
RESOURCE
>::
Const
SharedRESOURCE
MultiFileManager
<
RESOURCE
>::
get
(
const
CONTROLLER
&
_controller
)
typename
MultiFileManager
<
RESOURCE
>::
SharedRESOURCE
MultiFileManager
<
RESOURCE
>::
get
(
const
CONTROLLER
&
_controller
)
{
typename
ResourceMap
::
iterator
existingResource
=
mResourceMap
.
find
(
_controller
.
getResourceName
());
if
(
existingResource
!=
mResourceMap
.
end
())
...
...
@@ -249,7 +249,7 @@ typename MultiFileManager<RESOURCE>::ConstSharedRESOURCE MultiFileManager<RESOUR
}
template
<
typename
RESOURCE
>
typename
MultiFileManager
<
RESOURCE
>::
Const
SharedRESOURCE
MultiFileManager
<
RESOURCE
>::
query
(
const
std
::
string
&
_key
)
typename
MultiFileManager
<
RESOURCE
>::
SharedRESOURCE
MultiFileManager
<
RESOURCE
>::
query
(
const
std
::
string
&
_key
)
{
typename
ResourceMap
::
iterator
existingResource
=
mResourceMap
.
find
(
_key
);
if
(
existingResource
!=
mResourceMap
.
end
())
...
...
src/ACGL/HardwareSupport/SimpleRiftController.cc
View file @
444de9ee
...
...
@@ -8,6 +8,7 @@ using namespace ACGL;
using
namespace
ACGL
::
Utils
;
using
namespace
ACGL
::
Scene
;
using
namespace
ACGL
::
HardwareSupport
;
using
namespace
ACGL
::
OpenGL
;
using
namespace
std
;
...
...
@@ -350,14 +351,33 @@ glm::vec4 SimpleRiftController::getChromAbParam()
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const
char
*
VS_SOURCE
=
"foo"
;
const
char
*
FS_SOURCE_SIDE_BY_SIDE
=
"bar"
;
const
char
*
FS_SOURCE_TWO_TEXTURE
=
"TODO"
;
void
SimpleRiftController
::
renderDistorted
(
OpenGL
::
ConstSharedTexture2D
_sideBySideTexture
)
{
if
(
!
mDistortShaderSideBySide
)
{
// initialize shaders:
mDistortShaderSideBySide
=
OpenGL
::
ShaderProgramFileManager
::
the
()
->
get
(
OpenGL
::
ShaderProgramCreator
(
"RiftDistortSideBySide.fsh"
).
andFile
(
"RiftDistort.vsh"
)
);
if
(
!
mDistortShaderSideBySide
)
{
ACGL
::
Utils
::
error
()
<<
"could not load distortion shader!"
<<
std
::
endl
;
return
;
ACGL
::
Utils
::
debug
()
<<
"SimpleRiftController: using build-in shaders"
<<
std
::
endl
;
mDistortShaderSideBySide
=
SharedShaderProgram
(
new
ShaderProgram
()
);
SharedShader
vs
=
SharedShader
(
new
Shader
(
GL_VERTEX_SHADER
)
);
vs
->
setSource
(
VS_SOURCE
);
SharedShader
fs
=
SharedShader
(
new
Shader
(
GL_FRAGMENT_SHADER
)
);
fs
->
setSource
(
FS_SOURCE_SIDE_BY_SIDE
);
mDistortShaderSideBySide
->
attachShader
(
vs
);
mDistortShaderSideBySide
->
attachShader
(
fs
);
mDistortShaderSideBySide
->
link
();
}
else
{
ACGL
::
Utils
::
debug
()
<<
"SimpleRiftController: using application provided shaders"
<<
std
::
endl
;
}
}
...
...
@@ -372,8 +392,22 @@ void SimpleRiftController::renderDistorted( OpenGL::ConstSharedTexture2D _leftTe
// initialize shaders:
mDistortShaderTwoTextures
=
OpenGL
::
ShaderProgramFileManager
::
the
()
->
get
(
OpenGL
::
ShaderProgramCreator
(
"RiftDistortTwoTexture.fsh"
).
andFile
(
"RiftDistort.vsh"
)
);
if
(
!
mDistortShaderTwoTextures
)
{
ACGL
::
Utils
::
error
()
<<
"could not load distortion shader!"
<<
std
::
endl
;
return
;
ACGL
::
Utils
::
debug
()
<<
"SimpleRiftController: using build-in shaders"
<<
std
::
endl
;
mDistortShaderTwoTextures
=
SharedShaderProgram
(
new
ShaderProgram
()
);
SharedShader
vs
=
SharedShader
(
new
Shader
(
GL_VERTEX_SHADER
)
);
vs
->
setSource
(
VS_SOURCE
);
SharedShader
fs
=
SharedShader
(
new
Shader
(
GL_FRAGMENT_SHADER
)
);
fs
->
setSource
(
FS_SOURCE_TWO_TEXTURE
);
mDistortShaderTwoTextures
->
attachShader
(
vs
);
mDistortShaderTwoTextures
->
attachShader
(
fs
);
mDistortShaderTwoTextures
->
link
();
}
else
{
ACGL
::
Utils
::
debug
()
<<
"SimpleRiftController: using application provided shaders"
<<
std
::
endl
;
}
}
...
...
Write
Preview
Markdown
is supported
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