This commit is contained in:
Mike Popoloski 2014-11-15 13:32:22 -05:00
Родитель 2148c54572 bb1fd097ad
Коммит 893035af65
24 изменённых файлов: 369 добавлений и 254 удалений

Просмотреть файл

@ -1,10 +1,10 @@
[*]
indent_style = tab
indent_size = 4
end_of_line = LF
end_of_line = lf
max_line_length = 100
insert_final_newline = true
[{*.c, *.cpp, *.sc, *.sh, *.lua, *.m, *.mm, *.mk, makefile}]
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

Просмотреть файл

@ -21,6 +21,7 @@
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <c99_compat.h>
/* end standard C headers. */
@ -34,7 +35,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@ -51,7 +52,7 @@ typedef uint32_t flex_uint32_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
@ -184,7 +185,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@ -246,7 +247,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@ -822,9 +823,9 @@ static int yy_init_globals (yyscan_t yyscanner );
/* This must go here because YYSTYPE and YYLTYPE are included
* from bison output in section 1.*/
# define yylval yyg->yylval_r
# define yylloc yyg->yylloc_r
int glcpp_lex_init (yyscan_t* scanner);
int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
@ -863,9 +864,9 @@ YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
@ -879,7 +880,7 @@ extern int glcpp_wrap (yyscan_t yyscanner );
#endif
static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
#endif
@ -899,11 +900,11 @@ static int input (yyscan_t yyscanner );
#endif
static void yy_push_state (int new_state ,yyscan_t yyscanner);
static void yy_pop_state (yyscan_t yyscanner );
static int yy_top_state (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
@ -1361,7 +1362,7 @@ YY_RULE_SETUP
* While in the <DEFINE> state we also need to explicitly
* handle a few other things that may appear before the
* identifier:
*
*
* * Comments, (handled above with the main support for
* comments).
*
@ -2184,7 +2185,7 @@ static void glcpp__load_buffer_state (yyscan_t yyscanner)
YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
@ -2250,7 +2251,7 @@ static void glcpp__load_buffer_state (yyscan_t yyscanner)
}
b->yy_is_interactive = 0;
errno = oerrno;
}
@ -2356,9 +2357,9 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
, yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
@ -2387,12 +2388,12 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
@ -2428,7 +2429,7 @@ YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yys
*/
YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
{
return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
@ -2445,7 +2446,7 @@ YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len ,
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) glcpp_alloc(n ,yyscanner );
@ -2553,10 +2554,10 @@ YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
int glcpp_get_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yylineno;
}
@ -2566,10 +2567,10 @@ int glcpp_get_lineno (yyscan_t yyscanner)
int glcpp_get_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yycolumn;
}
@ -2630,8 +2631,8 @@ void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
yylineno = line_number;
}
@ -2645,8 +2646,8 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner)
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
yycolumn = column_no;
}
@ -2699,13 +2700,13 @@ YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yylloc;
}
void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylloc = yylloc_param;
}
/* User-visible API */
/* glcpp_lex_init is special because it creates the scanner itself, so it is
@ -2753,20 +2754,20 @@ int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals
errno = EINVAL;
return 1;
}
*ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
if (*ptr_yy_globals == NULL){
errno = ENOMEM;
return 1;
}
/* By setting to 0xAA, we expose bugs in
yy_init_globals. Leave at 0x00 for releases. */
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
return yy_init_globals ( *ptr_yy_globals );
}

Просмотреть файл

@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <c99_compat.h>
#include "glcpp.h"
#include "glcpp-parse.h"

Просмотреть файл

@ -44,13 +44,13 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
}
void
_mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
_mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
const char *, int)
{
}
extern "C" void
_mesa_error_no_memory(const char *caller)
_mesa_error_no_memory(const char *)
{
}

Просмотреть файл

@ -236,7 +236,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
float speed = 0.37f;
float middleGray = 0.18f;
float white = 1.1f;
float treshold = 1.5f;
float threshold = 1.5f;
int32_t scrollArea = 0;
@ -285,7 +285,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
imguiSlider("Middle gray", middleGray, 0.1f, 1.0f, 0.01f);
imguiSlider("White point", white, 0.1f, 2.0f, 0.01f);
imguiSlider("Treshold", treshold, 0.1f, 2.0f, 0.01f);
imguiSlider("Threshold", threshold, 0.1f, 2.0f, 0.01f);
imguiEndScrollArea();
imguiEndFrame();
@ -425,10 +425,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
screenSpaceQuad(1.0f, 1.0f, s_originBottomLeft);
bgfx::submit(6);
float tonemap[4] = { middleGray, square(white), treshold, 0.0f };
float tonemap[4] = { middleGray, square(white), threshold, 0.0f };
bgfx::setUniform(u_tonemap, tonemap);
// Bright pass treshold is tonemap[3].
// Bright pass threshold is tonemap[3].
setOffsets4x4Lum(u_offset, width/2, height/2);
bgfx::setTexture(0, u_texColor, fbtextures[0]);
bgfx::setTexture(1, u_texLum, lum[4]);

