mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 04:51:52 +00:00
Add placeholders for LibOVR 0.4.0 support
--HG-- branch : multipass-stereo
This commit is contained in:
parent
96bd17ae63
commit
0488b706b2
11 changed files with 1471 additions and 10 deletions
|
@ -44,7 +44,7 @@
|
|||
#ifndef NL3D_STEREO_OVR_H
|
||||
#define NL3D_STEREO_OVR_H
|
||||
|
||||
#ifdef HAVE_LIBOVR
|
||||
#ifdef HAVE_LIBOVR_02
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
|
|
185
code/nel/include/nel/3d/stereo_ovr_04.h
Normal file
185
code/nel/include/nel/3d/stereo_ovr_04.h
Normal file
|
@ -0,0 +1,185 @@
|
|||
/**
|
||||
* \file stereo_ovr.h
|
||||
* \brief CStereoOVR
|
||||
* \date 2014-08-04 16:21GMT
|
||||
* \author Jan Boon (Kaetemi)
|
||||
* CStereoOVR
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 by authors
|
||||
*
|
||||
* This file is part of NL3D.
|
||||
* NL3D is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* NL3D is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with NL3D. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Linking this library statically or dynamically with other modules
|
||||
* is making a combined work based on this library. Thus, the terms
|
||||
* and conditions of the GNU General Public License cover the whole
|
||||
* combination.
|
||||
*
|
||||
* As a special exception, the copyright holders of this library give
|
||||
* you permission to link this library with the Oculus SDK to produce
|
||||
* an executable, regardless of the license terms of the Oculus SDK,
|
||||
* and distribute linked combinations including the two, provided that
|
||||
* you also meet the terms and conditions of the license of the Oculus
|
||||
* SDK. You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than the Oculus SDK. If you modify
|
||||
* this file, you may extend this exception to your version of the
|
||||
* file, but you are not obligated to do so. If you do not wish to do
|
||||
* so, delete this exception statement from your version.
|
||||
*/
|
||||
|
||||
#ifndef NL3D_STEREO_OVR_H
|
||||
#define NL3D_STEREO_OVR_H
|
||||
|
||||
#ifdef HAVE_LIBOVR
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/smart_ptr.h>
|
||||
#include <nel/misc/geom_ext.h>
|
||||
|
||||
// Project includes
|
||||
#include <nel/3d/stereo_hmd.h>
|
||||
#include <nel/3d/frustum.h>
|
||||
#include <nel/3d/viewport.h>
|
||||
#include <nel/3d/u_material.h>
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
class ITexture;
|
||||
class CTextureUser;
|
||||
class CStereoOVRDevicePtr;
|
||||
class CStereoOVRDeviceHandle;
|
||||
/*class CPixelProgramOVR;*/
|
||||
|
||||
#define NL_STEREO_MAX_USER_CAMERAS 8
|
||||
|
||||
/**
|
||||
* \brief CStereoOVR
|
||||
* \date 2014-08-04 16:21GMT
|
||||
* \author Jan Boon (Kaetemi)
|
||||
* CStereoOVR
|
||||
*/
|
||||
class CStereoOVR : public IStereoHMD
|
||||
{
|
||||
public:
|
||||
CStereoOVR(const CStereoOVRDeviceHandle *handle);
|
||||
virtual ~CStereoOVR();
|
||||
|
||||
/// Sets driver and generates necessary render targets
|
||||
virtual void setDriver(NL3D::UDriver *driver);
|
||||
|
||||
/// Gets the required screen resolution for this device
|
||||
virtual bool getScreenResolution(uint &width, uint &height);
|
||||
/// Set latest camera position etcetera
|
||||
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
|
||||
/// Get the frustum to use for clipping
|
||||
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
|
||||
/// Get the original frustum of the camera
|
||||
virtual void getOriginalFrustum(uint cid, NL3D::UCamera *camera) const;
|
||||
|
||||
/// Is there a next pass
|
||||
virtual bool nextPass();
|
||||
/// Gets the current viewport
|
||||
virtual const NL3D::CViewport &getCurrentViewport() const;
|
||||
/// Gets the current camera frustum
|
||||
virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const;
|
||||
/// Gets the current camera frustum
|
||||
virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const;
|
||||
/// Gets the current camera matrix
|
||||
virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const;
|
||||
|
||||
/// At the start of a new render target
|
||||
virtual bool wantClear();
|
||||
/// The 3D scene
|
||||
virtual bool wantScene();
|
||||
/// Interface within the 3D scene
|
||||
virtual bool wantInterface3D();
|
||||
/// 2D Interface
|
||||
virtual bool wantInterface2D();
|
||||
|
||||
/// Returns true if a new render target was set, always fase if not using render targets
|
||||
virtual bool beginRenderTarget();
|
||||
/// Returns true if a render target was fully drawn, always false if not using render targets
|
||||
virtual bool endRenderTarget();
|
||||
|
||||
|
||||
/// Get the HMD orientation
|
||||
virtual NLMISC::CQuat getOrientation() const;
|
||||
|
||||
/// Set the GUI reference
|
||||
virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix);
|
||||
|
||||
/// Get GUI center (1 = width, 1 = height, 0 = center)
|
||||
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const;
|
||||
|
||||
/// Set the head model, eye position relative to orientation point
|
||||
virtual void setEyePosition(const NLMISC::CVector &v);
|
||||
/// Get the head model, eye position relative to orientation point
|
||||
virtual const NLMISC::CVector &getEyePosition() const;
|
||||
|
||||
/// Set the scale of the game in units per meter
|
||||
virtual void setScale(float s);
|
||||
|
||||
/// Calculates internal camera information based on the reference camera
|
||||
void initCamera(uint cid, const NL3D::UCamera *camera);
|
||||
/// Render GUI
|
||||
void renderGUI();
|
||||
|
||||
/// Checks if the device used by this class was actually created
|
||||
bool isDeviceCreated();
|
||||
|
||||
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
|
||||
static bool isLibraryInUse();
|
||||
static void releaseLibrary();
|
||||
|
||||
private:
|
||||
CStereoOVRDevicePtr *m_DevicePtr;
|
||||
int m_Stage;
|
||||
int m_SubStage;
|
||||
CViewport m_RegularViewport;
|
||||
CViewport m_LeftViewport;
|
||||
CViewport m_RightViewport;
|
||||
CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS];
|
||||
CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS];
|
||||
CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS];
|
||||
CFrustum m_OriginalFrustum[NL_STEREO_MAX_USER_CAMERAS];
|
||||
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
|
||||
CMatrix m_InterfaceCameraMatrix;
|
||||
mutable bool m_OrientationCached;
|
||||
mutable NLMISC::CQuat m_OrientationCache;
|
||||
UDriver *m_Driver;
|
||||
NL3D::CTextureUser *m_GUITexture;
|
||||
/*NL3D::CTextureUser *m_SceneTexture;
|
||||
NL3D::UMaterial m_BarrelMat;
|
||||
NLMISC::CQuadUV m_BarrelQuadLeft;
|
||||
NLMISC::CQuadUV m_BarrelQuadRight;
|
||||
NLMISC::CRefPtr<CPixelProgramOVR> m_PixelProgram;*/
|
||||
NLMISC::CVector m_EyePosition;
|
||||
float m_Scale;
|
||||
|
||||
}; /* class CStereoOVR */
|
||||
|
||||
} /* namespace NL3D */
|
||||
|
||||
#endif /* HAVE_LIBOVR */
|
||||
|
||||
#endif /* #ifndef NL3D_STEREO_OVR_H */
|
||||
|
||||
/* end of file */
|
|
@ -562,8 +562,13 @@ SOURCE_GROUP(Fx\\Particles\\lights FILES
|
|||
ps_light.cpp
|
||||
../../include/nel/3d/ps_light.h)
|
||||
SOURCE_GROUP(Fx\\2d FILES
|
||||
render_target_manager.cpp
|
||||
../../include/nel/3d/render_target_manager.h
|
||||
bloom_effect.cpp
|
||||
../../include/nel/3d/bloom_effect.h
|
||||
fxaa.cpp
|
||||
fxaa_program.h
|
||||
../../include/nel/3d/fxaa.h
|
||||
deform_2d.cpp
|
||||
../../include/nel/3d/deform_2d.h
|
||||
heat_haze.cpp
|
||||
|
@ -700,6 +705,9 @@ SOURCE_GROUP(Stereo FILES
|
|||
stereo_ovr.cpp
|
||||
stereo_ovr_fp.cpp
|
||||
../../include/nel/3d/stereo_ovr.h
|
||||
stereo_ovr_04.cpp
|
||||
stereo_ovr_04_program.h
|
||||
../../include/nel/3d/stereo_ovr_04.h
|
||||
stereo_libvr.cpp
|
||||
../../include/nel/3d/stereo_libvr.h
|
||||
stereo_debugger.cpp
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#if !FINAL_VERSION
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "std3d.h"
|
||||
#include <nel/3d/stereo_debugger.h>
|
||||
|
||||
// STL includes
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "std3d.h"
|
||||
#include <nel/3d/stereo_display.h>
|
||||
|
||||
// STL includes
|
||||
|
@ -35,6 +35,7 @@
|
|||
|
||||
// Project includes
|
||||
#include <nel/3d/stereo_ovr.h>
|
||||
#include <nel/3d/stereo_ovr_04.h>
|
||||
#include <nel/3d/stereo_libvr.h>
|
||||
#include <nel/3d/stereo_debugger.h>
|
||||
|
||||
|
@ -76,7 +77,7 @@ const char *IStereoDisplay::getLibraryName(CStereoDeviceInfo::TStereoDeviceLibra
|
|||
|
||||
void IStereoDisplay::listDevices(std::vector<CStereoDeviceInfo> &devicesOut)
|
||||
{
|
||||
#ifdef HAVE_LIBOVR
|
||||
#ifdef HAVE_LIBOVR_02
|
||||
CStereoOVR::listDevices(devicesOut);
|
||||
#endif
|
||||
#ifdef HAVE_LIBVR
|
||||
|
@ -94,7 +95,7 @@ IStereoDisplay *IStereoDisplay::createDevice(const CStereoDeviceInfo &deviceInfo
|
|||
|
||||
void IStereoDisplay::releaseUnusedLibraries()
|
||||
{
|
||||
#ifdef HAVE_LIBOVR
|
||||
#ifdef HAVE_LIBOVR_02
|
||||
if (!CStereoOVR::isLibraryInUse())
|
||||
CStereoOVR::releaseLibrary();
|
||||
#endif
|
||||
|
@ -102,7 +103,7 @@ void IStereoDisplay::releaseUnusedLibraries()
|
|||
|
||||
void IStereoDisplay::releaseAllLibraries()
|
||||
{
|
||||
#ifdef HAVE_LIBOVR
|
||||
#ifdef HAVE_LIBOVR_02
|
||||
CStereoOVR::releaseLibrary();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "std3d.h"
|
||||
#include <nel/3d/stereo_hmd.h>
|
||||
|
||||
// STL includes
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#ifdef HAVE_LIBVR
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "std3d.h"
|
||||
#include <nel/misc/time_nl.h>
|
||||
#include <nel/3d/stereo_libvr.h>
|
||||
|
||||
|
|
|
@ -41,15 +41,16 @@
|
|||
* so, delete this exception statement from your version.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_LIBOVR
|
||||
#ifdef HAVE_LIBOVR_02
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
#include "std3d.h"
|
||||
#include <nel/3d/stereo_ovr.h>
|
||||
|
||||
// STL includes
|
||||
#include <sstream>
|
||||
|
||||
// External includes
|
||||
#define OVR_NO_STDINT
|
||||
#include <OVR.h>
|
||||
|
||||
// NeL includes
|
||||
|
|
1015
code/nel/src/3d/stereo_ovr_04.cpp
Normal file
1015
code/nel/src/3d/stereo_ovr_04.cpp
Normal file
File diff suppressed because it is too large
Load diff
249
code/nel/src/3d/stereo_ovr_04_program.h
Normal file
249
code/nel/src/3d/stereo_ovr_04_program.h
Normal file
|
@ -0,0 +1,249 @@
|
|||
/************************************************************************************
|
||||
|
||||
Filename : stereo_ovf_fp.cpp
|
||||
Content : Barrel fragment program compiled to a blob of assembly
|
||||
Created : July 01, 2013
|
||||
Modified by : Jan Boon (Kaetemi)
|
||||
|
||||
Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
************************************************************************************/
|
||||
|
||||
namespace NL3D {
|
||||
const char *g_StereoOVR_fp40 =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION NV_fragment_program2;\n"
|
||||
//# cgc version 3.1.0013, build date Apr 18 2012
|
||||
//# command line args: -profile fp40
|
||||
//# source file: pp_oculus_vr.cg
|
||||
//#vendor NVIDIA Corporation
|
||||
//#version 3.1.0.13
|
||||
//#profile fp40
|
||||
//#program pp_oculus_vr
|
||||
//#semantic pp_oculus_vr.cLensCenter
|
||||
//#semantic pp_oculus_vr.cScreenCenter
|
||||
//#semantic pp_oculus_vr.cScale
|
||||
//#semantic pp_oculus_vr.cScaleIn
|
||||
//#semantic pp_oculus_vr.cHmdWarpParam
|
||||
//#semantic pp_oculus_vr.cTex0 : TEX0
|
||||
//#var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
//#var float2 cLensCenter : : c[0] : 1 : 1
|
||||
//#var float2 cScreenCenter : : c[1] : 2 : 1
|
||||
//#var float2 cScale : : c[2] : 3 : 1
|
||||
//#var float2 cScaleIn : : c[3] : 4 : 1
|
||||
//#var float4 cHmdWarpParam : : c[4] : 5 : 1
|
||||
//#var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1
|
||||
//#var float4 oCol : $vout.COLOR : COL : 7 : 1
|
||||
//#const c[5] = 0.25 0.5 0
|
||||
"PARAM c[6] = { program.env[0..4],\n" // program.local->program.env!
|
||||
" { 0.25, 0.5, 0 } };\n"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
"SHORT TEMP H0;\n"
|
||||
"TEMP RC;\n"
|
||||
"TEMP HC;\n"
|
||||
"OUTPUT oCol = result.color;\n"
|
||||
"ADDR R0.xy, fragment.texcoord[0], -c[0];\n"
|
||||
"MULR R0.xy, R0, c[3];\n"
|
||||
"MULR R0.z, R0.y, R0.y;\n"
|
||||
"MADR R1.x, R0, R0, R0.z;\n"
|
||||
"MULR R0.zw, R1.x, c[4].xywz;\n"
|
||||
"MADR R1.y, R1.x, c[4], c[4].x;\n"
|
||||
"MADR R0.w, R0, R1.x, R1.y;\n"
|
||||
"MULR R0.z, R0, R1.x;\n"
|
||||
"MADR R0.z, R0, R1.x, R0.w;\n"
|
||||
"MULR R1.xy, R0, R0.z;\n"
|
||||
"MOVR R0.xy, c[5];\n"
|
||||
"ADDR R1.zw, R0.xyxy, c[1].xyxy;\n"
|
||||
"MOVR R0.zw, c[0].xyxy;\n"
|
||||
"MADR R0.zw, R1.xyxy, c[2].xyxy, R0;\n"
|
||||
"MINR R1.xy, R0.zwzw, R1.zwzw;\n"
|
||||
"ADDR R0.xy, -R0, c[1];\n"
|
||||
"MAXR R0.xy, R0, R1;\n"
|
||||
"SEQR H0.xy, R0, R0.zwzw;\n"
|
||||
"MULXC HC.x, H0, H0.y;\n"
|
||||
"IF EQ.x;\n"
|
||||
"MOVR oCol, c[5].z;\n"
|
||||
"ELSE;\n"
|
||||
"TEX oCol, R0.zwzw, texture[0], 2D;\n"
|
||||
"ENDIF;\n"
|
||||
"END\n";
|
||||
//# 24 instructions, 2 R-regs, 1 H-regs
|
||||
|
||||
const char *g_StereoOVR_arbfp1 =
|
||||
"!!ARBfp1.0\n"
|
||||
//# cgc version 3.1.0013, build date Apr 18 2012
|
||||
//# command line args: -profile arbfp1
|
||||
//# source file: pp_oculus_vr.cg
|
||||
//#vendor NVIDIA Corporation
|
||||
//#version 3.1.0.13
|
||||
//#profile arbfp1
|
||||
//#program pp_oculus_vr
|
||||
//#semantic pp_oculus_vr.cLensCenter
|
||||
//#semantic pp_oculus_vr.cScreenCenter
|
||||
//#semantic pp_oculus_vr.cScale
|
||||
//#semantic pp_oculus_vr.cScaleIn
|
||||
//#semantic pp_oculus_vr.cHmdWarpParam
|
||||
//#semantic pp_oculus_vr.cTex0 : TEX0
|
||||
//#var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
//#var float2 cLensCenter : : c[0] : 1 : 1
|
||||
//#var float2 cScreenCenter : : c[1] : 2 : 1
|
||||
//#var float2 cScale : : c[2] : 3 : 1
|
||||
//#var float2 cScaleIn : : c[3] : 4 : 1
|
||||
//#var float4 cHmdWarpParam : : c[4] : 5 : 1
|
||||
//#var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1
|
||||
//#var float4 oCol : $vout.COLOR : COL : 7 : 1
|
||||
//#const c[5] = 0.25 0.5 0 1
|
||||
"PARAM c[6] = { program.env[0..4],\n"
|
||||
" { 0.25, 0.5, 0, 1 } };\n"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
"ADD R0.xy, fragment.texcoord[0], -c[0];\n"
|
||||
"MUL R0.xy, R0, c[3];\n"
|
||||
"MUL R0.z, R0.y, R0.y;\n"
|
||||
"MAD R0.z, R0.x, R0.x, R0;\n"
|
||||
"MUL R0.w, R0.z, c[4];\n"
|
||||
"MUL R0.w, R0, R0.z;\n"
|
||||
"MAD R1.y, R0.z, c[4], c[4].x;\n"
|
||||
"MUL R1.x, R0.z, c[4].z;\n"
|
||||
"MAD R1.x, R0.z, R1, R1.y;\n"
|
||||
"MAD R0.z, R0.w, R0, R1.x;\n"
|
||||
"MUL R0.xy, R0, R0.z;\n"
|
||||
"MOV R0.zw, c[5].xyxy;\n"
|
||||
"ADD R1.xy, R0.zwzw, c[1];\n"
|
||||
"MUL R0.xy, R0, c[2];\n"
|
||||
"ADD R0.xy, R0, c[0];\n"
|
||||
"MIN R1.xy, R1, R0;\n"
|
||||
"ADD R0.zw, -R0, c[1].xyxy;\n"
|
||||
"MAX R0.zw, R0, R1.xyxy;\n"
|
||||
"ADD R0.zw, R0, -R0.xyxy;\n"
|
||||
"ABS R0.zw, R0;\n"
|
||||
"CMP R0.zw, -R0, c[5].z, c[5].w;\n"
|
||||
"MUL R0.z, R0, R0.w;\n"
|
||||
"ABS R0.z, R0;\n"
|
||||
"CMP R0.z, -R0, c[5], c[5].w;\n"
|
||||
"ABS R1.x, R0.z;\n"
|
||||
"TEX R0, R0, texture[0], 2D;\n"
|
||||
"CMP R1.x, -R1, c[5].z, c[5].w;\n"
|
||||
"CMP result.color, -R1.x, R0, c[5].z;\n"
|
||||
"END\n";
|
||||
//# 28 instructions, 2 R-regs
|
||||
|
||||
const char *g_StereoOVR_ps_2_0 =
|
||||
"ps_2_0\n"
|
||||
// cgc version 3.1.0013, build date Apr 18 2012
|
||||
// command line args: -profile ps_2_0
|
||||
// source file: pp_oculus_vr.cg
|
||||
//vendor NVIDIA Corporation
|
||||
//version 3.1.0.13
|
||||
//profile ps_2_0
|
||||
//program pp_oculus_vr
|
||||
//semantic pp_oculus_vr.cLensCenter
|
||||
//semantic pp_oculus_vr.cScreenCenter
|
||||
//semantic pp_oculus_vr.cScale
|
||||
//semantic pp_oculus_vr.cScaleIn
|
||||
//semantic pp_oculus_vr.cHmdWarpParam
|
||||
//semantic pp_oculus_vr.cTex0 : TEX0
|
||||
//var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
//var float2 cLensCenter : : c[0] : 1 : 1
|
||||
//var float2 cScreenCenter : : c[1] : 2 : 1
|
||||
//var float2 cScale : : c[2] : 3 : 1
|
||||
//var float2 cScaleIn : : c[3] : 4 : 1
|
||||
//var float4 cHmdWarpParam : : c[4] : 5 : 1
|
||||
//var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1
|
||||
//var float4 oCol : $vout.COLOR : COL : 7 : 1
|
||||
//const c[5] = -0.25 -0.5 0.25 0.5
|
||||
//const c[6] = 1 0
|
||||
"dcl_2d s0\n"
|
||||
"def c5, -0.25000000, -0.50000000, 0.25000000, 0.50000000\n"
|
||||
"def c6, 1.00000000, 0.00000000, 0, 0\n"
|
||||
"dcl t0.xy\n"
|
||||
"add r0.xy, t0, -c0\n"
|
||||
"mul r4.xy, r0, c3\n"
|
||||
"mul r0.x, r4.y, r4.y\n"
|
||||
"mad r0.x, r4, r4, r0\n"
|
||||
"mul r1.x, r0, c4.w\n"
|
||||
"mul r1.x, r1, r0\n"
|
||||
"mad r3.x, r0, c4.y, c4\n"
|
||||
"mul r2.x, r0, c4.z\n"
|
||||
"mad r2.x, r0, r2, r3\n"
|
||||
"mad r0.x, r1, r0, r2\n"
|
||||
"mul r0.xy, r4, r0.x\n"
|
||||
"mul r0.xy, r0, c2\n"
|
||||
"add r3.xy, r0, c0\n"
|
||||
"mov r1.x, c5.z\n"
|
||||
"mov r1.y, c5.w\n"
|
||||
"mov r2.xy, c1\n"
|
||||
"add r2.xy, r1, r2\n"
|
||||
"mov r1.xy, c1\n"
|
||||
"min r2.xy, r2, r3\n"
|
||||
"add r1.xy, c5, r1\n"
|
||||
"max r1.xy, r1, r2\n"
|
||||
"add r1.xy, r1, -r3\n"
|
||||
"abs r1.xy, r1\n"
|
||||
"cmp r1.xy, -r1, c6.x, c6.y\n"
|
||||
"mul_pp r1.x, r1, r1.y\n"
|
||||
"abs_pp r1.x, r1\n"
|
||||
"cmp_pp r1.x, -r1, c6, c6.y\n"
|
||||
"abs_pp r1.x, r1\n"
|
||||
"texld r0, r3, s0\n"
|
||||
"cmp r0, -r1.x, r0, c6.y\n"
|
||||
"mov oC0, r0\n";
|
||||
|
||||
const char *g_StereoOVR_glsl330f =
|
||||
"#version 330\n"
|
||||
"\n"
|
||||
"bool _TMP2;\n"
|
||||
"bvec2 _TMP1;\n"
|
||||
"vec2 _TMP3;\n"
|
||||
"uniform vec2 cLensCenter;\n"
|
||||
"uniform vec2 cScreenCenter;\n"
|
||||
"uniform vec2 cScale;\n"
|
||||
"uniform vec2 cScaleIn;\n"
|
||||
"uniform vec4 cHmdWarpParam;\n"
|
||||
"uniform sampler2D nlTex0;\n"
|
||||
"vec2 _TMP10;\n"
|
||||
"vec2 _b0011;\n"
|
||||
"vec2 _a0011;\n"
|
||||
"in vec4 nlTexCoord0;\n"
|
||||
"out vec4 nlCol;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 _theta;\n"
|
||||
" float _rSq;\n"
|
||||
" vec2 _theta1;\n"
|
||||
" vec2 _tc;\n"
|
||||
"\n"
|
||||
" _theta = (nlTexCoord0.xy - cLensCenter)*cScaleIn;\n"
|
||||
" _rSq = _theta.x*_theta.x + _theta.y*_theta.y;\n"
|
||||
" _theta1 = _theta*(cHmdWarpParam.x + cHmdWarpParam.y*_rSq + cHmdWarpParam.z*_rSq*_rSq + cHmdWarpParam.w*_rSq*_rSq*_rSq);\n"
|
||||
" _tc = cLensCenter + cScale*_theta1;\n"
|
||||
" _a0011 = cScreenCenter - vec2( 0.25, 0.5);\n"
|
||||
" _b0011 = cScreenCenter + vec2( 0.25, 0.5);\n"
|
||||
" _TMP3 = min(_b0011, _tc);\n"
|
||||
" _TMP10 = max(_a0011, _TMP3);\n"
|
||||
" _TMP1 = bvec2(_TMP10.x == _tc.x, _TMP10.y == _tc.y);\n"
|
||||
" _TMP2 = _TMP1.x && _TMP1.y;\n"
|
||||
" if (!_TMP2) {\n"
|
||||
" nlCol = vec4(0, 0, 0, 0);\n"
|
||||
" } else {\n"
|
||||
" nlCol = texture(nlTex0, _tc);\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
||||
}
|
||||
|
||||
/* end of file */
|
|
@ -21,6 +21,8 @@ limitations under the License.
|
|||
|
||||
************************************************************************************/
|
||||
|
||||
#include "std3d.h"
|
||||
|
||||
namespace NL3D {
|
||||
const char *g_StereoOVR_fp40 =
|
||||
"!!ARBfp1.0\n"
|
||||
|
|
Loading…
Reference in a new issue