Просмотреть файл

@ -12,6 +12,7 @@
#include "font/font_manager.h"
#include "font/text_buffer_manager.h"
#include "entry/input.h"
#include <stdio.h>
#include <wchar.h>
@ -192,8 +193,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
textBufferManager->appendText(transientText, visitor10, L"text buffer\n");
textBufferManager->appendText(transientText, visitor10, fpsText);
float at[3] = { 0, 0, 0.0f };
float eye[3] = {0, 0, -1.0f };
float at[3] = { 0, 0, 0.0f };
float eye[3] = { 0, 0, -1.0f };
float view[16];
bx::mtxLookAt(view, eye, at);
@ -211,8 +212,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].adjust[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].adjust[0] / dist * proj[0]);
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float offsetx = width/2.0f;

Просмотреть файл

@ -217,8 +217,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].adjust[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].adjust[0] / dist * proj[0]);
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float viewOffset = width/4.0f;

Просмотреть файл

@ -118,6 +118,7 @@ namespace entry
{ entry::Key::F3, entry::Modifier::None, 1, cmd, "graphics wireframe" },
{ entry::Key::F4, entry::Modifier::None, 1, cmd, "graphics hmd" },
{ entry::Key::F4, entry::Modifier::LeftShift, 1, cmd, "graphics hmdrecenter" },
{ entry::Key::F4, entry::Modifier::LeftCtrl, 1, cmd, "graphics hmddbg" },
{ entry::Key::F7, entry::Modifier::None, 1, cmd, "graphics vsync" },
{ entry::Key::F8, entry::Modifier::None, 1, cmd, "graphics msaa" },
{ entry::Key::Print, entry::Modifier::None, 1, cmd, "graphics screenshot" },
@ -156,110 +157,6 @@ namespace entry
return result;
}
char keyToAscii(entry::Key::Enum _key, bool _shiftModifier)
{
static const char s_keyToAscii[entry::Key::Count] =
{
'\0', // None
0x1b, // Esc
0x0d, // Return
0x09, // Tab
0x20, // Space
0x08, // Backspace
'\0', // Up
'\0', // Down
'\0', // Left
'\0', // Right
'\0', // PageUp
'\0', // PageDown
'\0', // Home
'\0', // End
'\0', // Print
0x3d, // Equals
0x2d, // Minus
'\0', // F1
'\0', // F2
'\0', // F3
'\0', // F4
'\0', // F5
'\0', // F6
'\0', // F7
'\0', // F8
'\0', // F9
'\0', // F10
'\0', // F11
'\0', // F12
0x30, // NumPad0
0x31, // NumPad1
0x32, // NumPad2
0x33, // NumPad3
0x34, // NumPad4
0x35, // NumPad5
0x36, // NumPad6
0x37, // NumPad7
0x38, // NumPad8
0x39, // NumPad9
0x30, // Key0
0x31, // Key1
0x32, // Key2
0x33, // Key3
0x34, // Key4
0x35, // Key5
0x36, // Key6
0x37, // Key7
0x38, // Key8
0x39, // Key9
0x61, // KeyA
0x62, // KeyB
0x63, // KeyC
0x64, // KeyD
0x65, // KeyE
0x66, // KeyF
0x67, // KeyG
0x68, // KeyH
0x69, // KeyI
0x6a, // KeyJ
0x6b, // KeyK
0x6c, // KeyL
0x6d, // KeyM
0x6e, // KeyN
0x6f, // KeyO
0x70, // KeyP
0x71, // KeyQ
0x72, // KeyR
0x73, // KeyS
0x74, // KeyT
0x75, // KeyU
0x76, // KeyV
0x77, // KeyW
0x78, // KeyX
0x79, // KeyY
0x7a, // KeyZ
};
char ascii = s_keyToAscii[_key];
if (_shiftModifier)
{
// Big letters.
if(ascii >= 'a' && ascii <= 'z')
{
ascii += 'A' - 'a';
}
// Special cases.
else if('-' == ascii)
{
ascii = '_';
}
else if ('=' == ascii)
{
ascii = '+';
}
}
return ascii;
}
bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse)
{
s_debug = _debug;
@ -322,6 +219,13 @@ namespace entry
}
break;
case Event::Char:
{
const CharEvent* chev = static_cast<const CharEvent*>(ev);
inputChar(chev->m_len, chev->m_char);
}
break;
case Event::Size:
{
const SizeEvent* size = static_cast<const SizeEvent*>(ev);
@ -440,6 +344,14 @@ namespace entry
}
break;
case Event::Char:
{
const CharEvent* chev = static_cast<const CharEvent*>(ev);
win.m_handle = chev->m_handle;
inputChar(chev->m_len, chev->m_char);
}
break;
case Event::Size:
{
const SizeEvent* size = static_cast<const SizeEvent*>(ev);

Просмотреть файл

@ -155,7 +155,6 @@ namespace entry
uint8_t m_buttons[entry::MouseButton::Count];
};
char keyToAscii(entry::Key::Enum _key, bool _shiftModifier);
bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse = NULL);
bx::FileReaderI* getFileReader();

Просмотреть файл

@ -9,6 +9,7 @@
#include <bx/spscqueue.h>
#include "entry.h"
#include <string.h> // memcpy
#ifndef ENTRY_CONFIG_USE_SDL
# define ENTRY_CONFIG_USE_SDL 0
@ -45,6 +46,7 @@ namespace entry
{
Exit,
Key,
Char,
Mouse,
Size,
Window,
@ -75,6 +77,14 @@ namespace entry
bool m_down;
};
struct CharEvent : public Event
{
ENTRY_IMPLEMENT_EVENT(CharEvent, Event::Char);
uint8_t m_len;
uint8_t m_char[4];
};
struct MouseEvent : public Event
{
ENTRY_IMPLEMENT_EVENT(MouseEvent, Event::Mouse);
@ -124,6 +134,14 @@ namespace entry
m_queue.push(ev);
}
void postCharEvent(WindowHandle _handle, uint8_t _len, const uint8_t _char[4])
{
CharEvent* ev = new CharEvent(_handle);
ev->m_len = _len;
memcpy(ev->m_char, _char, 4);
m_queue.push(ev);
}
void postMouseEvent(WindowHandle _handle, int32_t _mx, int32_t _my, int32_t _mz)
{
MouseEvent* ev = new MouseEvent(_handle);

Просмотреть файл

@ -532,6 +532,26 @@ namespace entry
}
break;
case WM_CHAR:
{
uint8_t utf8[4] = {};
uint8_t len = (uint8_t)WideCharToMultiByte(CP_UTF8
, 0
, (LPCWSTR)&_wparam
, 1
, (LPSTR)utf8
, BX_COUNTOF(utf8)
, NULL
, NULL
);
if (0 != len)
{
WindowHandle handle = findHandle(_hwnd);
m_eventQueue.postCharEvent(handle, len, utf8);
}
}
break;
default:
break;
}

Просмотреть файл

@ -8,6 +8,7 @@
#include "entry_p.h"
#include "input.h"
#include <bx/ringbuffer.h>
#include <tinystl/allocator.h>
#include <tinystl/unordered_map.h>
namespace stl = tinystl;
@ -68,6 +69,7 @@ struct Mouse
struct Keyboard
{
Keyboard()
: m_ring(BX_COUNTOF(m_char) )
{
}
@ -97,8 +99,44 @@ struct Keyboard
m_once[_key] = false;
}
void pushChar(uint8_t _len, const uint8_t _char[4])
{
for (uint32_t len = m_ring.reserve(4)
; len < _len
; len = m_ring.reserve(4)
)
{
popChar();
}
memcpy(&m_char[m_ring.m_current], _char, 4);
m_ring.commit(4);
}
const uint8_t* popChar()
{
if (0 < m_ring.available() )
{
uint8_t* utf8 = &m_char[m_ring.m_read];
m_ring.consume(4);
return utf8;
}
return NULL;
}
void charFlush()
{
m_ring.m_current = 0;
m_ring.m_write = 0;
m_ring.m_read = 0;
}
uint32_t m_key[256];
bool m_once[256];
bx::RingBufferControl m_ring;
uint8_t m_char[256];
};
struct Input
@ -119,7 +157,11 @@ struct Input
void removeBindings(const char* _name)
{
m_inputBindingsMap.erase(m_inputBindingsMap.find(_name));
InputBindingMap::iterator it = m_inputBindingsMap.find(_name);
if (it != m_inputBindingsMap.end() )
{
m_inputBindingsMap.erase(it);
}
}
void process(const InputBinding* _bindings)
@ -204,6 +246,21 @@ void inputSetKeyState(entry::Key::Enum _key, uint8_t _modifiers, bool _down)
s_input.m_keyboard.setKeyState(_key, _modifiers, _down);
}
void inputChar(uint8_t _len, const uint8_t _char[4])
{
s_input.m_keyboard.pushChar(_len, _char);
}
const uint8_t* inputGetChar()
{
return s_input.m_keyboard.popChar();
}
void inputCharFlush()
{
s_input.m_keyboard.charFlush();
}
void inputSetMousePos(int32_t _mx, int32_t _my, int32_t _mz)
{
s_input.m_mouse.setPos(_mx, _my, _mz);

Просмотреть файл

@ -34,6 +34,15 @@ void inputProcess();
///
void inputSetKeyState(entry::Key::Enum _key, uint8_t _modifiers, bool _down);
/// Adds single UTF-8 encoded character into input buffer.
void inputChar(uint8_t _len, const uint8_t _char[4]);
/// Returns single UTF-8 encoded character from input buffer.
const uint8_t* inputGetChar();
/// Flush internal input buffer.
void inputCharFlush();
///
void inputSetMouseResolution(uint16_t _width, uint16_t _height);

Просмотреть файл

@ -236,7 +236,13 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string, const c
CodePoint codepoint = 0;
uint32_t state = 0;
for (; *_string && _string<_end ; ++_string)
if (_end == NULL)
{
_end = _string + strlen(_string);
}
BX_CHECK(_end >= _string);
for (; *_string && _string < _end ; ++_string)
{
if (utf8_decode(&state, (uint32_t*)&codepoint, *_string) == UTF8_ACCEPT )
{
@ -260,7 +266,7 @@ void TextBuffer::appendText(FontHandle _fontHandle, const wchar_t* _string, cons
if (_end == NULL)
{
_end = _string + (uint32_t) wcslen(_string);
_end = _string + wcslen(_string);
}
BX_CHECK(_end >= _string);

Просмотреть файл

@ -162,9 +162,9 @@ void TextLineMetrics::getSubText(const char* _string, uint32_t _firstLine, uint3
{
for (; *_string; ++_string)
{
if(utf8_decode(&state, (uint32_t*)&codepoint, *_string) == UTF8_ACCEPT)
if (utf8_decode(&state, (uint32_t*)&codepoint, *_string) == UTF8_ACCEPT)
{
if(codepoint == L'\n')
if (codepoint == L'\n')
{
++currentLine;
++_string;

Просмотреть файл

@ -788,8 +788,8 @@ struct Imgui
time += 0.05f;
const float dist = 10.0f;
const float offset0 = -proj[8] + (hmd->eye[0].adjust[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].adjust[0] / dist * proj[0]);
const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]);
const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]);
float ortho[2][16];
const float viewOffset = _width/4.0f;
@ -911,14 +911,23 @@ struct Imgui
const float barHeight = (float)height / (float)sh;
const int32_t diff = height - sh;
if (diff < 0)
// Handle mouse scrolling.
if (area.m_inside && !anyActive() )
{
*area.m_scrollVal = (*area.m_scrollVal > diff) ? *area.m_scrollVal : diff;
}
else
{
*area.m_scrollVal = 0;
const int32_t min = height - sh;
if (min > 0)
{
*area.m_scrollVal = 0;
}
else if (m_scroll)
{
const int32_t val = *area.m_scrollVal + 20*m_scroll;
const int32_t max = 0;
*area.m_scrollVal = ( val > max ? max
: val < min ? min
: val
);
}
}
if (barHeight < 1.0f)
@ -1017,15 +1026,6 @@ struct Imgui
);
}
}
// Handle mouse scrolling.
if (area.m_inside) // && !anyActive() )
{
if (m_scroll)
{
*area.m_scrollVal += bx::uint32_clamp(20 * m_scroll, 0, sh - height);
}
}
}
area.m_inside = false;
@ -1547,8 +1547,9 @@ struct Imgui
return selected;
}
void image(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
bool image(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
{
const uint32_t id = getId();
Area& area = getCurrentArea();
int32_t xx;
@ -1576,6 +1577,10 @@ struct Imgui
const int32_t yy = area.m_widgetY;
area.m_widgetY += _height + DEFAULT_SPACING;
const bool enabled = isEnabled(m_areaId);
const bool over = enabled && inRect(xx, yy, _width, _height);
const bool res = buttonLogic(id, over);
screenQuad(xx, yy, _width, _height, _originBottomLeft);
bgfx::setUniform(u_imageLod, &_lod);
bgfx::setTexture(0, s_texColor, bgfx::isValid(_image) ? _image : m_missingTexture);
@ -1583,20 +1588,23 @@ struct Imgui
bgfx::setProgram(m_imageProgram);
setCurrentScissor();
bgfx::submit(m_view);
return res;
}
void image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
bool image(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
{
const float width = _width*float(getCurrentArea().m_widgetW);
const float height = width/_aspect;
image(_image, _lod, int32_t(width), int32_t(height), _align, _originBottomLeft);
return image(_image, _lod, int32_t(width), int32_t(height), _align, _originBottomLeft);
}
void imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
{
BX_CHECK(_channel < 4, "Channel param must be from 0 to 3!");
const uint32_t id = getId();
Area& area = getCurrentArea();
int32_t xx;
@ -1624,6 +1632,10 @@ struct Imgui
const int32_t yy = area.m_widgetY;
area.m_widgetY += _height + DEFAULT_SPACING;
const bool enabled = isEnabled(m_areaId);
const bool over = enabled && inRect(xx, yy, _width, _height);
const bool res = buttonLogic(id, over);
screenQuad(xx, yy, _width, _height);
bgfx::setUniform(u_imageLod, &_lod);
@ -1636,14 +1648,16 @@ struct Imgui
bgfx::setProgram(m_imageSwizzProgram);
setCurrentScissor();
bgfx::submit(m_view);
return res;
}
void imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
bool imageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
{
const float width = _width*float(getCurrentArea().m_widgetW);
const float height = width/_aspect;
imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align);
return imageChannel(_image, _channel, _lod, int32_t(width), int32_t(height), _align);
}
bool cubeMap(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align)
@ -1663,24 +1677,24 @@ struct Imgui
if (_cross)
{
vertex->set( 0.0f, 0.5f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(0.0f, 0.5f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(0.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 0.5f, 0.0f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 0.5f, 0.5f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 0.5f, 1.0f, 0.0f, -1.0f, -1.0f, 1.0f); ++vertex;
vertex->set( 0.5f, 1.5f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(0.5f, 0.0f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(0.5f, 0.5f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(0.5f, 1.0f, 0.0f, -1.0f, -1.0f, 1.0f); ++vertex;
vertex->set(0.5f, 1.5f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 1.0f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set( 1.0f, 1.5f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(1.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(1.0f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 1.5f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 1.5f, 0.5f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 1.5f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(1.5f, 0.5f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(1.5f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 2.0f, 0.5f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 2.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(2.0f, 0.5f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(2.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
indices += addQuad(indices, 0, 3, 4, 1);
indices += addQuad(indices, 2, 6, 7, 3);
@ -1691,25 +1705,25 @@ struct Imgui
}
else
{
vertex->set( 0.0f, 0.25f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 0.0f, 0.75f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(0.0f, 0.25f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(0.0f, 0.75f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 0.5f, 0.00f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 0.5f, 0.50f, 0.0f, -1.0f, -1.0f, 1.0f); ++vertex;
vertex->set( 0.5f, 1.00f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(0.5f, 0.00f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(0.5f, 0.50f, 0.0f, -1.0f, -1.0f, 1.0f); ++vertex;
vertex->set(0.5f, 1.00f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 1.0f, 0.25f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 1.0f, 0.75f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 0.25f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 0.75f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set( 1.0f, 0.25f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 1.0f, 0.75f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 0.25f, 0.0f, 1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(1.0f, 0.75f, 0.0f, 1.0f, -1.0f, 1.0f); ++vertex;
vertex->set( 1.5f, 0.00f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set( 1.5f, 0.50f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 1.5f, 1.00f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(1.5f, 0.00f, 0.0f, -1.0f, 1.0f, 1.0f); ++vertex;
vertex->set(1.5f, 0.50f, 0.0f, 1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(1.5f, 1.00f, 0.0f, 1.0f, -1.0f, -1.0f); ++vertex;
vertex->set( 2.0f, 0.25f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set( 2.0f, 0.75f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
vertex->set(2.0f, 0.25f, 0.0f, -1.0f, 1.0f, -1.0f); ++vertex;
vertex->set(2.0f, 0.75f, 0.0f, -1.0f, -1.0f, -1.0f); ++vertex;
indices += addQuad(indices, 0, 2, 3, 1);
indices += addQuad(indices, 1, 3, 6, 4);
@ -1733,7 +1747,7 @@ struct Imgui
|| ImguiAlign::Right == _align)
{
xx = area.m_widgetX;
width = area.m_widgetW-1; //TODO: -1 !
width = area.m_widgetW;
}
else //if (ImguiAlign::Center == _align
//|| ImguiAlign::CenterIndented == _align).
@ -1750,7 +1764,7 @@ struct Imgui
const bool over = enabled && inRect(xx, yy, width, height);
const bool res = buttonLogic(id, over);
const float scale = float(width/2);
const float scale = float(width/2)+0.25f;
float mtx[16];
bx::mtxSRT(mtx, scale, scale, 1.0f, 0.0f, 0.0f, 0.0f, float(xx), float(yy), 0.0f);
@ -3277,7 +3291,7 @@ void imguiColorWheel(const char* _text, float _rgb[3], bool& _activated, bool _e
, _rgb[2]
);
if (imguiCollapse(_text, buf, _activated, _enabled) )
if (imguiCollapse(_text, buf, _activated) )
{
_activated = !_activated;
}
@ -3288,24 +3302,24 @@ void imguiColorWheel(const char* _text, float _rgb[3], bool& _activated, bool _e
}
}
void imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
bool imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align, bool _originBottomLeft)
{
s_imgui.image(_image, _lod, _width, _height, _align, _originBottomLeft);
return s_imgui.image(_image, _lod, _width, _height, _align, _originBottomLeft);
}
void imguiImage(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
bool imguiImage(bgfx::TextureHandle _image, float _lod, float _width, float _aspect, ImguiAlign::Enum _align, bool _originBottomLeft)
{
s_imgui.image(_image, _lod, _width, _aspect, _align, _originBottomLeft);
return s_imgui.image(_image, _lod, _width, _aspect, _align, _originBottomLeft);
}
void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align)
{
s_imgui.imageChannel(_image, _channel, _lod, _width, _height, _align);
return s_imgui.imageChannel(_image, _channel, _lod, _width, _height, _align);
}
void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _width, float _aspect, ImguiAlign::Enum _align)
{
s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align);
return s_imgui.imageChannel(_image, _channel, _lod, _width, _aspect, _align);
}
bool imguiCube(bgfx::TextureHandle _cubemap, float _lod, bool _cross, ImguiAlign::Enum _align)

Просмотреть файл

@ -174,10 +174,10 @@ uint32_t imguiChooseUseMacroInstead(uint32_t _selected, ...);
void imguiColorWheel(float _rgb[3], bool _respectIndentation = false, bool _enabled = true);
void imguiColorWheel(const char* _str, float _rgb[3], bool& _activated, bool _enabled = true);
void imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _originBottomLeft = false);
void imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _originBottomLeft = false);
void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented);
void imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented);
bool imguiImage(bgfx::TextureHandle _image, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _originBottomLeft = false);
bool imguiImage(bgfx::TextureHandle _image, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented, bool _originBottomLeft = false);
bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, int32_t _width, int32_t _height, ImguiAlign::Enum _align = ImguiAlign::LeftIndented);
bool imguiImageChannel(bgfx::TextureHandle _image, uint8_t _channel, float _lod, float _scale, float _aspect, ImguiAlign::Enum _align = ImguiAlign::LeftIndented);
bool imguiCube(bgfx::TextureHandle _cubemap, float _lod = 0.0f, bool _cross = true, ImguiAlign::Enum _align = ImguiAlign::LeftIndented);
float imguiGetTextLength(const char* _text, ImguiFontHandle _handle);

Просмотреть файл

@ -378,7 +378,7 @@ namespace bgfx
float rotation[4]; //!< Eye rotation represented as quaternion.
float translation[3]; //!< Eye translation.
float fov[4]; //!< Field of view (up, down, left, right).
float adjust[3]; //!< Eye view matrix translation adjustment.
float viewOffset[3]; //!< Eye view matrix translation adjustment.
float pixelsPerTanAngle[2]; //!<
};

Просмотреть файл

@ -202,7 +202,7 @@ ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin))
ifeq ($(UNAME),$(filter $(UNAME),Darwin))
OS=darwin
BUILD_PROJECT_DIR=gmake-osx
BUILD_OUTPUT_DIR=osx64_gcc
BUILD_OUTPUT_DIR=osx64_clang
BUILD_TOOLS_CONFIG=release64
EXE=
else

Просмотреть файл

@ -2225,7 +2225,12 @@ namespace bgfx
&& BGFX_CHUNK_MAGIC_FSH != magic
&& BGFX_CHUNK_MAGIC_VSH != magic)
{
BX_WARN(false, "Invalid shader signature! 0x%08x.", magic);
BX_WARN(false, "Invalid shader signature! %c%c%c%d."
, ( (uint8_t*)&magic)[0]
, ( (uint8_t*)&magic)[1]
, ( (uint8_t*)&magic)[2]
, ( (uint8_t*)&magic)[3]
);
ShaderHandle invalid = BGFX_INVALID_HANDLE;
return invalid;
}

Просмотреть файл

@ -12,6 +12,7 @@ namespace bgfx
OVR::OVR()
: m_hmd(NULL)
, m_initialized(false)
, m_debug(false)
{
}
@ -39,6 +40,46 @@ namespace bgfx
return false;
}
if (_debug)
{
switch (_config->Header.API)
{
#if BGFX_CONFIG_RENDERER_DIRECT3D9
case ovrRenderAPI_D3D9:
{
ovrD3D9ConfigData* data = (ovrD3D9ConfigData*)_config;
m_rtSize = data->Header.RTSize;
}
break;
#endif // BGFX_CONFIG_RENDERER_DIRECT3D9
#if BGFX_CONFIG_RENDERER_DIRECT3D11
case ovrRenderAPI_D3D11:
{
ovrD3D11ConfigData* data = (ovrD3D11ConfigData*)_config;
m_rtSize = data->Header.RTSize;
}
break;
#endif // BGFX_CONFIG_RENDERER_DIRECT3D11
#if BGFX_CONFIG_RENDERER_OPENGL
case ovrRenderAPI_OpenGL:
{
ovrGLConfigData* data = (ovrGLConfigData*)_config;
m_rtSize = data->Header.RTSize;
}
break;
#endif // BGFX_CONFIG_RENDERER_OPENGL
default:
BX_CHECK(false, "You should not be here!");
break;
}
m_debug = true;
return false;
}
if (!_debug)
{
m_hmd = ovrHmd_Create(0);
@ -67,6 +108,7 @@ namespace bgfx
| ovrDistortionCap_Vignette
| ovrDistortionCap_TimeWarp
| ovrDistortionCap_Overdrive
| ovrDistortionCap_NoRestore
, eyeFov
, m_erd
);
@ -135,6 +177,8 @@ ovrError:
ovrHmd_Destroy(m_hmd);
m_hmd = NULL;
}
m_debug = false;
}
bool OVR::swap()
@ -153,8 +197,8 @@ ovrError:
m_timing = ovrHmd_BeginFrame(m_hmd, 0);
m_pose[0] = ovrHmd_GetEyePose(m_hmd, ovrEye_Left);
m_pose[1] = ovrHmd_GetEyePose(m_hmd, ovrEye_Right);
m_pose[0] = ovrHmd_GetHmdPosePerEye(m_hmd, ovrEye_Left);
m_pose[1] = ovrHmd_GetHmdPosePerEye(m_hmd, ovrEye_Right);
return true;
}
@ -175,7 +219,7 @@ ovrError:
for (int ii = 0; ii < 2; ++ii)
{
ovrPosef& pose = m_pose[ii];
pose = ovrHmd_GetEyePose(m_hmd, eye[ii]);
pose = ovrHmd_GetHmdPosePerEye(m_hmd, eye[ii]);
HMD::Eye& eye = _hmd.eye[ii];
eye.rotation[0] = pose.Orientation.x;
@ -191,21 +235,38 @@ ovrError:
eye.fov[1] = erd.Fov.DownTan;
eye.fov[2] = erd.Fov.LeftTan;
eye.fov[3] = erd.Fov.RightTan;
eye.adjust[0] = erd.ViewAdjust.x;
eye.adjust[1] = erd.ViewAdjust.y;
eye.adjust[2] = erd.ViewAdjust.z;
eye.viewOffset[0] = erd.HmdToEyeViewOffset.x;
eye.viewOffset[1] = erd.HmdToEyeViewOffset.y;
eye.viewOffset[2] = erd.HmdToEyeViewOffset.z;
eye.pixelsPerTanAngle[0] = erd.PixelsPerTanAngleAtCenter.x;
eye.pixelsPerTanAngle[1] = erd.PixelsPerTanAngleAtCenter.y;
}
_hmd.width = uint16_t(m_rtSize.w);
_hmd.height = uint16_t(m_rtSize.h);
}
else
{
_hmd.width = 0;
_hmd.height = 0;
for (int ii = 0; ii < 2; ++ii)
{
_hmd.eye[ii].rotation[0] = 0.0f;
_hmd.eye[ii].rotation[1] = 0.0f;
_hmd.eye[ii].rotation[2] = 0.0f;
_hmd.eye[ii].rotation[3] = 1.0f;
_hmd.eye[ii].translation[0] = 0.0f;
_hmd.eye[ii].translation[1] = 0.0f;
_hmd.eye[ii].translation[2] = 0.0f;
_hmd.eye[ii].fov[0] = 1.32928634f;
_hmd.eye[ii].fov[1] = 1.32928634f;
_hmd.eye[ii].fov[2] = 0 == ii ? 1.05865765f : 1.09236801f;
_hmd.eye[ii].fov[3] = 0 == ii ? 1.09236801f : 1.05865765f;
_hmd.eye[ii].viewOffset[0] = 0 == ii ? 0.0355070010f : -0.0375000015f;
_hmd.eye[ii].viewOffset[1] = 0.0f;
_hmd.eye[ii].viewOffset[2] = 0 == ii ? 0.00150949787f : -0.00150949787f;
_hmd.eye[ii].pixelsPerTanAngle[0] = 1;
_hmd.eye[ii].pixelsPerTanAngle[1] = 1;
}
}
_hmd.width = uint16_t(m_rtSize.w);
_hmd.height = uint16_t(m_rtSize.h);
}
} // namespace bgfx

Просмотреть файл

@ -44,6 +44,11 @@ namespace bgfx
return NULL != m_hmd;
}
bool isDebug() const
{
return m_debug;
}
void init();
void shutdown();
@ -68,6 +73,7 @@ namespace bgfx
ovrSizei m_rtSize;
bool m_warning;
bool m_initialized;
bool m_debug;
};
} // namespace bgfx
@ -104,6 +110,11 @@ namespace bgfx
return false;
}
bool isDebug() const
{
return false;
}
bool swap()
{
return false;

Просмотреть файл

@ -1915,9 +1915,9 @@ RENDERDOC_IMPORT
void ovrPreReset()
{
#if BGFX_CONFIG_USE_OVR
m_ovr.preReset();
if (NULL != m_ovrRtv)
{
m_ovr.preReset();
std::swap(m_ovrRtv, m_backBufferColor);
std::swap(m_ovrDsv, m_backBufferDepthStencil);
BX_CHECK(NULL == m_backBufferDepthStencil, "");
@ -3041,7 +3041,7 @@ RENDERDOC_IMPORT
Matrix4* mtxView[2] = { _render->m_view, mtxViewTmp[1] };
Matrix4 mtxViewProj[2][BGFX_CONFIG_MAX_VIEWS];
const bool hmdEnabled = m_ovr.isEnabled();
const bool hmdEnabled = m_ovr.isEnabled() || m_ovr.isDebug();
_render->m_hmdEnabled = hmdEnabled;
if (hmdEnabled)
@ -3056,9 +3056,9 @@ RENDERDOC_IMPORT
for (uint32_t eye = 0; eye < 2; ++eye)
{
const HMD::Eye& hmdEye = hmd.eye[eye];
viewAdjust.un.val[12] = hmdEye.adjust[0];
viewAdjust.un.val[13] = hmdEye.adjust[1];
viewAdjust.un.val[14] = hmdEye.adjust[2];
viewAdjust.un.val[12] = hmdEye.viewOffset[0];
viewAdjust.un.val[13] = hmdEye.viewOffset[1];
viewAdjust.un.val[14] = hmdEye.viewOffset[2];
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{

Просмотреть файл

@ -2017,9 +2017,9 @@ namespace bgfx
void ovrPreReset()
{
#if BGFX_CONFIG_USE_OVR
m_ovr.preReset();
if (m_ovr.isEnabled() )
{
m_ovr.preReset();
GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) );
GL_CHECK(glDeleteFramebuffers(1, &m_msaaBackBufferFbo) );
m_msaaBackBufferFbo = m_ovrFbo;
@ -4121,7 +4121,7 @@ namespace bgfx
Matrix4* mtxView[2] = { _render->m_view, mtxViewTmp[1] };
Matrix4 mtxViewProj[2][BGFX_CONFIG_MAX_VIEWS];
const bool hmdEnabled = m_ovr.isEnabled();
const bool hmdEnabled = m_ovr.isEnabled() || m_ovr.isDebug();
_render->m_hmdEnabled = hmdEnabled;
if (hmdEnabled)
@ -4136,9 +4136,9 @@ namespace bgfx
for (uint32_t eye = 0; eye < 2; ++eye)
{
const HMD::Eye& hmdEye = hmd.eye[eye];
viewAdjust.un.val[12] = hmdEye.adjust[0];
viewAdjust.un.val[13] = hmdEye.adjust[1];
viewAdjust.un.val[14] = hmdEye.adjust[2];
viewAdjust.un.val[12] = hmdEye.viewOffset[0];
viewAdjust.un.val[13] = hmdEye.viewOffset[1];
viewAdjust.un.val[14] = hmdEye.viewOffset[2];
for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{