mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-24 08:38:32 -05:00
Added examples.
This commit is contained in:
parent
b505078b38
commit
1621cc851a
69 changed files with 2087 additions and 1243 deletions
6
3rdparty/compiler/mingw/alloca.h
vendored
6
3rdparty/compiler/mingw/alloca.h
vendored
|
@ -1,6 +0,0 @@
|
|||
#ifndef __MINGW32__ALLOCA_H__
|
||||
#define __MINGW32__ALLOCA_H__
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
#endif // __MINGW32__ALLOCA_H__
|
252
3rdparty/compiler/mingw/sal.h
vendored
252
3rdparty/compiler/mingw/sal.h
vendored
|
@ -1,252 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#if __GNUC__ >=3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
//#define __null // << Conflicts with GCC internal type __null
|
||||
#define __notnull
|
||||
#define __maybenull
|
||||
#define __readonly
|
||||
#define __notreadonly
|
||||
#define __maybereadonly
|
||||
#define __valid
|
||||
#define __notvalid
|
||||
#define __maybevalid
|
||||
#define __readableTo(extent)
|
||||
#define __elem_readableTo(size)
|
||||
#define __byte_readableTo(size)
|
||||
#define __writableTo(size)
|
||||
#define __elem_writableTo(size)
|
||||
#define __byte_writableTo(size)
|
||||
#define __deref
|
||||
#define __pre
|
||||
#define __post
|
||||
#define __precond(expr)
|
||||
#define __postcond(expr)
|
||||
#define __exceptthat
|
||||
#define __execeptthat
|
||||
#define __inner_success(expr)
|
||||
#define __inner_checkReturn
|
||||
#define __inner_typefix(ctype)
|
||||
#define __inner_override
|
||||
#define __inner_callback
|
||||
#define __inner_blocksOn(resource)
|
||||
#define __inner_fallthrough_dec
|
||||
#define __inner_fallthrough
|
||||
#define __refparam
|
||||
#define __inner_control_entrypoint(category)
|
||||
#define __inner_data_entrypoint(category)
|
||||
|
||||
#define __ecount(size)
|
||||
#define __bcount(size)
|
||||
#define __in
|
||||
#define __in_ecount(size)
|
||||
#define __in_bcount(size)
|
||||
#define __in_z
|
||||
#define __in_ecount_z(size)
|
||||
#define __in_bcount_z(size)
|
||||
#define __in_nz
|
||||
#define __in_ecount_nz(size)
|
||||
#define __in_bcount_nz(size)
|
||||
#define __out
|
||||
#define __out_ecount(size)
|
||||
#define __out_bcount(size)
|
||||
#define __out_ecount_part(size,length)
|
||||
#define __out_bcount_part(size,length)
|
||||
#define __out_ecount_full(size)
|
||||
#define __out_bcount_full(size)
|
||||
#define __out_z
|
||||
#define __out_z_opt
|
||||
#define __out_ecount_z(size)
|
||||
#define __out_bcount_z(size)
|
||||
#define __out_ecount_part_z(size,length)
|
||||
#define __out_bcount_part_z(size,length)
|
||||
#define __out_ecount_full_z(size)
|
||||
#define __out_bcount_full_z(size)
|
||||
#define __out_nz
|
||||
#define __out_nz_opt
|
||||
#define __out_ecount_nz(size)
|
||||
#define __out_bcount_nz(size)
|
||||
#define __inout
|
||||
#define __inout_ecount(size)
|
||||
#define __inout_bcount(size)
|
||||
#define __inout_ecount_part(size,length)
|
||||
#define __inout_bcount_part(size,length)
|
||||
#define __inout_ecount_full(size)
|
||||
#define __inout_bcount_full(size)
|
||||
#define __inout_z
|
||||
#define __inout_ecount_z(size)
|
||||
#define __inout_bcount_z(size)
|
||||
#define __inout_nz
|
||||
#define __inout_ecount_nz(size)
|
||||
#define __inout_bcount_nz(size)
|
||||
#define __ecount_opt(size)
|
||||
#define __bcount_opt(size)
|
||||
#define __in_opt
|
||||
#define __in_ecount_opt(size)
|
||||
#define __in_bcount_opt(size)
|
||||
#define __in_z_opt
|
||||
#define __in_ecount_z_opt(size)
|
||||
#define __in_bcount_z_opt(size)
|
||||
#define __in_nz_opt
|
||||
#define __in_ecount_nz_opt(size)
|
||||
#define __in_bcount_nz_opt(size)
|
||||
#define __out_opt
|
||||
#define __out_ecount_opt(size)
|
||||
#define __out_bcount_opt(size)
|
||||
#define __out_ecount_part_opt(size,length)
|
||||
#define __out_bcount_part_opt(size,length)
|
||||
#define __out_ecount_full_opt(size)
|
||||
#define __out_bcount_full_opt(size)
|
||||
#define __out_ecount_z_opt(size)
|
||||
#define __out_bcount_z_opt(size)
|
||||
#define __out_ecount_part_z_opt(size,length)
|
||||
#define __out_bcount_part_z_opt(size,length)
|
||||
#define __out_ecount_full_z_opt(size)
|
||||
#define __out_bcount_full_z_opt(size)
|
||||
#define __out_ecount_nz_opt(size)
|
||||
#define __out_bcount_nz_opt(size)
|
||||
#define __inout_opt
|
||||
#define __inout_ecount_opt(size)
|
||||
#define __inout_bcount_opt(size)
|
||||
#define __inout_ecount_part_opt(size,length)
|
||||
#define __inout_bcount_part_opt(size,length)
|
||||
#define __inout_ecount_full_opt(size)
|
||||
#define __inout_bcount_full_opt(size)
|
||||
#define __inout_z_opt
|
||||
#define __inout_ecount_z_opt(size)
|
||||
#define __inout_ecount_z_opt(size)
|
||||
#define __inout_bcount_z_opt(size)
|
||||
#define __inout_nz_opt
|
||||
#define __inout_ecount_nz_opt(size)
|
||||
#define __inout_bcount_nz_opt(size)
|
||||
#define __deref_ecount(size)
|
||||
#define __deref_bcount(size)
|
||||
#define __deref_out
|
||||
#define __deref_out_ecount(size)
|
||||
#define __deref_out_bcount(size)
|
||||
#define __deref_out_ecount_part(size,length)
|
||||
#define __deref_out_bcount_part(size,length)
|
||||
#define __deref_out_ecount_full(size)
|
||||
#define __deref_out_bcount_full(size)
|
||||
#define __deref_out_z
|
||||
#define __deref_out_ecount_z(size)
|
||||
#define __deref_out_bcount_z(size)
|
||||
#define __deref_out_nz
|
||||
#define __deref_out_ecount_nz(size)
|
||||
#define __deref_out_bcount_nz(size)
|
||||
#define __deref_inout
|
||||
#define __deref_inout_z
|
||||
#define __deref_inout_ecount(size)
|
||||
#define __deref_inout_bcount(size)
|
||||
#define __deref_inout_ecount_part(size,length)
|
||||
#define __deref_inout_bcount_part(size,length)
|
||||
#define __deref_inout_ecount_full(size)
|
||||
#define __deref_inout_bcount_full(size)
|
||||
#define __deref_inout_z
|
||||
#define __deref_inout_ecount_z(size)
|
||||
#define __deref_inout_bcount_z(size)
|
||||
#define __deref_inout_nz
|
||||
#define __deref_inout_ecount_nz(size)
|
||||
#define __deref_inout_bcount_nz(size)
|
||||
#define __deref_ecount_opt(size)
|
||||
#define __deref_bcount_opt(size)
|
||||
#define __deref_out_opt
|
||||
#define __deref_out_ecount_opt(size)
|
||||
#define __deref_out_bcount_opt(size)
|
||||
#define __deref_out_ecount_part_opt(size,length)
|
||||
#define __deref_out_bcount_part_opt(size,length)
|
||||
#define __deref_out_ecount_full_opt(size)
|
||||
#define __deref_out_bcount_full_opt(size)
|
||||
#define __deref_out_z_opt
|
||||
#define __deref_out_ecount_z_opt(size)
|
||||
#define __deref_out_bcount_z_opt(size)
|
||||
#define __deref_out_nz_opt
|
||||
#define __deref_out_ecount_nz_opt(size)
|
||||
#define __deref_out_bcount_nz_opt(size)
|
||||
#define __deref_inout_opt
|
||||
#define __deref_inout_ecount_opt(size)
|
||||
#define __deref_inout_bcount_opt(size)
|
||||
#define __deref_inout_ecount_part_opt(size,length)
|
||||
#define __deref_inout_bcount_part_opt(size,length)
|
||||
#define __deref_inout_ecount_full_opt(size)
|
||||
#define __deref_inout_bcount_full_opt(size)
|
||||
#define __deref_inout_z_opt
|
||||
#define __deref_inout_ecount_z_opt(size)
|
||||
#define __deref_inout_bcount_z_opt(size)
|
||||
#define __deref_inout_nz_opt
|
||||
#define __deref_inout_ecount_nz_opt(size)
|
||||
#define __deref_inout_bcount_nz_opt(size)
|
||||
#define __deref_opt_ecount(size)
|
||||
#define __deref_opt_bcount(size)
|
||||
#define __deref_opt_out
|
||||
#define __deref_opt_out_z
|
||||
#define __deref_opt_out_ecount(size)
|
||||
#define __deref_opt_out_bcount(size)
|
||||
#define __deref_opt_out_ecount_part(size,length)
|
||||
#define __deref_opt_out_bcount_part(size,length)
|
||||
#define __deref_opt_out_ecount_full(size)
|
||||
#define __deref_opt_out_bcount_full(size)
|
||||
#define __deref_opt_inout
|
||||
#define __deref_opt_inout_ecount(size)
|
||||
#define __deref_opt_inout_bcount(size)
|
||||
#define __deref_opt_inout_ecount_part(size,length)
|
||||
#define __deref_opt_inout_bcount_part(size,length)
|
||||
#define __deref_opt_inout_ecount_full(size)
|
||||
#define __deref_opt_inout_bcount_full(size)
|
||||
#define __deref_opt_inout_z
|
||||
#define __deref_opt_inout_ecount_z(size)
|
||||
#define __deref_opt_inout_bcount_z(size)
|
||||
#define __deref_opt_inout_nz
|
||||
#define __deref_opt_inout_ecount_nz(size)
|
||||
#define __deref_opt_inout_bcount_nz(size)
|
||||
#define __deref_opt_ecount_opt(size)
|
||||
#define __deref_opt_bcount_opt(size)
|
||||
#define __deref_opt_out_opt
|
||||
#define __deref_opt_out_ecount_opt(size)
|
||||
#define __deref_opt_out_bcount_opt(size)
|
||||
#define __deref_opt_out_ecount_part_opt(size,length)
|
||||
#define __deref_opt_out_bcount_part_opt(size,length)
|
||||
#define __deref_opt_out_ecount_full_opt(size)
|
||||
#define __deref_opt_out_bcount_full_opt(size)
|
||||
#define __deref_opt_out_z_opt
|
||||
#define __deref_opt_out_ecount_z_opt(size)
|
||||
#define __deref_opt_out_bcount_z_opt(size)
|
||||
#define __deref_opt_out_nz_opt
|
||||
#define __deref_opt_out_ecount_nz_opt(size)
|
||||
#define __deref_opt_out_bcount_nz_opt(size)
|
||||
#define __deref_opt_inout_opt
|
||||
#define __deref_opt_inout_ecount_opt(size)
|
||||
#define __deref_opt_inout_bcount_opt(size)
|
||||
#define __deref_opt_inout_ecount_part_opt(size,length)
|
||||
#define __deref_opt_inout_bcount_part_opt(size,length)
|
||||
#define __deref_opt_inout_ecount_full_opt(size)
|
||||
#define __deref_opt_inout_bcount_full_opt(size)
|
||||
#define __deref_opt_inout_z_opt
|
||||
#define __deref_opt_inout_ecount_z_opt(size)
|
||||
#define __deref_opt_inout_bcount_z_opt(size)
|
||||
#define __deref_opt_inout_nz_opt
|
||||
#define __deref_opt_inout_ecount_nz_opt(size)
|
||||
#define __deref_opt_inout_bcount_nz_opt(size)
|
||||
|
||||
#define __success(expr)
|
||||
#define __nullterminated
|
||||
#define __nullnullterminated
|
||||
#define __reserved
|
||||
#define __checkReturn
|
||||
#define __typefix(ctype)
|
||||
#define __override
|
||||
#define __callback
|
||||
#define __format_string
|
||||
#define __blocksOn(resource)
|
||||
#define __control_entrypoint(category)
|
||||
#define __data_entrypoint(category)
|
||||
|
||||
#ifndef __fallthrough
|
||||
#define __fallthrough __inner_fallthrough
|
||||
#endif
|
||||
|
||||
#ifndef __analysis_assume
|
||||
#define __analysis_assume(expr)
|
||||
#endif
|
1
3rdparty/compiler/mingw/specstrings_strict.h
vendored
1
3rdparty/compiler/mingw/specstrings_strict.h
vendored
|
@ -1 +0,0 @@
|
|||
#define __reserved
|
2
3rdparty/compiler/mingw/specstrings_undef.h
vendored
2
3rdparty/compiler/mingw/specstrings_undef.h
vendored
|
@ -1,2 +0,0 @@
|
|||
#undef __reserved
|
||||
|
1
3rdparty/compiler/mingw/unordered_map
vendored
1
3rdparty/compiler/mingw/unordered_map
vendored
|
@ -1 +0,0 @@
|
|||
#include <tr1/unordered_map>
|
305
3rdparty/compiler/msvc/inttypes.h
vendored
305
3rdparty/compiler/msvc/inttypes.h
vendored
|
@ -1,305 +0,0 @@
|
|||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_INTTYPES_H_ // [
|
||||
#define _MSC_INTTYPES_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
// 7.8 Format conversion of integer types
|
||||
|
||||
typedef struct {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
} imaxdiv_t;
|
||||
|
||||
// 7.8.1 Macros for format specifiers
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
|
||||
|
||||
// The fprintf macros for signed integers are:
|
||||
#define PRId8 "d"
|
||||
#define PRIi8 "i"
|
||||
#define PRIdLEAST8 "d"
|
||||
#define PRIiLEAST8 "i"
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIiFAST8 "i"
|
||||
|
||||
#define PRId16 "hd"
|
||||
#define PRIi16 "hi"
|
||||
#define PRIdLEAST16 "hd"
|
||||
#define PRIiLEAST16 "hi"
|
||||
#define PRIdFAST16 "hd"
|
||||
#define PRIiFAST16 "hi"
|
||||
|
||||
#define PRId32 "I32d"
|
||||
#define PRIi32 "I32i"
|
||||
#define PRIdLEAST32 "I32d"
|
||||
#define PRIiLEAST32 "I32i"
|
||||
#define PRIdFAST32 "I32d"
|
||||
#define PRIiFAST32 "I32i"
|
||||
|
||||
#define PRId64 "I64d"
|
||||
#define PRIi64 "I64i"
|
||||
#define PRIdLEAST64 "I64d"
|
||||
#define PRIiLEAST64 "I64i"
|
||||
#define PRIdFAST64 "I64d"
|
||||
#define PRIiFAST64 "I64i"
|
||||
|
||||
#define PRIdMAX "I64d"
|
||||
#define PRIiMAX "I64i"
|
||||
|
||||
#define PRIdPTR "Id"
|
||||
#define PRIiPTR "Ii"
|
||||
|
||||
// The fprintf macros for unsigned integers are:
|
||||
#define PRIo8 "o"
|
||||
#define PRIu8 "u"
|
||||
#define PRIx8 "x"
|
||||
#define PRIX8 "X"
|
||||
#define PRIoLEAST8 "o"
|
||||
#define PRIuLEAST8 "u"
|
||||
#define PRIxLEAST8 "x"
|
||||
#define PRIXLEAST8 "X"
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIXFAST8 "X"
|
||||
|
||||
#define PRIo16 "ho"
|
||||
#define PRIu16 "hu"
|
||||
#define PRIx16 "hx"
|
||||
#define PRIX16 "hX"
|
||||
#define PRIoLEAST16 "ho"
|
||||
#define PRIuLEAST16 "hu"
|
||||
#define PRIxLEAST16 "hx"
|
||||
#define PRIXLEAST16 "hX"
|
||||
#define PRIoFAST16 "ho"
|
||||
#define PRIuFAST16 "hu"
|
||||
#define PRIxFAST16 "hx"
|
||||
#define PRIXFAST16 "hX"
|
||||
|
||||
#define PRIo32 "I32o"
|
||||
#define PRIu32 "I32u"
|
||||
#define PRIx32 "I32x"
|
||||
#define PRIX32 "I32X"
|
||||
#define PRIoLEAST32 "I32o"
|
||||
#define PRIuLEAST32 "I32u"
|
||||
#define PRIxLEAST32 "I32x"
|
||||
#define PRIXLEAST32 "I32X"
|
||||
#define PRIoFAST32 "I32o"
|
||||
#define PRIuFAST32 "I32u"
|
||||
#define PRIxFAST32 "I32x"
|
||||
#define PRIXFAST32 "I32X"
|
||||
|
||||
#define PRIo64 "I64o"
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIx64 "I64x"
|
||||
#define PRIX64 "I64X"
|
||||
#define PRIoLEAST64 "I64o"
|
||||
#define PRIuLEAST64 "I64u"
|
||||
#define PRIxLEAST64 "I64x"
|
||||
#define PRIXLEAST64 "I64X"
|
||||
#define PRIoFAST64 "I64o"
|
||||
#define PRIuFAST64 "I64u"
|
||||
#define PRIxFAST64 "I64x"
|
||||
#define PRIXFAST64 "I64X"
|
||||
|
||||
#define PRIoMAX "I64o"
|
||||
#define PRIuMAX "I64u"
|
||||
#define PRIxMAX "I64x"
|
||||
#define PRIXMAX "I64X"
|
||||
|
||||
#define PRIoPTR "Io"
|
||||
#define PRIuPTR "Iu"
|
||||
#define PRIxPTR "Ix"
|
||||
#define PRIXPTR "IX"
|
||||
|
||||
// The fscanf macros for signed integers are:
|
||||
#define SCNd8 "d"
|
||||
#define SCNi8 "i"
|
||||
#define SCNdLEAST8 "d"
|
||||
#define SCNiLEAST8 "i"
|
||||
#define SCNdFAST8 "d"
|
||||
#define SCNiFAST8 "i"
|
||||
|
||||
#define SCNd16 "hd"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNdFAST16 "hd"
|
||||
#define SCNiFAST16 "hi"
|
||||
|
||||
#define SCNd32 "ld"
|
||||
#define SCNi32 "li"
|
||||
#define SCNdLEAST32 "ld"
|
||||
#define SCNiLEAST32 "li"
|
||||
#define SCNdFAST32 "ld"
|
||||
#define SCNiFAST32 "li"
|
||||
|
||||
#define SCNd64 "I64d"
|
||||
#define SCNi64 "I64i"
|
||||
#define SCNdLEAST64 "I64d"
|
||||
#define SCNiLEAST64 "I64i"
|
||||
#define SCNdFAST64 "I64d"
|
||||
#define SCNiFAST64 "I64i"
|
||||
|
||||
#define SCNdMAX "I64d"
|
||||
#define SCNiMAX "I64i"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNdPTR "I64d"
|
||||
# define SCNiPTR "I64i"
|
||||
#else // _WIN64 ][
|
||||
# define SCNdPTR "ld"
|
||||
# define SCNiPTR "li"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// The fscanf macros for unsigned integers are:
|
||||
#define SCNo8 "o"
|
||||
#define SCNu8 "u"
|
||||
#define SCNx8 "x"
|
||||
#define SCNX8 "X"
|
||||
#define SCNoLEAST8 "o"
|
||||
#define SCNuLEAST8 "u"
|
||||
#define SCNxLEAST8 "x"
|
||||
#define SCNXLEAST8 "X"
|
||||
#define SCNoFAST8 "o"
|
||||
#define SCNuFAST8 "u"
|
||||
#define SCNxFAST8 "x"
|
||||
#define SCNXFAST8 "X"
|
||||
|
||||
#define SCNo16 "ho"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNX16 "hX"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNXLEAST16 "hX"
|
||||
#define SCNoFAST16 "ho"
|
||||
#define SCNuFAST16 "hu"
|
||||
#define SCNxFAST16 "hx"
|
||||
#define SCNXFAST16 "hX"
|
||||
|
||||
#define SCNo32 "lo"
|
||||
#define SCNu32 "lu"
|
||||
#define SCNx32 "lx"
|
||||
#define SCNX32 "lX"
|
||||
#define SCNoLEAST32 "lo"
|
||||
#define SCNuLEAST32 "lu"
|
||||
#define SCNxLEAST32 "lx"
|
||||
#define SCNXLEAST32 "lX"
|
||||
#define SCNoFAST32 "lo"
|
||||
#define SCNuFAST32 "lu"
|
||||
#define SCNxFAST32 "lx"
|
||||
#define SCNXFAST32 "lX"
|
||||
|
||||
#define SCNo64 "I64o"
|
||||
#define SCNu64 "I64u"
|
||||
#define SCNx64 "I64x"
|
||||
#define SCNX64 "I64X"
|
||||
#define SCNoLEAST64 "I64o"
|
||||
#define SCNuLEAST64 "I64u"
|
||||
#define SCNxLEAST64 "I64x"
|
||||
#define SCNXLEAST64 "I64X"
|
||||
#define SCNoFAST64 "I64o"
|
||||
#define SCNuFAST64 "I64u"
|
||||
#define SCNxFAST64 "I64x"
|
||||
#define SCNXFAST64 "I64X"
|
||||
|
||||
#define SCNoMAX "I64o"
|
||||
#define SCNuMAX "I64u"
|
||||
#define SCNxMAX "I64x"
|
||||
#define SCNXMAX "I64X"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNoPTR "I64o"
|
||||
# define SCNuPTR "I64u"
|
||||
# define SCNxPTR "I64x"
|
||||
# define SCNXPTR "I64X"
|
||||
#else // _WIN64 ][
|
||||
# define SCNoPTR "lo"
|
||||
# define SCNuPTR "lu"
|
||||
# define SCNxPTR "lx"
|
||||
# define SCNXPTR "lX"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#endif // __STDC_FORMAT_MACROS ]
|
||||
|
||||
// 7.8.2 Functions for greatest-width integer types
|
||||
|
||||
// 7.8.2.1 The imaxabs function
|
||||
#define imaxabs _abs64
|
||||
|
||||
// 7.8.2.2 The imaxdiv function
|
||||
|
||||
// This is modified version of div() function from Microsoft's div.c found
|
||||
// in %MSVC.NET%\crt\src\div.c
|
||||
#ifdef STATIC_IMAXDIV // [
|
||||
static
|
||||
#else // STATIC_IMAXDIV ][
|
||||
_inline
|
||||
#endif // STATIC_IMAXDIV ]
|
||||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
||||
{
|
||||
imaxdiv_t result;
|
||||
|
||||
result.quot = numer / denom;
|
||||
result.rem = numer % denom;
|
||||
|
||||
if (numer < 0 && result.rem > 0) {
|
||||
// did division wrong; must fix up
|
||||
++result.quot;
|
||||
result.rem -= denom;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 7.8.2.3 The strtoimax and strtoumax functions
|
||||
#define strtoimax _strtoi64
|
||||
#define strtoumax _strtoui64
|
||||
|
||||
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
||||
#define wcstoimax _wcstoi64
|
||||
#define wcstoumax _wcstoui64
|
||||
|
||||
|
||||
#endif // _MSC_INTTYPES_H_ ]
|
247
3rdparty/compiler/msvc/stdint.h
vendored
247
3rdparty/compiler/msvc/stdint.h
vendored
|
@ -1,247 +0,0 @@
|
|||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
1
3rdparty/compiler/nacl/memory.h
vendored
1
3rdparty/compiler/nacl/memory.h
vendored
|
@ -1 +0,0 @@
|
|||
#include <string.h>
|
54
examples/00-helloworld/helloworld.cpp
Normal file
54
examples/00-helloworld/helloworld.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <bgfx.h>
|
||||
#include <bx/bx.h>
|
||||
#include "../common/dbg.h"
|
||||
|
||||
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
|
||||
{
|
||||
DBG("%x: %s", _code, _str);
|
||||
}
|
||||
|
||||
int _main_(int _argc, char** _argv)
|
||||
{
|
||||
bgfx::init(BX_PLATFORM_WINDOWS, fatalCb);
|
||||
bgfx::reset(1280, 720);
|
||||
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, 1280, 720);
|
||||
|
||||
// Set view 0 clear state.
|
||||
bgfx::setViewClear(0
|
||||
, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT
|
||||
, 0x303030ff
|
||||
, 1.0f
|
||||
, 0
|
||||
);
|
||||
|
||||
while (true)
|
||||
{
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if not other draw calls are submitted to view 0.
|
||||
bgfx::submit(0);
|
||||
|
||||
// Use debug font to print information about this example.
|
||||
bgfx::dbgTextClear();
|
||||
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/00-helloworld");
|
||||
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Initialization and debug text.");
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
// process submitted rendering primitives.
|
||||
bgfx::frame();
|
||||
}
|
||||
|
||||
// Shutdown bgfx.
|
||||
bgfx::shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
6
examples/01-cubes/common.sh
Normal file
6
examples/01-cubes/common.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "../../src/common.sh"
|
244
examples/01-cubes/cubes.cpp
Normal file
244
examples/01-cubes/cubes.cpp
Normal file
|
@ -0,0 +1,244 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <bgfx.h>
|
||||
#include <bx/bx.h>
|
||||
#include <bx/timer.h>
|
||||
#include "../common/dbg.h"
|
||||
#include "../common/math.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
|
||||
{
|
||||
DBG("%x: %s", _code, _str);
|
||||
}
|
||||
|
||||
struct PosColorVertex
|
||||
{
|
||||
float m_x;
|
||||
float m_y;
|
||||
float m_z;
|
||||
uint32_t m_abgr;
|
||||
};
|
||||
|
||||
static PosColorVertex s_cubeVertices[8] =
|
||||
{
|
||||
{-1.0f, 1.0f, 1.0f, 0xff000000 },
|
||||
{ 1.0f, 1.0f, 1.0f, 0xff0000ff },
|
||||
{-1.0f, -1.0f, 1.0f, 0xff00ff00 },
|
||||
{ 1.0f, -1.0f, 1.0f, 0xff00ffff },
|
||||
{-1.0f, 1.0f, -1.0f, 0xffff0000 },
|
||||
{ 1.0f, 1.0f, -1.0f, 0xffff00ff },
|
||||
{-1.0f, -1.0f, -1.0f, 0xffffff00 },
|
||||
{ 1.0f, -1.0f, -1.0f, 0xffffffff },
|
||||
};
|
||||
|
||||
static const uint16_t s_cubeIndices[36] =
|
||||
{
|
||||
0, 2, 1, // 0
|
||||
1, 2, 3,
|
||||
4, 5, 6, // 2
|
||||
5, 7, 6,
|
||||
0, 4, 2, // 4
|
||||
4, 6, 2,
|
||||
1, 3, 5, // 6
|
||||
5, 3, 7,
|
||||
0, 1, 4, // 8
|
||||
4, 1, 5,
|
||||
2, 6, 3, // 10
|
||||
6, 7, 3,
|
||||
};
|
||||
|
||||
static const char* s_shaderPath = NULL;
|
||||
|
||||
static void shaderFilePath(char* _out, const char* _name)
|
||||
{
|
||||
strcpy(_out, s_shaderPath);
|
||||
strcat(_out, _name);
|
||||
strcat(_out, ".bin");
|
||||
}
|
||||
|
||||
long int fsize(FILE* _file)
|
||||
{
|
||||
long int pos = ftell(_file);
|
||||
fseek(_file, 0L, SEEK_END);
|
||||
long int size = ftell(_file);
|
||||
fseek(_file, pos, SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
|
||||
static const bgfx::Memory* load(const char* _filePath)
|
||||
{
|
||||
FILE* file = fopen(_filePath, "rb");
|
||||
if (NULL != file)
|
||||
{
|
||||
uint32_t size = (uint32_t)fsize(file);
|
||||
const bgfx::Memory* mem = bgfx::alloc(size+1);
|
||||
fread(mem->data, 1, size, file);
|
||||
fclose(file);
|
||||
mem->data[mem->size-1] = '\0';
|
||||
return mem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const bgfx::Memory* loadShader(const char* _name, const char* _default = NULL)
|
||||
{
|
||||
char filePath[_MAX_PATH];
|
||||
shaderFilePath(filePath, _name);
|
||||
BX_UNUSED(_default);
|
||||
return load(filePath);
|
||||
}
|
||||
|
||||
int _main_(int _argc, char** _argv)
|
||||
{
|
||||
bgfx::init(BX_PLATFORM_WINDOWS, fatalCb);
|
||||
bgfx::reset(1280, 720);
|
||||
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, 1280, 720);
|
||||
|
||||
// Set view 0 clear state.
|
||||
bgfx::setViewClear(0
|
||||
, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT
|
||||
, 0x303030ff
|
||||
, 1.0f
|
||||
, 0
|
||||
);
|
||||
|
||||
// Setup root path for binary shaders. Shader binaries are different
|
||||
// for each renderer.
|
||||
switch (bgfx::getRendererType() )
|
||||
{
|
||||
case bgfx::RendererType::Null:
|
||||
case bgfx::RendererType::Direct3D9:
|
||||
s_shaderPath = "shaders/dx9/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::Direct3D11:
|
||||
s_shaderPath = "shaders/dx11/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::OpenGL:
|
||||
s_shaderPath = "shaders/glsl/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::OpenGLES2:
|
||||
s_shaderPath = "shaders/gles/";
|
||||
break;
|
||||
}
|
||||
|
||||
// Create vertex stream declaration.
|
||||
bgfx::VertexDecl s_PosColorDecl;
|
||||
s_PosColorDecl.begin();
|
||||
s_PosColorDecl.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float);
|
||||
s_PosColorDecl.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true);
|
||||
s_PosColorDecl.end();
|
||||
|
||||
const bgfx::Memory* mem;
|
||||
|
||||
// Create static vertex buffer.
|
||||
mem = bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) );
|
||||
bgfx::VertexBufferHandle vbh = bgfx::createVertexBuffer(mem, s_PosColorDecl);
|
||||
|
||||
// Create static index buffer.
|
||||
mem = bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) );
|
||||
bgfx::IndexBufferHandle ibh = bgfx::createIndexBuffer(mem);
|
||||
|
||||
// Load vertex shader.
|
||||
mem = loadShader("vs_cubes");
|
||||
bgfx::VertexShaderHandle vsh = bgfx::createVertexShader(mem);
|
||||
|
||||
// Load fragment shader.
|
||||
mem = loadShader("fs_cubes");
|
||||
bgfx::FragmentShaderHandle fsh = bgfx::createFragmentShader(mem);
|
||||
|
||||
// Create program from shaders.
|
||||
bgfx::ProgramHandle program = bgfx::createProgram(vsh, fsh);
|
||||
|
||||
// We can destroy vertex and fragment shader here since
|
||||
// their reference is kept inside bgfx after calling createProgram.
|
||||
// Vertex and fragment shader will be destroyed once program is
|
||||
// destroyed.
|
||||
bgfx::destroyVertexShader(vsh);
|
||||
bgfx::destroyFragmentShader(fsh);
|
||||
|
||||
while (true)
|
||||
{
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if not other draw calls are submitted to view 0.
|
||||
bgfx::submit(0);
|
||||
|
||||
// Use debug font to print information about this example.
|
||||
bgfx::dbgTextClear();
|
||||
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/01-cube");
|
||||
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Rendering simple static mesh.");
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -35.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
||||
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
|
||||
|
||||
// Submit 10x10 cubes.
|
||||
for (uint32_t yy = 0; yy <= 10; ++yy)
|
||||
{
|
||||
for (uint32_t xx = 0; xx <= 10; ++xx)
|
||||
{
|
||||
float mtx[16];
|
||||
mtxRotateXY(mtx, time + xx*0.21f, time + yy*0.37f);
|
||||
mtx[12] = -15.0f + float(xx)*3.0f;
|
||||
mtx[13] = -15.0f + float(yy)*3.0f;
|
||||
mtx[14] = 0.0f;
|
||||
|
||||
// Set model matrix for rendering.
|
||||
bgfx::setTransform(mtx);
|
||||
|
||||
// Set vertex and fragment shaders.
|
||||
bgfx::setProgram(program);
|
||||
|
||||
// Set vertex and index buffer.
|
||||
bgfx::setVertexBuffer(vbh);
|
||||
bgfx::setIndexBuffer(ibh);
|
||||
|
||||
// Set render states.
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE
|
||||
|BGFX_STATE_DEPTH_WRITE
|
||||
|BGFX_STATE_DEPTH_TEST_LESS
|
||||
);
|
||||
|
||||
// Submit primitive for rendering to view 0.
|
||||
bgfx::submit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
// process submitted rendering primitives.
|
||||
bgfx::frame();
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
bgfx::destroyIndexBuffer(ibh);
|
||||
bgfx::destroyVertexBuffer(vbh);
|
||||
bgfx::destroyProgram(program);
|
||||
|
||||
// Shutdown bgfx.
|
||||
bgfx::shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
11
examples/01-cubes/fs_cubes.sc
Normal file
11
examples/01-cubes/fs_cubes.sc
Normal file
|
@ -0,0 +1,11 @@
|
|||
$input v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_color0;
|
||||
}
|
98
examples/01-cubes/makefile
Normal file
98
examples/01-cubes/makefile
Normal file
|
@ -0,0 +1,98 @@
|
|||
#
|
||||
# Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
#
|
||||
|
||||
ifndef TARGET
|
||||
.PHONY: all
|
||||
all:;@echo Usage: make TARGET=# [clean]
|
||||
@echo TARGET=0 (dx9)
|
||||
@echo TARGET=2 (dx11)
|
||||
@echo TARGET=3 (nacl)
|
||||
@echo TARGET=4 (android)
|
||||
@echo TARGET=5 (linux)
|
||||
else
|
||||
SHADERC="../../../../tools/bin/shaderc"
|
||||
|
||||
EXT=sc
|
||||
|
||||
ifeq ($(TARGET), 0)
|
||||
VS_FLAGS=--platform windows -p vs_2_0 -O 3
|
||||
FS_FLAGS=--platform windows -p ps_2_a -O 3
|
||||
SHADER_PATH=shaders/dx9
|
||||
else
|
||||
ifeq ($(TARGET), 1)
|
||||
VS_FLAGS=--platform windows -p vs_4_0 -O 3
|
||||
FS_FLAGS=--platform windows -p ps_4_0 -O 3
|
||||
SHADER_PATH=shaders/dx11
|
||||
else
|
||||
ifeq ($(TARGET), 2)
|
||||
VS_FLAGS=--platform nacl
|
||||
FS_FLAGS=--platform nacl
|
||||
SHADER_PATH=shaders/gles
|
||||
else
|
||||
ifeq ($(TARGET), 3)
|
||||
VS_FLAGS=--platform android
|
||||
FS_FLAGS=--platform android
|
||||
SHADER_PATH=shaders/gles
|
||||
else
|
||||
ifeq ($(TARGET), 4)
|
||||
VS_FLAGS=--platform linux -p 140
|
||||
FS_FLAGS=--platform linux -p 140
|
||||
SHADER_PATH=shaders/glsl
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_OUTPUT_DIR=$(addprefix ./, $(SHADER_PATH))
|
||||
BUILD_INTERMEDIATE_DIR=$(addprefix ../../.build/, $(SHADER_PATH))
|
||||
|
||||
VS_SOURCES=$(wildcard vs_*.$(EXT))
|
||||
VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES))))
|
||||
|
||||
FS_SOURCES=$(wildcard fs_*.$(EXT))
|
||||
FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES))))
|
||||
|
||||
CMD_MKDIR=cmd /C "if not exist "$(subst /,\,$(1))" mkdir "$(subst /,\,$(1))""
|
||||
CMD_RMDIR=cmd /C "if exist "$(subst /,\,$(1))" rmdir /S /Q "$(subst /,\,$(1))""
|
||||
|
||||
VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES))))
|
||||
FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES))))
|
||||
|
||||
BIN = $(VS_BIN) $(FS_BIN)
|
||||
ASM = $(VS_ASM) $(FS_ASM)
|
||||
|
||||
$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.$(EXT)
|
||||
@echo [$(<)]
|
||||
@$(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<)
|
||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||
|
||||
$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.$(EXT)
|
||||
@echo [$(<)]
|
||||
@$(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<)
|
||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||
|
||||
.PHONY: all
|
||||
all: dirs $(BIN)
|
||||
@echo Target $(SHADER_PATH)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo Cleaning...
|
||||
@-rm -vf $(BIN)
|
||||
@-$(call CMD_RMDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||
|
||||
.PHONY: dirs
|
||||
dirs:
|
||||
@-$(call CMD_MKDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||
@-$(call CMD_MKDIR,$(BUILD_OUTPUT_DIR))
|
||||
|
||||
.PHONY: rebuild
|
||||
rebuild: clean all
|
||||
|
||||
endif # TARGET
|
||||
|
||||
-include $(VS_DEPS)
|
||||
-include $(FS_DEPS)
|
BIN
examples/01-cubes/shaders/dx11/fs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/dx11/fs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/dx11/vs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/dx11/vs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/dx9/fs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/dx9/fs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/dx9/vs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/dx9/vs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/gles/fs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/gles/fs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/gles/vs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/gles/vs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/glsl/fs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/glsl/fs_cubes.bin
Normal file
Binary file not shown.
BIN
examples/01-cubes/shaders/glsl/vs_cubes.bin
Normal file
BIN
examples/01-cubes/shaders/glsl/vs_cubes.bin
Normal file
Binary file not shown.
4
examples/01-cubes/varying.def.sc
Normal file
4
examples/01-cubes/varying.def.sc
Normal file
|
@ -0,0 +1,4 @@
|
|||
vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
vec3 a_position : POSITION;
|
||||
vec4 a_color : COLOR0;
|
15
examples/01-cubes/vs_cubes.sc
Normal file
15
examples/01-cubes/vs_cubes.sc
Normal file
|
@ -0,0 +1,15 @@
|
|||
$input a_position, a_color
|
||||
$output v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
|
||||
v_color0 = a_color;
|
||||
}
|
6
examples/02-metaballs/common.sh
Normal file
6
examples/02-metaballs/common.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "../../src/common.sh"
|
14
examples/02-metaballs/fs_metaballs.sc
Normal file
14
examples/02-metaballs/fs_metaballs.sc
Normal file
|
@ -0,0 +1,14 @@
|
|||
$input v_normal, v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lightDir = vec3(0.0, 0.0, -1.0);
|
||||
float ndotl = max(dot(normalize(v_normal), lightDir), 0.0);
|
||||
float spec = pow(ndotl, 30.0);
|
||||
gl_FragColor = v_color0 * ndotl + spec;
|
||||
}
|
98
examples/02-metaballs/makefile
Normal file
98
examples/02-metaballs/makefile
Normal file
|
@ -0,0 +1,98 @@
|
|||
#
|
||||
# Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
#
|
||||
|
||||
ifndef TARGET
|
||||
.PHONY: all
|
||||
all:;@echo Usage: make TARGET=# [clean]
|
||||
@echo TARGET=0 (dx9)
|
||||
@echo TARGET=2 (dx11)
|
||||
@echo TARGET=3 (nacl)
|
||||
@echo TARGET=4 (android)
|
||||
@echo TARGET=5 (linux)
|
||||
else
|
||||
SHADERC="../../../../tools/bin/shaderc"
|
||||
|
||||
EXT=sc
|
||||
|
||||
ifeq ($(TARGET), 0)
|
||||
VS_FLAGS=--platform windows -p vs_2_0 -O 3
|
||||
FS_FLAGS=--platform windows -p ps_2_a -O 3
|
||||
SHADER_PATH=shaders/dx9
|
||||
else
|
||||
ifeq ($(TARGET), 1)
|
||||
VS_FLAGS=--platform windows -p vs_4_0 -O 3
|
||||
FS_FLAGS=--platform windows -p ps_4_0 -O 3
|
||||
SHADER_PATH=shaders/dx11
|
||||
else
|
||||
ifeq ($(TARGET), 2)
|
||||
VS_FLAGS=--platform nacl
|
||||
FS_FLAGS=--platform nacl
|
||||
SHADER_PATH=shaders/gles
|
||||
else
|
||||
ifeq ($(TARGET), 3)
|
||||
VS_FLAGS=--platform android
|
||||
FS_FLAGS=--platform android
|
||||
SHADER_PATH=shaders/gles
|
||||
else
|
||||
ifeq ($(TARGET), 4)
|
||||
VS_FLAGS=--platform linux -p 140
|
||||
FS_FLAGS=--platform linux -p 140
|
||||
SHADER_PATH=shaders/glsl
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
BUILD_OUTPUT_DIR=$(addprefix ./, $(SHADER_PATH))
|
||||
BUILD_INTERMEDIATE_DIR=$(addprefix ../../.build/, $(SHADER_PATH))
|
||||
|
||||
VS_SOURCES=$(wildcard vs_*.$(EXT))
|
||||
VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES))))
|
||||
|
||||
FS_SOURCES=$(wildcard fs_*.$(EXT))
|
||||
FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES))))
|
||||
|
||||
CMD_MKDIR=cmd /C "if not exist "$(subst /,\,$(1))" mkdir "$(subst /,\,$(1))""
|
||||
CMD_RMDIR=cmd /C "if exist "$(subst /,\,$(1))" rmdir /S /Q "$(subst /,\,$(1))""
|
||||
|
||||
VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES))))
|
||||
FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES))))
|
||||
|
||||
BIN = $(VS_BIN) $(FS_BIN)
|
||||
ASM = $(VS_ASM) $(FS_ASM)
|
||||
|
||||
$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.$(EXT)
|
||||
@echo [$(<)]
|
||||
@$(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<)
|
||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||
|
||||
$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.$(EXT)
|
||||
@echo [$(<)]
|
||||
@$(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<)
|
||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||
|
||||
.PHONY: all
|
||||
all: dirs $(BIN)
|
||||
@echo Target $(SHADER_PATH)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo Cleaning...
|
||||
@-rm -vf $(BIN)
|
||||
@-$(call CMD_RMDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||
|
||||
.PHONY: dirs
|
||||
dirs:
|
||||
@-$(call CMD_MKDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||
@-$(call CMD_MKDIR,$(BUILD_OUTPUT_DIR))
|
||||
|
||||
.PHONY: rebuild
|
||||
rebuild: clean all
|
||||
|
||||
endif # TARGET
|
||||
|
||||
-include $(VS_DEPS)
|
||||
-include $(FS_DEPS)
|
785
examples/02-metaballs/metaballs.cpp
Normal file
785
examples/02-metaballs/metaballs.cpp
Normal file
|
@ -0,0 +1,785 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <bgfx.h>
|
||||
#include <bx/bx.h>
|
||||
#include <bx/timer.h>
|
||||
#include "../common/dbg.h"
|
||||
#include "../common/math.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
bgfx::VertexDecl s_PosNormalColorDecl;
|
||||
|
||||
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
|
||||
{
|
||||
DBG("%x: %s", _code, _str);
|
||||
}
|
||||
|
||||
struct PosNormalColorVertex
|
||||
{
|
||||
float m_pos[3];
|
||||
float m_normal[3];
|
||||
uint32_t m_abgr;
|
||||
};
|
||||
|
||||
struct Grid
|
||||
{
|
||||
Grid()
|
||||
: m_val(0.0f)
|
||||
{
|
||||
m_normal[0] = 0.0f;
|
||||
m_normal[1] = 0.0f;
|
||||
m_normal[2] = 0.0f;
|
||||
}
|
||||
|
||||
float m_val;
|
||||
float m_normal[3];
|
||||
};
|
||||
|
||||
static const char* s_shaderPath = NULL;
|
||||
|
||||
static void shaderFilePath(char* _out, const char* _name)
|
||||
{
|
||||
strcpy(_out, s_shaderPath);
|
||||
strcat(_out, _name);
|
||||
strcat(_out, ".bin");
|
||||
}
|
||||
|
||||
long int fsize(FILE* _file)
|
||||
{
|
||||
long int pos = ftell(_file);
|
||||
fseek(_file, 0L, SEEK_END);
|
||||
long int size = ftell(_file);
|
||||
fseek(_file, pos, SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
|
||||
static const bgfx::Memory* load(const char* _filePath)
|
||||
{
|
||||
FILE* file = fopen(_filePath, "rb");
|
||||
if (NULL != file)
|
||||
{
|
||||
uint32_t size = (uint32_t)fsize(file);
|
||||
const bgfx::Memory* mem = bgfx::alloc(size+1);
|
||||
fread(mem->data, 1, size, file);
|
||||
fclose(file);
|
||||
mem->data[mem->size-1] = '\0';
|
||||
return mem;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const bgfx::Memory* loadShader(const char* _name, const char* _default = NULL)
|
||||
{
|
||||
char filePath[_MAX_PATH];
|
||||
shaderFilePath(filePath, _name);
|
||||
BX_UNUSED(_default);
|
||||
return load(filePath);
|
||||
}
|
||||
|
||||
// Triangulation tables taken from:
|
||||
// http://paulbourke.net/geometry/polygonise/
|
||||
|
||||
static const uint16_t s_edges[256] =
|
||||
{
|
||||
0x000, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
|
||||
0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
|
||||
0x190, 0x099, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
|
||||
0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
|
||||
0x230, 0x339, 0x033, 0x13a, 0x636, 0x73f, 0x435, 0x53c,
|
||||
0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
|
||||
0x3a0, 0x2a9, 0x1a3, 0x0aa, 0x7a6, 0x6af, 0x5a5, 0x4ac,
|
||||
0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
|
||||
0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
|
||||
0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
|
||||
0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0x0ff, 0x3f5, 0x2fc,
|
||||
0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
|
||||
0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x055, 0x15c,
|
||||
0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
|
||||
0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0x0cc,
|
||||
0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
|
||||
0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
|
||||
0x0cc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
|
||||
0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
|
||||
0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
|
||||
0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
|
||||
0x2fc, 0x3f5, 0x0ff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
|
||||
0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
|
||||
0x36c, 0x265, 0x16f, 0x066, 0x76a, 0x663, 0x569, 0x460,
|
||||
0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
|
||||
0x4ac, 0x5a5, 0x6af, 0x7a6, 0x0aa, 0x1a3, 0x2a9, 0x3a0,
|
||||
0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
|
||||
0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x033, 0x339, 0x230,
|
||||
0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
|
||||
0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x099, 0x190,
|
||||
0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
|
||||
0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x000,
|
||||
};
|
||||
|
||||
static const int8_t s_indices[256][16] =
|
||||
{
|
||||
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1 },
|
||||
{ 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1 },
|
||||
{ 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1 },
|
||||
{ 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1 },
|
||||
{ 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1 },
|
||||
{ 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1 },
|
||||
{ 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1 },
|
||||
{ 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1 },
|
||||
{ 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1 },
|
||||
{ 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1 },
|
||||
{ 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1 },
|
||||
{ 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1 },
|
||||
{ 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1 },
|
||||
{ 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1 },
|
||||
{ 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1 },
|
||||
{ 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1 },
|
||||
{ 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1 },
|
||||
{ 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1 },
|
||||
{ 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1 },
|
||||
{ 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1 },
|
||||
{ 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1 },
|
||||
{ 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1 },
|
||||
{ 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1 },
|
||||
{ 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1 },
|
||||
{ 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1 },
|
||||
{ 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1 },
|
||||
{ 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1 },
|
||||
{ 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1 },
|
||||
{ 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1 },
|
||||
{ 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1 },
|
||||
{ 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1 },
|
||||
{ 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1 },
|
||||
{ 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1 },
|
||||
{ 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1 },
|
||||
{ 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1 },
|
||||
{ 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1 },
|
||||
{ 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1 },
|
||||
{ 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1 },
|
||||
{ 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1 },
|
||||
{ 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1 },
|
||||
{ 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1 },
|
||||
{ 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1 },
|
||||
{ 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1 },
|
||||
{ 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1 },
|
||||
{ 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1 },
|
||||
{ 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1 },
|
||||
{ 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1 },
|
||||
{ 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1 },
|
||||
{ 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1 },
|
||||
{ 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1 },
|
||||
{ 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1 },
|
||||
{ 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1 },
|
||||
{ 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1 },
|
||||
{ 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1 },
|
||||
{ 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1 },
|
||||
{ 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1 },
|
||||
{ 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1 },
|
||||
{ 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1 },
|
||||
{ 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1 },
|
||||
{ 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1 },
|
||||
{ 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1 },
|
||||
{ 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1 },
|
||||
{ 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1 },
|
||||
{ 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1 },
|
||||
{ 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1 },
|
||||
{ 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1 },
|
||||
{ 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1 },
|
||||
{ 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1 },
|
||||
{ 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1 },
|
||||
{ 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1 },
|
||||
{ 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1 },
|
||||
{ 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1 },
|
||||
{ 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1 },
|
||||
{ 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1 },
|
||||
{ 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1 },
|
||||
{ 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1 },
|
||||
{ 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1 },
|
||||
{ 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1 },
|
||||
{ 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1 },
|
||||
{ 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1 },
|
||||
{ 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1 },
|
||||
{ 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1 },
|
||||
{ 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1 },
|
||||
{ 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1 },
|
||||
{ 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1 },
|
||||
{ 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1 },
|
||||
{ 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1 },
|
||||
{ 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1 },
|
||||
{ 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1 },
|
||||
{ 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1 },
|
||||
{ 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1 },
|
||||
{ 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1 },
|
||||
{ 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1 },
|
||||
{ 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1 },
|
||||
{ 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1 },
|
||||
{ 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1 },
|
||||
{ 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1 },
|
||||
{ 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1 },
|
||||
{ 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1 },
|
||||
{ 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1 },
|
||||
{ 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1 },
|
||||
{ 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1 },
|
||||
{ 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1 },
|
||||
{ 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1 },
|
||||
{ 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1 },
|
||||
{ 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1 },
|
||||
{ 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1 },
|
||||
{ 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
|
||||
};
|
||||
|
||||
static const float s_cube[8][3] =
|
||||
{
|
||||
{ 0.0f, 1.0f, 1.0f }, // 0
|
||||
{ 1.0f, 1.0f, 1.0f }, // 1
|
||||
{ 1.0f, 1.0f, 0.0f }, // 2
|
||||
{ 0.0f, 1.0f, 0.0f }, // 3
|
||||
{ 0.0f, 0.0f, 1.0f }, // 4
|
||||
{ 1.0f, 0.0f, 1.0f }, // 5
|
||||
{ 1.0f, 0.0f, 0.0f }, // 6
|
||||
{ 0.0f, 0.0f, 0.0f }, // 7
|
||||
};
|
||||
|
||||
float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, uint32_t _idx1, float _v1)
|
||||
{
|
||||
const float* __restrict edge0 = s_cube[_idx0];
|
||||
const float* __restrict edge1 = s_cube[_idx1];
|
||||
|
||||
if (fabsf(_iso-_v1) < 0.00001f)
|
||||
{
|
||||
_result[0] = edge1[0];
|
||||
_result[1] = edge1[1];
|
||||
_result[2] = edge1[2];
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
if (fabsf(_iso-_v0) < 0.00001f
|
||||
|| fabsf(_v0-_v1) < 0.00001f)
|
||||
{
|
||||
_result[0] = edge0[0];
|
||||
_result[1] = edge0[1];
|
||||
_result[2] = edge0[2];
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float lerp = (_iso - _v0) / (_v1 - _v0);
|
||||
_result[0] = edge0[0] + lerp * (edge1[0] - edge0[0]);
|
||||
_result[1] = edge0[1] + lerp * (edge1[1] - edge0[1]);
|
||||
_result[2] = edge0[2] + lerp * (edge1[2] - edge0[2]);
|
||||
|
||||
return lerp;
|
||||
}
|
||||
|
||||
uint32_t triangulate(uint8_t* _result, uint32_t _stride, const float* __restrict _rgb, const float* __restrict _xyz, const Grid* _val[8], float _iso)
|
||||
{
|
||||
uint8_t cubeindex = 0;
|
||||
cubeindex |= (_val[0]->m_val < _iso) ? 0x01 : 0;
|
||||
cubeindex |= (_val[1]->m_val < _iso) ? 0x02 : 0;
|
||||
cubeindex |= (_val[2]->m_val < _iso) ? 0x04 : 0;
|
||||
cubeindex |= (_val[3]->m_val < _iso) ? 0x08 : 0;
|
||||
cubeindex |= (_val[4]->m_val < _iso) ? 0x10 : 0;
|
||||
cubeindex |= (_val[5]->m_val < _iso) ? 0x20 : 0;
|
||||
cubeindex |= (_val[6]->m_val < _iso) ? 0x40 : 0;
|
||||
cubeindex |= (_val[7]->m_val < _iso) ? 0x80 : 0;
|
||||
|
||||
if (0 == s_edges[cubeindex])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float verts[12][6];
|
||||
uint16_t flags = s_edges[cubeindex];
|
||||
|
||||
for (uint32_t ii = 0; ii < 12; ++ii)
|
||||
{
|
||||
if (flags & (1<<ii) )
|
||||
{
|
||||
uint32_t idx0 = ii&7;
|
||||
uint32_t idx1 = "\x1\x2\x3\x0\x5\x6\x7\x4\x4\x5\x6\x7"[ii];
|
||||
float* vertex = verts[ii];
|
||||
float lerp = vertLerp(vertex, _iso, idx0, _val[idx0]->m_val, idx1, _val[idx1]->m_val);
|
||||
|
||||
const float* na = _val[idx0]->m_normal;
|
||||
const float* nb = _val[idx1]->m_normal;
|
||||
vertex[3] = na[0] + lerp * (nb[0] - na[0]);
|
||||
vertex[4] = na[1] + lerp * (nb[1] - na[1]);
|
||||
vertex[5] = na[2] + lerp * (nb[2] - na[2]);
|
||||
}
|
||||
}
|
||||
|
||||
float dr = _rgb[3] - _rgb[0];
|
||||
float dg = _rgb[4] - _rgb[1];
|
||||
float db = _rgb[5] - _rgb[2];
|
||||
|
||||
uint32_t num = 0;
|
||||
const int8_t* indices = s_indices[cubeindex];
|
||||
for (uint32_t ii = 0; indices[ii] != -1; ++ii)
|
||||
{
|
||||
const float* vertex = verts[indices[ii] ];
|
||||
|
||||
float* xyz = (float*)_result;
|
||||
xyz[0] = _xyz[0] + vertex[0];
|
||||
xyz[1] = _xyz[1] + vertex[1];
|
||||
xyz[2] = _xyz[2] + vertex[2];
|
||||
|
||||
xyz[3] = vertex[3];
|
||||
xyz[4] = vertex[4];
|
||||
xyz[5] = vertex[5];
|
||||
|
||||
uint32_t rr = uint8_t( (_rgb[0] + vertex[0]*dr)*255.0f);
|
||||
uint32_t gg = uint8_t( (_rgb[1] + vertex[1]*dg)*255.0f);
|
||||
uint32_t bb = uint8_t( (_rgb[2] + vertex[2]*db)*255.0f);
|
||||
|
||||
uint32_t* abgr = (uint32_t*)&_result[24];
|
||||
*abgr = 0xff000000
|
||||
| (bb<<16)
|
||||
| (gg<<8)
|
||||
| rr
|
||||
;
|
||||
|
||||
_result += _stride;
|
||||
++num;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
int _main_(int _argc, char** _argv)
|
||||
{
|
||||
bgfx::init(BX_PLATFORM_WINDOWS, fatalCb);
|
||||
bgfx::reset(1280, 720);
|
||||
|
||||
// Enable debug text.
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
||||
|
||||
// Set view 0 default viewport.
|
||||
bgfx::setViewRect(0, 0, 0, 1280, 720);
|
||||
|
||||
// Set view 0 clear state.
|
||||
bgfx::setViewClear(0
|
||||
, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT
|
||||
, 0x303030ff
|
||||
, 1.0f
|
||||
, 0
|
||||
);
|
||||
|
||||
// Setup root path for binary shaders. Shader binaries are different
|
||||
// for each renderer.
|
||||
switch (bgfx::getRendererType() )
|
||||
{
|
||||
case bgfx::RendererType::Null:
|
||||
case bgfx::RendererType::Direct3D9:
|
||||
s_shaderPath = "shaders/dx9/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::Direct3D11:
|
||||
s_shaderPath = "shaders/dx11/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::OpenGL:
|
||||
s_shaderPath = "shaders/glsl/";
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::OpenGLES2:
|
||||
s_shaderPath = "shaders/gles/";
|
||||
break;
|
||||
}
|
||||
|
||||
// Create vertex stream declaration.
|
||||
s_PosNormalColorDecl.begin();
|
||||
s_PosNormalColorDecl.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float);
|
||||
s_PosNormalColorDecl.add(bgfx::Attrib::Normal, 3, bgfx::AttribType::Float);
|
||||
s_PosNormalColorDecl.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true);
|
||||
s_PosNormalColorDecl.end();
|
||||
|
||||
const bgfx::Memory* mem;
|
||||
|
||||
// Load vertex shader.
|
||||
mem = loadShader("vs_metaballs");
|
||||
bgfx::VertexShaderHandle vsh = bgfx::createVertexShader(mem);
|
||||
|
||||
// Load fragment shader.
|
||||
mem = loadShader("fs_metaballs");
|
||||
bgfx::FragmentShaderHandle fsh = bgfx::createFragmentShader(mem);
|
||||
|
||||
// Create program from shaders.
|
||||
bgfx::ProgramHandle program = bgfx::createProgram(vsh, fsh);
|
||||
|
||||
// We can destroy vertex and fragment shader here since
|
||||
// their reference is kept inside bgfx after calling createProgram.
|
||||
// Vertex and fragment shader will be destroyed once program is
|
||||
// destroyed.
|
||||
bgfx::destroyVertexShader(vsh);
|
||||
bgfx::destroyFragmentShader(fsh);
|
||||
|
||||
#define DIMS 32
|
||||
|
||||
Grid* grid = new Grid[DIMS*DIMS*DIMS];
|
||||
const uint32_t ypitch = DIMS;
|
||||
const uint32_t zpitch = DIMS*DIMS;
|
||||
const float invdim = 1.0f/float(DIMS-1);
|
||||
|
||||
while (true)
|
||||
{
|
||||
// This dummy draw call is here to make sure that view 0 is cleared
|
||||
// if not other draw calls are submitted to view 0.
|
||||
bgfx::submit(0);
|
||||
|
||||
int64_t now = bx::getHPCounter();
|
||||
static int64_t last = now;
|
||||
const int64_t frameTime = now - last;
|
||||
last = now;
|
||||
const double freq = double(bx::getHPFrequency() );
|
||||
const double toMs = 1000.0/freq;
|
||||
|
||||
// Use debug font to print information about this example.
|
||||
bgfx::dbgTextClear();
|
||||
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/02-metaball");
|
||||
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Rendering with transient buffers.");
|
||||
|
||||
float at[3] = { 0.0f, 0.0f, 0.0f };
|
||||
float eye[3] = { 0.0f, 0.0f, -50.0f };
|
||||
|
||||
float view[16];
|
||||
float proj[16];
|
||||
mtxLookAt(view, eye, at);
|
||||
mtxProj(proj, 60.0f, 16.0f/9.0f, 0.1f, 100.0f);
|
||||
|
||||
// Set view and projection matrix for view 0.
|
||||
bgfx::setViewTransform(0, view, proj);
|
||||
|
||||
float time = (float)(bx::getHPCounter()/double(bx::getHPFrequency() ) );
|
||||
|
||||
// Stats.
|
||||
uint32_t numVertices = 0;
|
||||
int64_t profUpdate;
|
||||
int64_t profNormal;
|
||||
int64_t profTriangulate;
|
||||
|
||||
// Allocate 32K vertices in transient vertex buffer.
|
||||
uint32_t maxVertices = (32<<10);
|
||||
const bgfx::TransientVertexBuffer* tvb = bgfx::allocTransientVertexBuffer(maxVertices, s_PosNormalColorDecl);
|
||||
|
||||
// If there is no enough space in transient vertex buffer alloc will return NULL.
|
||||
if (NULL != tvb)
|
||||
{
|
||||
const uint32_t numSpheres = 16;
|
||||
float sphere[numSpheres][4];
|
||||
for (uint32_t ii = 0; ii < numSpheres; ++ii)
|
||||
{
|
||||
sphere[ii][0] = sin(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f);
|
||||
sphere[ii][1] = sin(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f);
|
||||
sphere[ii][2] = cos(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f);
|
||||
sphere[ii][3] = 1.0f/(2.0f + (sin(time*(ii*0.13f) )*0.5f+0.5f)*2.0f);
|
||||
}
|
||||
|
||||
profUpdate = bx::getHPCounter();
|
||||
|
||||
for (uint32_t zz = 0; zz < DIMS; ++zz)
|
||||
{
|
||||
for (uint32_t yy = 0; yy < DIMS; ++yy)
|
||||
{
|
||||
uint32_t offset = (zz*DIMS+yy)*DIMS;
|
||||
|
||||
for (uint32_t xx = 0; xx < DIMS; ++xx)
|
||||
{
|
||||
uint32_t xoffset = offset + xx;
|
||||
|
||||
float dist = 0.0f;
|
||||
float prod = 1.0f;
|
||||
for (uint32_t ii = 0; ii < numSpheres; ++ii)
|
||||
{
|
||||
const float* pos = sphere[ii];
|
||||
float dx = pos[0] - (-DIMS*0.5f + float(xx) );
|
||||
float dy = pos[1] - (-DIMS*0.5f + float(yy) );
|
||||
float dz = pos[2] - (-DIMS*0.5f + float(zz) );
|
||||
float invr = pos[3];
|
||||
float dot = dx*dx + dy*dy + dz*dz;
|
||||
dot *= invr*invr;
|
||||
|
||||
dist *= dot;
|
||||
dist += prod;
|
||||
prod *= dot;
|
||||
}
|
||||
|
||||
grid[xoffset].m_val = dist / prod - 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
profUpdate = bx::getHPCounter() - profUpdate;
|
||||
|
||||
profNormal = bx::getHPCounter();
|
||||
|
||||
for (uint32_t zz = 1; zz < DIMS-1; ++zz)
|
||||
{
|
||||
for (uint32_t yy = 1; yy < DIMS-1; ++yy)
|
||||
{
|
||||
uint32_t offset = (zz*DIMS+yy)*DIMS;
|
||||
|
||||
for (uint32_t xx = 1; xx < DIMS-1; ++xx)
|
||||
{
|
||||
uint32_t xoffset = offset + xx;
|
||||
|
||||
float normal[3] =
|
||||
{
|
||||
grid[xoffset-1 ].m_val - grid[xoffset+1 ].m_val,
|
||||
grid[xoffset-ypitch].m_val - grid[xoffset+ypitch].m_val,
|
||||
grid[xoffset-zpitch].m_val - grid[xoffset+zpitch].m_val,
|
||||
};
|
||||
|
||||
vec3Norm(grid[xoffset].m_normal, normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
profNormal = bx::getHPCounter() - profNormal;
|
||||
|
||||
profTriangulate = bx::getHPCounter();
|
||||
|
||||
PosNormalColorVertex* vertex = (PosNormalColorVertex*)tvb->data;
|
||||
|
||||
for (uint32_t zz = 0; zz < DIMS-1 && numVertices+12 < maxVertices; ++zz)
|
||||
{
|
||||
float rgb[6];
|
||||
rgb[2] = zz*invdim;
|
||||
rgb[5] = (zz+1)*invdim;
|
||||
|
||||
for (uint32_t yy = 0; yy < DIMS-1 && numVertices+12 < maxVertices; ++yy)
|
||||
{
|
||||
uint32_t offset = (zz*DIMS+yy)*DIMS;
|
||||
|
||||
rgb[1] = yy*invdim;
|
||||
rgb[4] = (yy+1)*invdim;
|
||||
|
||||
for (uint32_t xx = 0; xx < DIMS-1 && numVertices+12 < maxVertices; ++xx)
|
||||
{
|
||||
uint32_t xoffset = offset + xx;
|
||||
|
||||
rgb[0] = xx*invdim;
|
||||
rgb[3] = (xx+1)*invdim;
|
||||
|
||||
float pos[3] =
|
||||
{
|
||||
-DIMS*0.5f + float(xx),
|
||||
-DIMS*0.5f + float(yy),
|
||||
-DIMS*0.5f + float(zz)
|
||||
};
|
||||
|
||||
const Grid* val[8] = {
|
||||
&grid[xoffset+zpitch+ypitch ],
|
||||
&grid[xoffset+zpitch+ypitch+1],
|
||||
&grid[xoffset+ypitch+1 ],
|
||||
&grid[xoffset+ypitch ],
|
||||
&grid[xoffset+zpitch ],
|
||||
&grid[xoffset+zpitch+1 ],
|
||||
&grid[xoffset+1 ],
|
||||
&grid[xoffset ],
|
||||
};
|
||||
|
||||
uint32_t num = triangulate( (uint8_t*)vertex, s_PosNormalColorDecl.m_stride, rgb, pos, val, 0.5f);
|
||||
vertex += num;
|
||||
numVertices += num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
profTriangulate = bx::getHPCounter() - profTriangulate;
|
||||
|
||||
float mtx[16];
|
||||
mtxRotateXY(mtx, time*0.67f, time);
|
||||
|
||||
// Set model matrix for rendering.
|
||||
bgfx::setTransform(mtx);
|
||||
|
||||
// Set vertex and fragment shaders.
|
||||
bgfx::setProgram(program);
|
||||
|
||||
// Set vertex and index buffer.
|
||||
bgfx::setVertexBuffer(tvb, numVertices);
|
||||
|
||||
// Set render states.
|
||||
bgfx::setState(BGFX_STATE_RGB_WRITE
|
||||
|BGFX_STATE_DEPTH_WRITE
|
||||
|BGFX_STATE_DEPTH_TEST_LESS
|
||||
);
|
||||
|
||||
// Submit primitive for rendering to view 0.
|
||||
bgfx::submit(0);
|
||||
}
|
||||
|
||||
// Display stats.
|
||||
bgfx::dbgTextPrintf(1, 4, 0x0f, "Num vertices: %5d (%6.4f%%)", numVertices, float(numVertices)/maxVertices * 100);
|
||||
bgfx::dbgTextPrintf(1, 5, 0x0f, " Update: % 7.3f[ms]", double(profUpdate)*toMs);
|
||||
bgfx::dbgTextPrintf(1, 6, 0x0f, "Calc normals: % 7.3f[ms]", double(profNormal)*toMs);
|
||||
bgfx::dbgTextPrintf(1, 7, 0x0f, " Triangulate: % 7.3f[ms]", double(profTriangulate)*toMs);
|
||||
bgfx::dbgTextPrintf(1, 8, 0x0f, " Frame: % 7.3f[ms]", double(frameTime)*toMs);
|
||||
|
||||
// Advance to next frame. Rendering thread will be kicked to
|
||||
// process submitted rendering primitives.
|
||||
bgfx::frame();
|
||||
}
|
||||
|
||||
delete [] grid;
|
||||
|
||||
// Cleanup.
|
||||
bgfx::destroyProgram(program);
|
||||
|
||||
// Shutdown bgfx.
|
||||
bgfx::shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
BIN
examples/02-metaballs/shaders/dx11/fs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/dx11/fs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/dx11/vs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/dx11/vs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/dx9/fs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/dx9/fs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/dx9/vs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/dx9/vs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/gles/fs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/gles/fs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/gles/vs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/gles/vs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/glsl/fs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/glsl/fs_metaballs.bin
Normal file
Binary file not shown.
BIN
examples/02-metaballs/shaders/glsl/vs_metaballs.bin
Normal file
BIN
examples/02-metaballs/shaders/glsl/vs_metaballs.bin
Normal file
Binary file not shown.
6
examples/02-metaballs/varying.def.sc
Normal file
6
examples/02-metaballs/varying.def.sc
Normal file
|
@ -0,0 +1,6 @@
|
|||
vec3 v_normal : TEXCOORD1 = vec3(0.0, 0.0, 1.0);
|
||||
vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
vec3 a_position : POSITION;
|
||||
vec3 a_normal : NORMAL;
|
||||
vec4 a_color : COLOR0;
|
16
examples/02-metaballs/vs_metaballs.sc
Normal file
16
examples/02-metaballs/vs_metaballs.sc
Normal file
|
@ -0,0 +1,16 @@
|
|||
$input a_position, a_normal, a_color
|
||||
$output v_normal, v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
|
||||
v_normal = mul(u_model, vec4(a_normal, 0.0) ).xyz;
|
||||
v_color0 = a_color;
|
||||
}
|
128
examples/common/math.h
Normal file
128
examples/common/math.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef __MATH_H__
|
||||
#define __MATH_H__
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
inline void vec3Add(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
{
|
||||
_result[0] = _a[0] + _b[0];
|
||||
_result[1] = _a[1] + _b[1];
|
||||
_result[2] = _a[2] + _b[2];
|
||||
}
|
||||
|
||||
inline void vec3Sub(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
{
|
||||
_result[0] = _a[0] - _b[0];
|
||||
_result[1] = _a[1] - _b[1];
|
||||
_result[2] = _a[2] - _b[2];
|
||||
}
|
||||
|
||||
inline void vec3Mul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
{
|
||||
_result[0] = _a[0] * _b[0];
|
||||
_result[1] = _a[1] * _b[1];
|
||||
_result[2] = _a[2] * _b[2];
|
||||
}
|
||||
|
||||
inline float vec3Dot(const float* __restrict _a, const float* __restrict _b)
|
||||
{
|
||||
return _a[0]*_b[0] + _a[1]*_b[1] + _a[2]*_b[2];
|
||||
}
|
||||
|
||||
inline void vec3Cross(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
|
||||
{
|
||||
_result[0] = _a[1]*_b[2] - _a[2]*_b[1];
|
||||
_result[1] = _a[2]*_b[0] - _a[0]*_b[2];
|
||||
_result[2] = _a[0]*_b[1] - _a[1]*_b[0];
|
||||
}
|
||||
|
||||
inline void vec3Norm(float* __restrict _result, const float* __restrict _a)
|
||||
{
|
||||
float scale = 1.0f/sqrtf(vec3Dot(_a, _a) );
|
||||
_result[0] = _a[0] * scale;
|
||||
_result[1] = _a[1] * scale;
|
||||
_result[2] = _a[2] * scale;
|
||||
}
|
||||
|
||||
inline void mtxIdentity(float* _result)
|
||||
{
|
||||
memset(_result, 0, sizeof(float)*16);
|
||||
_result[0] = _result[5] = _result[10] = _result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at)
|
||||
{
|
||||
float tmp[4];
|
||||
vec3Sub(tmp, _at, _eye);
|
||||
|
||||
float view[4];
|
||||
vec3Norm(view, tmp);
|
||||
|
||||
float up[3] = { 0.0f, 1.0f, 0.0f };
|
||||
vec3Cross(tmp, up, view);
|
||||
|
||||
float right[4];
|
||||
vec3Norm(right, tmp);
|
||||
|
||||
vec3Cross(up, view, right);
|
||||
|
||||
memset(_result, 0, sizeof(float)*16);
|
||||
_result[ 0] = right[0];
|
||||
_result[ 1] = up[0];
|
||||
_result[ 2] = view[0];
|
||||
|
||||
_result[ 4] = right[1];
|
||||
_result[ 5] = up[1];
|
||||
_result[ 6] = view[1];
|
||||
|
||||
_result[ 8] = right[2];
|
||||
_result[ 9] = up[2];
|
||||
_result[10] = view[2];
|
||||
|
||||
_result[12] = -vec3Dot(right, _eye);
|
||||
_result[13] = -vec3Dot(up, _eye);
|
||||
_result[14] = -vec3Dot(view, _eye);
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far)
|
||||
{
|
||||
float height = 1.0f/tanf(_fovy*( (float)M_PI/180.0f)*0.5f);
|
||||
float width = height * 1.0f/_aspect;
|
||||
float aa = _far/(_far-_near);
|
||||
float bb = -_near * aa;
|
||||
|
||||
memset(_result, 0, sizeof(float)*16);
|
||||
_result[0] = width;
|
||||
_result[5] = height;
|
||||
_result[10] = aa;
|
||||
_result[11] = 1.0f;
|
||||
_result[14] = bb;
|
||||
}
|
||||
|
||||
void mtxRotateXY(float* _result, float _ax, float _ay)
|
||||
{
|
||||
float sinx = sinf(_ax);
|
||||
float cosx = cosf(_ax);
|
||||
float siny = sinf(_ay);
|
||||
float cosy = cosf(_ay);
|
||||
|
||||
memset(_result, 0, sizeof(float)*16);
|
||||
_result[ 0] = cosy;
|
||||
_result[ 2] = -siny;
|
||||
_result[ 4] = -sinx * siny;
|
||||
_result[ 5] = cosx;
|
||||
_result[ 6] = -sinx * cosy;
|
||||
_result[ 8] = cosx * siny;
|
||||
_result[ 9] = sinx;
|
||||
_result[10] = cosx * cosy;
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
#endif // __MATH_H__
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <bgfx.h>
|
||||
#include <bx/bx.h>
|
||||
#include "../common/dbg.h"
|
||||
|
||||
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
|
||||
{
|
||||
DBG("%x: %s", _code, _str);
|
||||
}
|
||||
|
||||
int _main_(int _argc, char** _argv)
|
||||
{
|
||||
bgfx::init(BX_PLATFORM_WINDOWS, fatalCb);
|
||||
bgfx::reset(1280, 720);
|
||||
|
||||
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
||||
|
||||
bgfx::setViewRect(0, 0, 0, 1280, 720);
|
||||
bgfx::setViewClear(0, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT, 0x000000ff, 0.0f, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
bgfx::submit(0);
|
||||
|
||||
bgfx::dbgTextClear();
|
||||
bgfx::dbgTextPrintf(0, 1, 0x4f, "BGFX: Hello, World!");
|
||||
|
||||
bgfx::dbgTextPrintf(0, 2, 0x6f, "Initialization and debug text.");
|
||||
|
||||
bgfx::frame();
|
||||
}
|
||||
|
||||
bgfx::shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -240,7 +240,7 @@ namespace bgfx
|
|||
typedef struct { uint16_t idx; } DynamicVertexBufferHandle;
|
||||
typedef struct { uint16_t idx; } FragmentShaderHandle;
|
||||
typedef struct { uint16_t idx; } IndexBufferHandle;
|
||||
typedef struct { uint16_t idx; } MaterialHandle;
|
||||
typedef struct { uint16_t idx; } ProgramHandle;
|
||||
typedef struct { uint16_t idx; } RenderTargetHandle;
|
||||
typedef struct { uint16_t idx; } TextureHandle;
|
||||
typedef struct { uint16_t idx; } UniformHandle;
|
||||
|
@ -339,7 +339,7 @@ namespace bgfx
|
|||
const Memory* alloc(uint32_t _size);
|
||||
|
||||
///
|
||||
const Memory* makeRef(void* _data, uint32_t _size);
|
||||
const Memory* makeRef(const void* _data, uint32_t _size);
|
||||
|
||||
///
|
||||
void setDebug(uint32_t _debug);
|
||||
|
@ -414,10 +414,10 @@ namespace bgfx
|
|||
void destroyFragmentShader(FragmentShaderHandle _handle);
|
||||
|
||||
///
|
||||
MaterialHandle createMaterial(VertexShaderHandle _vsh, FragmentShaderHandle _fsh);
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh);
|
||||
|
||||
///
|
||||
void destroyMaterial(MaterialHandle _handle);
|
||||
void destroyProgram(ProgramHandle _handle);
|
||||
|
||||
///
|
||||
TextureHandle createTexture(const Memory* _mem, uint32_t _flags = BGFX_TEXTURE_NONE, uint16_t* _width = NULL, uint16_t* _height = NULL);
|
||||
|
@ -510,22 +510,22 @@ namespace bgfx
|
|||
void setIndexBuffer(DynamicIndexBufferHandle _handle);
|
||||
|
||||
///
|
||||
void setIndexBuffer(const TransientIndexBuffer* _ib, uint32_t _numIndices = 0xffffffff);
|
||||
void setIndexBuffer(const TransientIndexBuffer* _ib, uint32_t _numIndices = UINT32_MAX);
|
||||
|
||||
///
|
||||
void setVertexBuffer(VertexBufferHandle _handle);
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
|
||||
|
||||
///
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle);
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
|
||||
|
||||
///
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb);
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb, uint32_t _numVertices = UINT32_MAX);
|
||||
|
||||
///
|
||||
void setInstanceDataBuffer(const InstanceDataBuffer* _idb);
|
||||
|
||||
///
|
||||
void setMaterial(MaterialHandle _handle);
|
||||
void setProgram(ProgramHandle _handle);
|
||||
|
||||
///
|
||||
void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle);
|
||||
|
|
41
makefile
Normal file
41
makefile
Normal file
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
#
|
||||
|
||||
all:
|
||||
premake --file=premake\premake4.lua vs2008
|
||||
premake --file=premake\premake4.lua --gcc=nacl gmake
|
||||
premake --file=premake\premake4.lua --gcc=mingw gmake
|
||||
premake --file=premake\premake4.lua --gcc=linux gmake
|
||||
make -s --no-print-directory -C src
|
||||
|
||||
nacl-debug32:
|
||||
make -C .build\projects\gmake-nacl config=debug32
|
||||
nacl-release32:
|
||||
make -C .build\projects\gmake-nacl config=release32
|
||||
nacl-debug64:
|
||||
make -C .build\projects\gmake-nacl config=debug64
|
||||
nacl-release64:
|
||||
make -C .build\projects\gmake-nacl config=release64
|
||||
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
|
||||
|
||||
mingw-debug32:
|
||||
make -C .build\projects\gmake-mingw config=debug32
|
||||
mingw-release32:
|
||||
make -C .build\projects\gmake-mingw config=release32
|
||||
mingw-debug64:
|
||||
make -C .build\projects\gmake-mingw config=debug64
|
||||
mingw-release64:
|
||||
make -C .build\projects\gmake-mingw config=release64
|
||||
mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
|
||||
|
||||
linux-debug32:
|
||||
make -C .build\projects\gmake-linux config=debug32
|
||||
linux-release32:
|
||||
make -C .build\projects\gmake-linux config=release32
|
||||
linux-debug64:
|
||||
make -C .build\projects\gmake-linux config=debug64
|
||||
linux-release64:
|
||||
make -C .build\projects\gmake-linux config=release64
|
||||
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
|
|
@ -1,4 +1,4 @@
|
|||
project "helloworld"
|
||||
project "example-00-helloworld"
|
||||
uuid "ff2c8450-ebf4-11e0-9572-0800200c9a66"
|
||||
kind "WindowedApp"
|
||||
|
||||
|
@ -10,8 +10,8 @@ project "helloworld"
|
|||
files {
|
||||
BGFX_DIR .. "examples/common/**.cpp",
|
||||
BGFX_DIR .. "examples/common/**.h",
|
||||
BGFX_DIR .. "examples/helloworld/**.cpp",
|
||||
BGFX_DIR .. "examples/helloworld/**.h",
|
||||
BGFX_DIR .. "examples/00-helloworld/**.cpp",
|
||||
BGFX_DIR .. "examples/00-helloworld/**.h",
|
||||
}
|
||||
|
||||
links {
|
36
premake/example-01-cubes.lua
Normal file
36
premake/example-01-cubes.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
project "example-01-cubes"
|
||||
uuid "fec3bc94-e1e5-11e1-9c59-c7eeec2c1c51"
|
||||
kind "WindowedApp"
|
||||
|
||||
debugdir (BGFX_DIR .. "examples/01-cubes/")
|
||||
|
||||
includedirs {
|
||||
BGFX_DIR .. "../bx/include",
|
||||
BGFX_DIR .. "include",
|
||||
}
|
||||
|
||||
files {
|
||||
BGFX_DIR .. "examples/common/**.cpp",
|
||||
BGFX_DIR .. "examples/common/**.h",
|
||||
BGFX_DIR .. "examples/01-cubes/**.cpp",
|
||||
BGFX_DIR .. "examples/01-cubes/**.h",
|
||||
}
|
||||
|
||||
links {
|
||||
"bgfx",
|
||||
}
|
||||
|
||||
configuration { "nacl" }
|
||||
targetextension ".nexe"
|
||||
|
||||
configuration { "nacl", "Release" }
|
||||
postbuildcommands {
|
||||
"@echo Stripping symbols.",
|
||||
"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
|
||||
}
|
||||
|
||||
configuration { "linux" }
|
||||
links {
|
||||
"GL",
|
||||
"pthread",
|
||||
}
|
36
premake/example-02-metaballs.lua
Normal file
36
premake/example-02-metaballs.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
project "example-02-metaballs"
|
||||
uuid "413b2cb4-f7db-11e1-bf5f-a716de6a022f"
|
||||
kind "WindowedApp"
|
||||
|
||||
debugdir (BGFX_DIR .. "examples/02-metaballs/")
|
||||
|
||||
includedirs {
|
||||
BGFX_DIR .. "../bx/include",
|
||||
BGFX_DIR .. "include",
|
||||
}
|
||||
|
||||
files {
|
||||
BGFX_DIR .. "examples/common/**.cpp",
|
||||
BGFX_DIR .. "examples/common/**.h",
|
||||
BGFX_DIR .. "examples/02-metaballs/**.cpp",
|
||||
BGFX_DIR .. "examples/02-metaballs/**.h",
|
||||
}
|
||||
|
||||
links {
|
||||
"bgfx",
|
||||
}
|
||||
|
||||
configuration { "nacl" }
|
||||
targetextension ".nexe"
|
||||
|
||||
configuration { "nacl", "Release" }
|
||||
postbuildcommands {
|
||||
"@echo Stripping symbols.",
|
||||
"@$(NACL)/bin/x86_64-nacl-strip -s \"$(TARGET)\""
|
||||
}
|
||||
|
||||
configuration { "linux" }
|
||||
links {
|
||||
"GL",
|
||||
"pthread",
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
--
|
||||
-- Copyright 2010-2011 Branimir Karadzic. All rights reserved.
|
||||
-- Copyright 2010-2012 Branimir Karadzic. All rights reserved.
|
||||
-- License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
--
|
||||
|
||||
|
@ -35,6 +35,8 @@ BGFX_DIR = (path.getabsolute("..") .. "/")
|
|||
local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
|
||||
local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
|
||||
|
||||
BX_DIR = (BGFX_DIR .. "/../../bx/")
|
||||
|
||||
local XEDK = os.getenv("XEDK")
|
||||
if not XEDK then XEDK = "<you must install XBOX SDK>" end
|
||||
|
||||
|
@ -106,7 +108,7 @@ configuration "Release"
|
|||
targetsuffix "Release"
|
||||
|
||||
configuration { "vs*" }
|
||||
includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/msvc" }
|
||||
includedirs { BX_DIR .. "include/compat/msvc" }
|
||||
defines {
|
||||
"WIN32",
|
||||
"_WIN32",
|
||||
|
@ -136,7 +138,7 @@ configuration { "x64", "vs*" }
|
|||
|
||||
configuration { "mingw" }
|
||||
defines { "WIN32" }
|
||||
includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/mingw" }
|
||||
includedirs { BX_DIR .. "include/compat/mingw" }
|
||||
buildoptions {
|
||||
"-std=c++0x",
|
||||
"-U__STRICT_ANSI__",
|
||||
|
@ -191,7 +193,7 @@ configuration { "linux", "x64" }
|
|||
|
||||
configuration { "nacl" }
|
||||
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" }
|
||||
includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/nacl" }
|
||||
includedirs { BX_DIR .. "include/compat/nacl" }
|
||||
buildoptions {
|
||||
"-std=c++0x",
|
||||
"-U__STRICT_ANSI__",
|
||||
|
@ -224,7 +226,7 @@ configuration { "x64", "nacl" }
|
|||
configuration { "Xbox360" }
|
||||
targetdir (BGFX_BUILD_DIR .. "xbox360" .. "/bin")
|
||||
objdir (BGFX_BUILD_DIR .. "xbox360" .. "/obj")
|
||||
includedirs { BGFX_THIRD_PARTY_DIR .. "compiler/msvc" }
|
||||
includedirs { BX_DIR .. "include/compat/msvc" }
|
||||
libdirs { BGFX_THIRD_PARTY_DIR .. "lib/xbox360" }
|
||||
defines {
|
||||
"NOMINMAX",
|
||||
|
@ -238,6 +240,8 @@ end
|
|||
|
||||
dofile "bgfx.lua"
|
||||
dofile "ddsdump.lua"
|
||||
dofile "helloworld.lua"
|
||||
dofile "makedisttex.lua"
|
||||
dofile "shaderc.lua"
|
||||
dofile "example-00-helloworld.lua"
|
||||
dofile "example-01-cubes.lua"
|
||||
dofile "example-02-metaballs.lua"
|
||||
|
|
60
src/bgfx.cpp
60
src/bgfx.cpp
|
@ -218,32 +218,24 @@ namespace bgfx
|
|||
m_texture = createTexture2D(2048, 24, 1, TextureFormat::L8, BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT, mem);
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_DIRECT3D9
|
||||
mem = alloc(sizeof(vs_debugfont_dx9)+1);
|
||||
memcpy(mem->data, vs_debugfont_dx9, mem->size-1);
|
||||
mem = makeRef(vs_debugfont_dx9, sizeof(vs_debugfont_dx9) );
|
||||
#elif BGFX_CONFIG_RENDERER_DIRECT3D11
|
||||
mem = alloc(sizeof(vs_debugfont_dx11)+1);
|
||||
memcpy(mem->data, vs_debugfont_dx11, mem->size-1);
|
||||
mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) );
|
||||
#else
|
||||
mem = alloc(sizeof(vs_debugfont_glsl)+1);
|
||||
memcpy(mem->data, vs_debugfont_glsl, mem->size-1);
|
||||
mem = makeRef(vs_debugfont_glsl, sizeof(vs_debugfont_glsl) );
|
||||
#endif // BGFX_CONFIG_RENDERER_
|
||||
mem->data[mem->size-1] = '\0';
|
||||
VertexShaderHandle vsh = createVertexShader(mem);
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_DIRECT3D9
|
||||
mem = alloc(sizeof(fs_debugfont_dx9)+1);
|
||||
memcpy(mem->data, fs_debugfont_dx9, mem->size-1);
|
||||
mem = makeRef(fs_debugfont_dx9, sizeof(fs_debugfont_dx9) );
|
||||
#elif BGFX_CONFIG_RENDERER_DIRECT3D11
|
||||
mem = alloc(sizeof(fs_debugfont_dx11)+1);
|
||||
memcpy(mem->data, fs_debugfont_dx11, mem->size-1);
|
||||
mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) );
|
||||
#else
|
||||
mem = alloc(sizeof(fs_debugfont_glsl)+1);
|
||||
memcpy(mem->data, fs_debugfont_glsl, mem->size-1);
|
||||
mem = makeRef(fs_debugfont_glsl, sizeof(fs_debugfont_glsl) );
|
||||
#endif // BGFX_CONFIG_RENDERER_
|
||||
mem->data[mem->size-1] = '\0';
|
||||
FragmentShaderHandle fsh = createFragmentShader(mem);
|
||||
|
||||
m_material = createMaterial(vsh, fsh);
|
||||
m_program = createProgram(vsh, fsh);
|
||||
|
||||
m_vb = s_ctx.createTransientVertexBuffer(numBatchVertices*m_decl.m_stride, &m_decl);
|
||||
m_ib = s_ctx.createTransientIndexBuffer(numBatchIndices*2);
|
||||
|
@ -377,7 +369,7 @@ namespace bgfx
|
|||
memcpy(mem->data, fs_clear_dx11, mem->size-1);
|
||||
FragmentShaderHandle fsh = createFragmentShader(mem);
|
||||
|
||||
m_material = createMaterial(vsh, fsh);
|
||||
m_program = createProgram(vsh, fsh);
|
||||
|
||||
m_vb = s_ctx.createTransientVertexBuffer(4*m_decl.m_stride, &m_decl);
|
||||
|
||||
|
@ -432,7 +424,8 @@ namespace bgfx
|
|||
return;
|
||||
}
|
||||
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num)
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
|
||||
|| (0 == m_state.m_numVertices && 0 == m_state.m_numIndices) )
|
||||
{
|
||||
++m_numDropped;
|
||||
return;
|
||||
|
@ -462,7 +455,8 @@ namespace bgfx
|
|||
return;
|
||||
}
|
||||
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num)
|
||||
if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
|
||||
|| (0 == m_state.m_numVertices && 0 == m_state.m_numIndices) )
|
||||
{
|
||||
m_numDropped += uint32_cntbits(_viewMask);
|
||||
return;
|
||||
|
@ -782,7 +776,7 @@ namespace bgfx
|
|||
return mem;
|
||||
}
|
||||
|
||||
const Memory* makeRef(void* _data, uint32_t _size)
|
||||
const Memory* makeRef(const void* _data, uint32_t _size)
|
||||
{
|
||||
Memory* mem = (Memory*)g_realloc(NULL, sizeof(Memory) );
|
||||
mem->size = _size;
|
||||
|
@ -918,14 +912,14 @@ namespace bgfx
|
|||
s_ctx.destroyFragmentShader(_handle);
|
||||
}
|
||||
|
||||
MaterialHandle createMaterial(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
return s_ctx.createMaterial(_vsh, _fsh);
|
||||
return s_ctx.createProgram(_vsh, _fsh);
|
||||
}
|
||||
|
||||
void destroyMaterial(MaterialHandle _handle)
|
||||
void destroyProgram(ProgramHandle _handle)
|
||||
{
|
||||
s_ctx.destroyMaterial(_handle);
|
||||
s_ctx.destroyProgram(_handle);
|
||||
}
|
||||
|
||||
TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint16_t* _width, uint16_t* _height)
|
||||
|
@ -1137,9 +1131,9 @@ namespace bgfx
|
|||
s_ctx.setUniform(_handle, _value, _num);
|
||||
}
|
||||
|
||||
void setUniform(MaterialHandle _material, UniformHandle _handle, const void* _value)
|
||||
void setUniform(ProgramHandle _program, UniformHandle _handle, const void* _value)
|
||||
{
|
||||
s_ctx.setUniform(_material, _handle, _value);
|
||||
s_ctx.setUniform(_program, _handle, _value);
|
||||
}
|
||||
|
||||
void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
|
||||
|
@ -1168,19 +1162,19 @@ namespace bgfx
|
|||
s_ctx.m_submit->setIndexBuffer(_ib, numIndices);
|
||||
}
|
||||
|
||||
void setVertexBuffer(VertexBufferHandle _handle)
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices)
|
||||
{
|
||||
s_ctx.m_submit->setVertexBuffer(_handle);
|
||||
s_ctx.m_submit->setVertexBuffer(_handle, _numVertices);
|
||||
}
|
||||
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle)
|
||||
void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
|
||||
{
|
||||
s_ctx.m_submit->setVertexBuffer(s_ctx.m_dynamicVertexBuffers[_handle.idx]);
|
||||
s_ctx.m_submit->setVertexBuffer(s_ctx.m_dynamicVertexBuffers[_handle.idx], _numVertices);
|
||||
}
|
||||
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb)
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb, uint32_t _numVertices)
|
||||
{
|
||||
s_ctx.m_submit->setVertexBuffer(_vb);
|
||||
s_ctx.m_submit->setVertexBuffer(_vb, _numVertices);
|
||||
}
|
||||
|
||||
void setInstanceDataBuffer(const InstanceDataBuffer* _idb)
|
||||
|
@ -1188,9 +1182,9 @@ namespace bgfx
|
|||
s_ctx.m_submit->setInstanceDataBuffer(_idb);
|
||||
}
|
||||
|
||||
void setMaterial(MaterialHandle _handle)
|
||||
void setProgram(ProgramHandle _handle)
|
||||
{
|
||||
s_ctx.m_submit->setMaterial(_handle);
|
||||
s_ctx.m_submit->setProgram(_handle);
|
||||
}
|
||||
|
||||
void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle)
|
||||
|
|
96
src/bgfx_p.h
96
src/bgfx_p.h
|
@ -362,7 +362,7 @@ namespace bgfx
|
|||
TransientVertexBuffer* m_vb;
|
||||
TransientIndexBuffer* m_ib;
|
||||
VertexDecl m_decl;
|
||||
MaterialHandle m_material;
|
||||
ProgramHandle m_program;
|
||||
};
|
||||
|
||||
struct ClearQuad
|
||||
|
@ -373,7 +373,7 @@ namespace bgfx
|
|||
TransientVertexBuffer* m_vb;
|
||||
IndexBufferHandle m_ib;
|
||||
VertexDecl m_decl;
|
||||
MaterialHandle m_material;
|
||||
ProgramHandle m_program;
|
||||
};
|
||||
|
||||
struct PredefinedUniform
|
||||
|
@ -528,7 +528,7 @@ namespace bgfx
|
|||
UpdateDynamicVertexBuffer,
|
||||
CreateVertexShader,
|
||||
CreateFragmentShader,
|
||||
CreateMaterial,
|
||||
CreateProgram,
|
||||
CreateTexture,
|
||||
UpdateTexture,
|
||||
CreateRenderTarget,
|
||||
|
@ -542,7 +542,7 @@ namespace bgfx
|
|||
DestroyDynamicVertexBuffer,
|
||||
DestroyVertexShader,
|
||||
DestroyFragmentShader,
|
||||
DestroyMaterial,
|
||||
DestroyProgram,
|
||||
DestroyTexture,
|
||||
DestroyRenderTarget,
|
||||
DestroyUniform,
|
||||
|
@ -607,7 +607,7 @@ namespace bgfx
|
|||
// | | | | | ||
|
||||
|
||||
uint64_t tmp0 = m_depth;
|
||||
uint64_t tmp1 = uint64_t(m_material)<<0x18;
|
||||
uint64_t tmp1 = uint64_t(m_program)<<0x18;
|
||||
uint64_t tmp2 = uint64_t(m_trans)<<0x21;
|
||||
uint64_t tmp3 = uint64_t(m_seq)<<0x23;
|
||||
uint64_t tmp4 = uint64_t(m_view)<<0x2e;
|
||||
|
@ -618,7 +618,7 @@ namespace bgfx
|
|||
void decode(uint64_t _key)
|
||||
{
|
||||
m_depth = _key&0xffffffff;
|
||||
m_material = (_key>>0x18)&(BGFX_CONFIG_MAX_MATERIALS-1);
|
||||
m_program = (_key>>0x18)&(BGFX_CONFIG_MAX_PROGRAMS-1);
|
||||
m_trans = (_key>>0x21)&0x3;
|
||||
m_seq = (_key>>0x23)&0x7ff;
|
||||
m_view = (_key>>0x2e)&(BGFX_CONFIG_MAX_VIEWS-1);
|
||||
|
@ -627,14 +627,14 @@ namespace bgfx
|
|||
void reset()
|
||||
{
|
||||
m_depth = 0;
|
||||
m_material = 0;
|
||||
m_program = 0;
|
||||
m_seq = 0;
|
||||
m_view = 0;
|
||||
m_trans = 0;
|
||||
}
|
||||
|
||||
int32_t m_depth;
|
||||
uint16_t m_material;
|
||||
uint16_t m_program;
|
||||
uint16_t m_seq;
|
||||
uint8_t m_view;
|
||||
uint8_t m_trans;
|
||||
|
@ -1113,26 +1113,26 @@ namespace bgfx
|
|||
g_free(const_cast<TransientIndexBuffer*>(_ib) );
|
||||
}
|
||||
|
||||
void setVertexBuffer(VertexBufferHandle _handle)
|
||||
void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices)
|
||||
{
|
||||
BX_CHECK(_handle.idx < BGFX_CONFIG_MAX_VERTEX_BUFFERS, "Invalid vertex buffer handle. %d (< %d)", _handle.idx, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
|
||||
m_state.m_startVertex = 0;
|
||||
m_state.m_numVertices = UINT32_C(0xffffffff);
|
||||
m_state.m_numVertices = _numVertices;
|
||||
m_state.m_vertexBuffer = _handle;
|
||||
}
|
||||
|
||||
void setVertexBuffer(const DynamicVertexBuffer& dvb)
|
||||
void setVertexBuffer(const DynamicVertexBuffer& dvb, uint32_t _numVertices)
|
||||
{
|
||||
m_state.m_startVertex = dvb.m_startVertex;
|
||||
m_state.m_numVertices = dvb.m_numVertices;
|
||||
m_state.m_numVertices = uint32_min(dvb.m_numVertices, _numVertices);
|
||||
m_state.m_vertexBuffer = dvb.m_handle;
|
||||
m_state.m_vertexDecl = dvb.m_decl;
|
||||
}
|
||||
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb)
|
||||
void setVertexBuffer(const TransientVertexBuffer* _vb, uint32_t _numVertices)
|
||||
{
|
||||
m_state.m_startVertex = _vb->startVertex;
|
||||
m_state.m_numVertices = _vb->size/_vb->stride;
|
||||
m_state.m_numVertices = uint32_min(_vb->size/_vb->stride, _numVertices);
|
||||
m_state.m_vertexBuffer = _vb->handle;
|
||||
m_state.m_vertexDecl = _vb->decl;
|
||||
g_free(const_cast<TransientVertexBuffer*>(_vb) );
|
||||
|
@ -1150,10 +1150,10 @@ namespace bgfx
|
|||
#endif // BGFX_CONFIG_RENDERER_OPENGLES
|
||||
}
|
||||
|
||||
void setMaterial(MaterialHandle _handle)
|
||||
void setProgram(ProgramHandle _handle)
|
||||
{
|
||||
BX_CHECK(invalidHandle != _handle.idx, "Can't set material with invalid handle.");
|
||||
m_key.m_material = _handle.idx;
|
||||
BX_CHECK(invalidHandle != _handle.idx, "Can't set program with invalid handle.");
|
||||
m_key.m_program = _handle.idx;
|
||||
}
|
||||
|
||||
void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle)
|
||||
|
@ -1259,10 +1259,10 @@ namespace bgfx
|
|||
++m_numFreeFragmentShaderHandles;
|
||||
}
|
||||
|
||||
void free(MaterialHandle _handle)
|
||||
void free(ProgramHandle _handle)
|
||||
{
|
||||
m_freeMaterialHandle[m_numFreeMaterialHandles] = _handle;
|
||||
++m_numFreeMaterialHandles;
|
||||
m_freeProgramHandle[m_numFreeProgramHandles] = _handle;
|
||||
++m_numFreeProgramHandles;
|
||||
}
|
||||
|
||||
void free(TextureHandle _handle)
|
||||
|
@ -1291,7 +1291,7 @@ namespace bgfx
|
|||
m_numFreeVertexShaderHandles = 0;
|
||||
m_numFreeFragmentShaderHandles = 0;
|
||||
m_numFreeFragmentShaderHandles = 0;
|
||||
m_numFreeMaterialHandles = 0;
|
||||
m_numFreeProgramHandles = 0;
|
||||
m_numFreeTextureHandles = 0;
|
||||
m_numFreeRenderTargetHandles = 0;
|
||||
m_numFreeUniformHandles = 0;
|
||||
|
@ -1336,7 +1336,7 @@ namespace bgfx
|
|||
uint16_t m_numFreeVertexBufferHandles;
|
||||
uint16_t m_numFreeVertexShaderHandles;
|
||||
uint16_t m_numFreeFragmentShaderHandles;
|
||||
uint16_t m_numFreeMaterialHandles;
|
||||
uint16_t m_numFreeProgramHandles;
|
||||
uint16_t m_numFreeTextureHandles;
|
||||
uint16_t m_numFreeRenderTargetHandles;
|
||||
uint16_t m_numFreeUniformHandles;
|
||||
|
@ -1346,7 +1346,7 @@ namespace bgfx
|
|||
VertexBufferHandle m_freeVertexBufferHandle[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
|
||||
VertexShaderHandle m_freeVertexShaderHandle[BGFX_CONFIG_MAX_VERTEX_SHADERS];
|
||||
FragmentShaderHandle m_freeFragmentShaderHandle[BGFX_CONFIG_MAX_FRAGMENT_SHADERS];
|
||||
MaterialHandle m_freeMaterialHandle[BGFX_CONFIG_MAX_MATERIALS];
|
||||
ProgramHandle m_freeProgramHandle[BGFX_CONFIG_MAX_PROGRAMS];
|
||||
TextureHandle m_freeTextureHandle[BGFX_CONFIG_MAX_TEXTURES];
|
||||
RenderTargetHandle m_freeRenderTargetHandle[BGFX_CONFIG_MAX_RENDER_TARGETS];
|
||||
UniformHandle m_freeUniformHandle[BGFX_CONFIG_MAX_UNIFORMS];
|
||||
|
@ -1530,7 +1530,7 @@ namespace bgfx
|
|||
, m_vertexBufferHandle(BGFX_CONFIG_MAX_VERTEX_BUFFERS)
|
||||
, m_vertexShaderHandle(BGFX_CONFIG_MAX_VERTEX_SHADERS)
|
||||
, m_fragmentShaderHandle(BGFX_CONFIG_MAX_FRAGMENT_SHADERS)
|
||||
, m_materialHandle(BGFX_CONFIG_MAX_MATERIALS)
|
||||
, m_programHandle(BGFX_CONFIG_MAX_PROGRAMS)
|
||||
, m_textureHandle(BGFX_CONFIG_MAX_TEXTURES)
|
||||
, m_renderTargetHandle(BGFX_CONFIG_MAX_RENDER_TARGETS)
|
||||
, m_uniformHandle(BGFX_CONFIG_MAX_UNIFORMS)
|
||||
|
@ -1984,31 +1984,31 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
MaterialHandle createMaterial(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
MaterialHandle handle;
|
||||
handle.idx = m_materialHandle.alloc();
|
||||
ProgramHandle handle;
|
||||
handle.idx = m_programHandle.alloc();
|
||||
|
||||
vertexShaderIncRef(_vsh);
|
||||
fragmentShaderIncRef(_fsh);
|
||||
m_materialRef[handle.idx].m_vsh = _vsh;
|
||||
m_materialRef[handle.idx].m_fsh = _fsh;
|
||||
m_programRef[handle.idx].m_vsh = _vsh;
|
||||
m_programRef[handle.idx].m_fsh = _fsh;
|
||||
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateMaterial);
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram);
|
||||
cmdbuf.write(handle);
|
||||
cmdbuf.write(_vsh);
|
||||
cmdbuf.write(_fsh);
|
||||
return handle;
|
||||
}
|
||||
|
||||
void destroyMaterial(MaterialHandle _handle)
|
||||
void destroyProgram(ProgramHandle _handle)
|
||||
{
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyMaterial);
|
||||
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram);
|
||||
cmdbuf.write(_handle);
|
||||
m_submit->free(_handle);
|
||||
|
||||
vertexShaderDecRef(m_materialRef[_handle.idx].m_vsh);
|
||||
fragmentShaderDecRef(m_materialRef[_handle.idx].m_fsh);
|
||||
vertexShaderDecRef(m_programRef[_handle.idx].m_vsh);
|
||||
fragmentShaderDecRef(m_programRef[_handle.idx].m_fsh);
|
||||
}
|
||||
|
||||
TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint16_t* _width, uint16_t* _height)
|
||||
|
@ -2129,7 +2129,7 @@ namespace bgfx
|
|||
m_submit->writeConstant(constant.m_type, _handle, _value, uint16_min(constant.m_num, _num) );
|
||||
}
|
||||
|
||||
void setUniform(MaterialHandle /*_material*/, UniformHandle /*_handle*/, const void* /*_value*/)
|
||||
void setUniform(ProgramHandle /*_program*/, UniformHandle /*_handle*/, const void* /*_value*/)
|
||||
{
|
||||
BX_CHECK(false, "NOT IMPLEMENTED!");
|
||||
}
|
||||
|
@ -2262,9 +2262,9 @@ namespace bgfx
|
|||
m_fragmentShaderHandle.free(_frame->m_freeFragmentShaderHandle[ii].idx);
|
||||
}
|
||||
|
||||
for (uint16_t ii = 0, num = _frame->m_numFreeMaterialHandles; ii < num; ++ii)
|
||||
for (uint16_t ii = 0, num = _frame->m_numFreeProgramHandles; ii < num; ++ii)
|
||||
{
|
||||
m_materialHandle.free(_frame->m_freeMaterialHandle[ii].idx);
|
||||
m_programHandle.free(_frame->m_freeProgramHandle[ii].idx);
|
||||
}
|
||||
|
||||
for (uint16_t ii = 0, num = _frame->m_numFreeTextureHandles; ii < num; ++ii)
|
||||
|
@ -2346,8 +2346,8 @@ namespace bgfx
|
|||
void rendererDestroyVertexShader(VertexShaderHandle _handle);
|
||||
void rendererCreateFragmentShader(FragmentShaderHandle _handle, Memory* _mem);
|
||||
void rendererDestroyFragmentShader(FragmentShaderHandle _handle);
|
||||
void rendererCreateMaterial(MaterialHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh);
|
||||
void rendererDestroyMaterial(FragmentShaderHandle _handle);
|
||||
void rendererCreateProgram(ProgramHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh);
|
||||
void rendererDestroyProgram(FragmentShaderHandle _handle);
|
||||
void rendererCreateTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags);
|
||||
void rendererUpdateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, const Memory* _mem);
|
||||
void rendererDestroyTexture(TextureHandle _handle);
|
||||
|
@ -2609,9 +2609,9 @@ namespace bgfx
|
|||
}
|
||||
break;
|
||||
|
||||
case CommandBuffer::CreateMaterial:
|
||||
case CommandBuffer::CreateProgram:
|
||||
{
|
||||
MaterialHandle handle;
|
||||
ProgramHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
VertexShaderHandle vsh;
|
||||
|
@ -2620,16 +2620,16 @@ namespace bgfx
|
|||
FragmentShaderHandle fsh;
|
||||
_cmdbuf.read(fsh);
|
||||
|
||||
rendererCreateMaterial(handle, vsh, fsh);
|
||||
rendererCreateProgram(handle, vsh, fsh);
|
||||
}
|
||||
break;
|
||||
|
||||
case CommandBuffer::DestroyMaterial:
|
||||
case CommandBuffer::DestroyProgram:
|
||||
{
|
||||
FragmentShaderHandle handle;
|
||||
_cmdbuf.read(handle);
|
||||
|
||||
rendererDestroyMaterial(handle);
|
||||
rendererDestroyProgram(handle);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2854,19 +2854,19 @@ namespace bgfx
|
|||
HandleAlloc m_vertexBufferHandle;
|
||||
HandleAlloc m_vertexShaderHandle;
|
||||
HandleAlloc m_fragmentShaderHandle;
|
||||
HandleAlloc m_materialHandle;
|
||||
HandleAlloc m_programHandle;
|
||||
HandleAlloc m_textureHandle;
|
||||
HandleAlloc m_renderTargetHandle;
|
||||
HandleAlloc m_uniformHandle;
|
||||
|
||||
int32_t m_vertexShaderRef[BGFX_CONFIG_MAX_VERTEX_SHADERS];
|
||||
int32_t m_fragmentShaderRef[BGFX_CONFIG_MAX_FRAGMENT_SHADERS];
|
||||
struct MaterialRef
|
||||
struct ProgramRef
|
||||
{
|
||||
VertexShaderHandle m_vsh;
|
||||
FragmentShaderHandle m_fsh;
|
||||
};
|
||||
MaterialRef m_materialRef[BGFX_CONFIG_MAX_MATERIALS];
|
||||
ProgramRef m_programRef[BGFX_CONFIG_MAX_PROGRAMS];
|
||||
VertexDeclRef m_declRef;
|
||||
|
||||
RenderTargetHandle m_rt[BGFX_CONFIG_MAX_VIEWS];
|
||||
|
@ -3022,7 +3022,7 @@ namespace bgfx
|
|||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if ((WM_KEYDOWN == _id && VK_F11 == _wparam)
|
||||
|| (WM_SYSKEYDOWN == _id && VK_RETURN == _wparam))
|
||||
|| (WM_SYSKEYDOWN == _id && VK_RETURN == _wparam) )
|
||||
{
|
||||
toggleWindowFrame();
|
||||
}
|
||||
|
|
57
src/bgfx_shader.sh
Normal file
57
src/bgfx_shader.sh
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef __BGFX_SHADER_H__
|
||||
#define __BGFX_SHADER_H__
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#if BGFX_SHADER_LANGUAGE_HLSL
|
||||
# define dFdx ddx
|
||||
# define dFdy ddy
|
||||
|
||||
# if BGFX_SHADER_LANGUAGE_HLSL > 3
|
||||
# define SAMPLER2D(_name, _reg) \
|
||||
uniform SamplerState _name ## Sampler : register(s[_reg]); \
|
||||
uniform Texture2D _name : register(t[_reg])
|
||||
# define texture2D(_name, _coord) _name.Sample(_name ## Sampler, _coord)
|
||||
|
||||
# define SAMPLER3D(_name, _reg) \
|
||||
uniform SamplerState _name : register(s[_reg]) \
|
||||
uniform Texture3D _name : register(t[_reg])
|
||||
# define texture3D(_name, _coord) _name.Sample(_name ## Sampler, _coord)
|
||||
|
||||
# define SAMPLERCUBE(_name, _reg) \
|
||||
uniform SamplerState _name ## Sampler : register(s[_reg]); \
|
||||
uniform TextureCube _name : register(t[_reg])
|
||||
# define textureCube(_name, _coord) _name.Sample(_name ## Sampler, _coord)
|
||||
# else
|
||||
# define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
|
||||
# define texture2D tex2D
|
||||
# define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
|
||||
# define texture3D tex3D
|
||||
# define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
|
||||
# define textureCube texCUBE
|
||||
# endif //
|
||||
|
||||
# define vec2_splat(_x) float2(_x, _x)
|
||||
# define vec3_splat(_x) float3(_x, _x, _x)
|
||||
# define vec4_splat(_x) float4(_x, _x, _x, _x)
|
||||
#elif BGFX_SHADER_LANGUAGE_GLSL
|
||||
# define frac fract
|
||||
# define lerp mix
|
||||
# define mul(_a, _b) ( (_a) * (_b) )
|
||||
# define saturate(_x) clamp(_x, 0.0, 1.0)
|
||||
# define SAMPLER2D(_name, _reg) uniform sampler2D _name
|
||||
# define SAMPLER3D(_name, _reg) uniform sampler3D _name
|
||||
# define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
|
||||
# define vec2_splat(_x) vec2(_x)
|
||||
# define vec3_splat(_x) vec3(_x)
|
||||
# define vec4_splat(_x) vec4(_x)
|
||||
#endif // BGFX_SHADER_LANGUAGE_HLSL
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __BGFX_SHADER_H__
|
21
src/common.sh
Normal file
21
src/common.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef __SHADER_COMMON_H__
|
||||
#define __SHADER_COMMON_H__
|
||||
|
||||
#include "bgfx_shader.sh"
|
||||
|
||||
uniform mat4 u_view;
|
||||
uniform mat4 u_viewProj;
|
||||
uniform mat4 u_model;
|
||||
uniform mat4 u_modelView;
|
||||
uniform mat4 u_modelViewProj;
|
||||
uniform mat4 u_modelViewProjX;
|
||||
uniform mat4 u_viewProjX;
|
||||
|
||||
SAMPLER2D(u_texColor, 0);
|
||||
|
||||
#endif // __SHADER_COMMON_H__
|
|
@ -92,9 +92,9 @@
|
|||
# define BGFX_CONFIG_MAX_FRAGMENT_SHADERS 256
|
||||
#endif // BGFX_CONFIG_MAX_FRAGMENT_SHADERS
|
||||
|
||||
#ifndef BGFX_CONFIG_MAX_MATERIALS
|
||||
# define BGFX_CONFIG_MAX_MATERIALS 512
|
||||
#endif // BGFX_CONFIG_MAX_MATERIALS
|
||||
#ifndef BGFX_CONFIG_MAX_PROGRAMS
|
||||
# define BGFX_CONFIG_MAX_PROGRAMS 512
|
||||
#endif // BGFX_CONFIG_MAX_PROGRAMS
|
||||
|
||||
#ifndef BGFX_CONFIG_MAX_PROGRAMS
|
||||
# define BGFX_CONFIG_MAX_PROGRAMS (4<<10)
|
||||
|
|
|
@ -105,7 +105,7 @@ void decodeBlockDxt(uint8_t _dst[16*4], const uint8_t _src[8])
|
|||
|
||||
for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2)
|
||||
{
|
||||
int idx = ( (_src[next>>3] >> (next & 7)) & 3) * 3;
|
||||
int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 3;
|
||||
_dst[ii+0] = colors[idx+0];
|
||||
_dst[ii+1] = colors[idx+1];
|
||||
_dst[ii+2] = colors[idx+2];
|
||||
|
@ -155,7 +155,7 @@ void decodeBlockDxt1(uint8_t _dst[16*4], const uint8_t _src[8])
|
|||
|
||||
for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2)
|
||||
{
|
||||
int idx = ( (_src[next>>3] >> (next & 7)) & 3) * 4;
|
||||
int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 4;
|
||||
_dst[ii+0] = colors[idx+0];
|
||||
_dst[ii+1] = colors[idx+1];
|
||||
_dst[ii+2] = colors[idx+2];
|
||||
|
|
13
src/fs_clear.sc
Normal file
13
src/fs_clear.sc
Normal file
|
@ -0,0 +1,13 @@
|
|||
$input v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_color0;
|
||||
}
|
18
src/fs_debugfont.sc
Normal file
18
src/fs_debugfont.sc
Normal file
|
@ -0,0 +1,18 @@
|
|||
$input v_color0, v_color1, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = lerp(v_color1, v_color0, texture2D(u_texColor, v_texcoord0).xxxx);
|
||||
if (color.w < 1.0/255.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
gl_FragColor = color;
|
||||
}
|
38
src/makefile
Normal file
38
src/makefile
Normal file
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
#
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: vs_debugfont_dx9.bin.h fs_debugfont_dx9.bin.h \
|
||||
vs_debugfont_glsl.bin.h fs_debugfont_glsl.bin.h \
|
||||
vs_debugfont_dx11.bin.h fs_debugfont_dx11.bin.h \
|
||||
vs_clear_dx11.bin.h fs_clear_dx11.bin.h
|
||||
|
||||
clean:
|
||||
rm *.bin.h
|
||||
|
||||
vs_debugfont_dx9.bin.h:
|
||||
..\tools\bin\shaderc -f vs_debugfont.sc -o vs_debugfont_dx9.bin.h --type v -p vs_2_0 --platform windows -O 3 --bin2c vs_debugfont_dx9
|
||||
|
||||
fs_debugfont_dx9.bin.h:
|
||||
..\tools\bin\shaderc -f fs_debugfont.sc -o fs_debugfont_dx9.bin.h --type f -p ps_2_a --platform windows -O 3 --bin2c fs_debugfont_dx9
|
||||
|
||||
vs_debugfont_glsl.bin.h:
|
||||
..\tools\bin\shaderc -f vs_debugfont.sc -o vs_debugfont_glsl.bin.h --type v --platform nacl -O 3 --bin2c vs_debugfont_glsl
|
||||
|
||||
fs_debugfont_glsl.bin.h:
|
||||
..\tools\bin\shaderc -f fs_debugfont.sc -o fs_debugfont_glsl.bin.h --type f --platform nacl -O 3 --bin2c fs_debugfont_glsl
|
||||
|
||||
vs_debugfont_dx11.bin.h:
|
||||
..\tools\bin\shaderc -f vs_debugfont.sc -o vs_debugfont_dx11.bin.h --type v -p vs_5_0 --platform windows -O 3 --bin2c vs_debugfont_dx11
|
||||
|
||||
fs_debugfont_dx11.bin.h:
|
||||
..\tools\bin\shaderc -f fs_debugfont.sc -o fs_debugfont_dx11.bin.h --type f -p ps_5_0 --platform windows -O 3 --bin2c fs_debugfont_dx11
|
||||
|
||||
vs_clear_dx11.bin.h:
|
||||
..\tools\bin\shaderc -f vs_clear.sc -o vs_clear_dx11.bin.h --type v -p vs_5_0 --platform windows -O 3 --bin2c vs_clear_dx11
|
||||
|
||||
fs_clear_dx11.bin.h:
|
||||
..\tools\bin\shaderc -f fs_clear.sc -o fs_clear_dx11.bin.h --type f -p ps_5_0 --platform windows -O 3 --bin2c fs_clear_dx11
|
|
@ -484,9 +484,9 @@ namespace bgfx
|
|||
{
|
||||
if (0 < m_vsChanges)
|
||||
{
|
||||
if (NULL != m_currentMaterial->m_vsh->m_buffer)
|
||||
if (NULL != m_currentProgram->m_vsh->m_buffer)
|
||||
{
|
||||
m_deviceCtx->UpdateSubresource(m_currentMaterial->m_vsh->m_buffer, 0, 0, m_vsScratch, 0, 0);
|
||||
m_deviceCtx->UpdateSubresource(m_currentProgram->m_vsh->m_buffer, 0, 0, m_vsScratch, 0, 0);
|
||||
}
|
||||
|
||||
m_vsChanges = 0;
|
||||
|
@ -494,9 +494,9 @@ namespace bgfx
|
|||
|
||||
if (0 < m_fsChanges)
|
||||
{
|
||||
if (NULL != m_currentMaterial->m_fsh->m_buffer)
|
||||
if (NULL != m_currentProgram->m_fsh->m_buffer)
|
||||
{
|
||||
m_deviceCtx->UpdateSubresource(m_currentMaterial->m_fsh->m_buffer, 0, 0, m_fsScratch, 0, 0);
|
||||
m_deviceCtx->UpdateSubresource(m_currentProgram->m_fsh->m_buffer, 0, 0, m_fsScratch, 0, 0);
|
||||
}
|
||||
|
||||
m_fsChanges = 0;
|
||||
|
@ -541,9 +541,9 @@ namespace bgfx
|
|||
// DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) );
|
||||
}
|
||||
|
||||
void setInputLayout(const VertexDecl& _vertexDecl, const Material& _material)
|
||||
void setInputLayout(const VertexDecl& _vertexDecl, const Program& _program)
|
||||
{
|
||||
uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _material.m_vsh->m_hash;
|
||||
uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _program.m_vsh->m_hash;
|
||||
ID3D11InputLayout* layout = m_inputLayoutCache.find(layoutHash);
|
||||
if (NULL == layout)
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ namespace bgfx
|
|||
|
||||
VertexDecl decl;
|
||||
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
|
||||
const uint8_t* attrMask = _material.m_vsh->m_attrMask;
|
||||
const uint8_t* attrMask = _program.m_vsh->m_attrMask;
|
||||
|
||||
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
|
||||
{
|
||||
|
@ -564,8 +564,8 @@ namespace bgfx
|
|||
ptrdiff_t num = elem-vertexElements;
|
||||
DX_CHECK(m_device->CreateInputLayout(vertexElements
|
||||
, uint32_t(num)
|
||||
, _material.m_vsh->m_code->data
|
||||
, _material.m_vsh->m_code->size
|
||||
, _program.m_vsh->m_code->data
|
||||
, _program.m_vsh->m_code->size
|
||||
, &layout
|
||||
) );
|
||||
m_inputLayoutCache.add(layoutHash, layout);
|
||||
|
@ -735,7 +735,7 @@ namespace bgfx
|
|||
VertexBuffer m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
|
||||
Shader m_vertexShaders[BGFX_CONFIG_MAX_VERTEX_SHADERS];
|
||||
Shader m_fragmentShaders[BGFX_CONFIG_MAX_FRAGMENT_SHADERS];
|
||||
Material m_materials[BGFX_CONFIG_MAX_MATERIALS];
|
||||
Program m_program[BGFX_CONFIG_MAX_PROGRAMS];
|
||||
Texture m_textures[BGFX_CONFIG_MAX_TEXTURES];
|
||||
VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
|
||||
RenderTarget m_renderTargets[BGFX_CONFIG_MAX_RENDER_TARGETS];
|
||||
|
@ -754,7 +754,7 @@ namespace bgfx
|
|||
|
||||
TextureStage m_textureStage;
|
||||
|
||||
Material* m_currentMaterial;
|
||||
Program* m_currentProgram;
|
||||
|
||||
uint8_t m_vsScratch[64<<10];
|
||||
uint8_t m_fsScratch[64<<10];
|
||||
|
@ -959,19 +959,19 @@ namespace bgfx
|
|||
s_renderCtx.setDepthStencilState(state);
|
||||
s_renderCtx.setRasterizerState(state, false);
|
||||
|
||||
Material& material = s_renderCtx.m_materials[m_material.idx];
|
||||
s_renderCtx.m_currentMaterial = &material;
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)material.m_vsh->m_ptr, NULL, 0);
|
||||
deviceCtx->VSSetConstantBuffers(0, 1, &material.m_vsh->m_buffer);
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)material.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetConstantBuffers(0, 1, &material.m_fsh->m_buffer);
|
||||
Program& program = s_renderCtx.m_program[m_program.idx];
|
||||
s_renderCtx.m_currentProgram = &program;
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)program.m_vsh->m_ptr, NULL, 0);
|
||||
deviceCtx->VSSetConstantBuffers(0, 1, &program.m_vsh->m_buffer);
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetConstantBuffers(0, 1, &program.m_fsh->m_buffer);
|
||||
|
||||
VertexBuffer& vb = s_renderCtx.m_vertexBuffers[m_vb->handle.idx];
|
||||
VertexDecl& vertexDecl = s_renderCtx.m_vertexDecls[m_vb->decl.idx];
|
||||
uint32_t stride = vertexDecl.m_stride;
|
||||
uint32_t offset = 0;
|
||||
deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
|
||||
s_renderCtx.setInputLayout(vertexDecl, material);
|
||||
s_renderCtx.setInputLayout(vertexDecl, program);
|
||||
|
||||
IndexBuffer& ib = s_renderCtx.m_indexBuffers[m_ib->handle.idx];
|
||||
deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0);
|
||||
|
@ -979,7 +979,7 @@ namespace bgfx
|
|||
float proj[16];
|
||||
matrix_ortho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
|
||||
|
||||
PredefinedUniform& predefined = material.m_predefined[0];
|
||||
PredefinedUniform& predefined = program.m_predefined[0];
|
||||
uint8_t flags = predefined.m_type;
|
||||
s_renderCtx.setShaderConstant(flags, predefined.m_loc, proj, 4);
|
||||
|
||||
|
@ -1026,11 +1026,11 @@ namespace bgfx
|
|||
s_renderCtx.setDepthStencilState(state);
|
||||
s_renderCtx.setRasterizerState(state, false);
|
||||
|
||||
Material& material = s_renderCtx.m_materials[m_material.idx];
|
||||
s_renderCtx.m_currentMaterial = &material;
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)material.m_vsh->m_ptr, NULL, 0);
|
||||
Program& program = s_renderCtx.m_program[m_program.idx];
|
||||
s_renderCtx.m_currentProgram = &program;
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)program.m_vsh->m_ptr, NULL, 0);
|
||||
deviceCtx->VSSetConstantBuffers(0, 0, NULL);
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)material.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetConstantBuffers(0, 0, NULL);
|
||||
|
||||
VertexBuffer& vb = s_renderCtx.m_vertexBuffers[m_vb->handle.idx];
|
||||
|
@ -1070,7 +1070,7 @@ namespace bgfx
|
|||
|
||||
s_renderCtx.m_vertexBuffers[m_vb->handle.idx].update(0, 4*m_decl.m_stride, m_vb->data);
|
||||
deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
|
||||
s_renderCtx.setInputLayout(vertexDecl, material);
|
||||
s_renderCtx.setInputLayout(vertexDecl, program);
|
||||
|
||||
IndexBuffer& ib = s_renderCtx.m_indexBuffers[m_ib.idx];
|
||||
deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0);
|
||||
|
@ -1700,14 +1700,14 @@ namespace bgfx
|
|||
s_renderCtx.m_fragmentShaders[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateMaterial(MaterialHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
void Context::rendererCreateProgram(ProgramHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
s_renderCtx.m_program[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
}
|
||||
|
||||
void Context::rendererDestroyMaterial(FragmentShaderHandle _handle)
|
||||
void Context::rendererDestroyProgram(FragmentShaderHandle _handle)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].destroy();
|
||||
s_renderCtx.m_program[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags)
|
||||
|
@ -1789,7 +1789,7 @@ namespace bgfx
|
|||
bool wireframe = !!(m_render->m_debug&BGFX_DEBUG_WIREFRAME);
|
||||
s_renderCtx.setDebugWireframe(wireframe);
|
||||
|
||||
uint16_t materialIdx = invalidHandle;
|
||||
uint16_t programIdx = invalidHandle;
|
||||
SortKey key;
|
||||
uint8_t view = 0xff;
|
||||
RenderTargetHandle rt = BGFX_INVALID_HANDLE;
|
||||
|
@ -1823,7 +1823,7 @@ namespace bgfx
|
|||
currentState.m_flags = newFlags;
|
||||
|
||||
view = key.m_view;
|
||||
materialIdx = invalidHandle;
|
||||
programIdx = invalidHandle;
|
||||
|
||||
if (m_render->m_rt[view].idx != rt.idx)
|
||||
{
|
||||
|
@ -1882,51 +1882,50 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
bool materialChanged = false;
|
||||
bool programChanged = false;
|
||||
bool constantsChanged = state.m_constBegin < state.m_constEnd;
|
||||
rendererUpdateUniforms(m_render->m_constantBuffer, state.m_constBegin, state.m_constEnd);
|
||||
|
||||
if (key.m_material != materialIdx)
|
||||
if (key.m_program != programIdx)
|
||||
{
|
||||
materialIdx = key.m_material;
|
||||
programIdx = key.m_program;
|
||||
|
||||
if (invalidHandle == materialIdx)
|
||||
if (invalidHandle == programIdx)
|
||||
{
|
||||
s_renderCtx.m_currentMaterial = NULL;
|
||||
s_renderCtx.m_currentProgram = NULL;
|
||||
|
||||
deviceCtx->VSSetShader(NULL, 0, 0);
|
||||
deviceCtx->PSSetShader(NULL, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
s_renderCtx.m_currentMaterial = &material;
|
||||
Program& program = s_renderCtx.m_program[programIdx];
|
||||
s_renderCtx.m_currentProgram = &program;
|
||||
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)material.m_vsh->m_ptr, NULL, 0);
|
||||
deviceCtx->VSSetConstantBuffers(0, 1, &material.m_vsh->m_buffer);
|
||||
deviceCtx->VSSetShader( (ID3D11VertexShader*)program.m_vsh->m_ptr, NULL, 0);
|
||||
deviceCtx->VSSetConstantBuffers(0, 1, &program.m_vsh->m_buffer);
|
||||
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)material.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetConstantBuffers(0, 1, &material.m_fsh->m_buffer);
|
||||
deviceCtx->PSSetShader( (ID3D11PixelShader*)program.m_fsh->m_ptr, NULL, 0);
|
||||
deviceCtx->PSSetConstantBuffers(0, 1, &program.m_fsh->m_buffer);
|
||||
}
|
||||
|
||||
materialChanged =
|
||||
programChanged =
|
||||
constantsChanged = true;
|
||||
}
|
||||
|
||||
if (invalidHandle != materialIdx)
|
||||
if (invalidHandle != programIdx)
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
Program& program = s_renderCtx.m_program[programIdx];
|
||||
|
||||
if (constantsChanged)
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
material.m_vsh->m_constantBuffer->commit();
|
||||
material.m_fsh->m_constantBuffer->commit();
|
||||
program.m_vsh->m_constantBuffer->commit();
|
||||
program.m_fsh->m_constantBuffer->commit();
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = material.m_numPredefined; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
|
||||
{
|
||||
PredefinedUniform& predefined = material.m_predefined[ii];
|
||||
PredefinedUniform& predefined = program.m_predefined[ii];
|
||||
uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT;
|
||||
switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) )
|
||||
{
|
||||
|
@ -2049,7 +2048,7 @@ namespace bgfx
|
|||
Sampler& current = currentState.m_sampler[stage];
|
||||
if (current.m_idx != sampler.m_idx
|
||||
|| current.m_flags != sampler.m_flags
|
||||
|| materialChanged)
|
||||
|| programChanged)
|
||||
{
|
||||
if (invalidHandle != sampler.m_idx)
|
||||
{
|
||||
|
@ -2087,7 +2086,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || materialChanged)
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || programChanged)
|
||||
{
|
||||
currentState.m_vertexBuffer = state.m_vertexBuffer;
|
||||
|
||||
|
@ -2101,7 +2100,7 @@ namespace bgfx
|
|||
uint32_t stride = vertexDecl.m_stride;
|
||||
uint32_t offset = 0;
|
||||
deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
|
||||
s_renderCtx.setInputLayout(vertexDecl, s_renderCtx.m_materials[materialIdx]);
|
||||
s_renderCtx.setInputLayout(vertexDecl, s_renderCtx.m_program[programIdx]);
|
||||
|
||||
if (invalidHandle != state.m_instanceDataBuffer.idx)
|
||||
{
|
||||
|
|
|
@ -171,9 +171,9 @@ namespace bgfx
|
|||
uint8_t m_numPredefined;
|
||||
};
|
||||
|
||||
struct Material
|
||||
struct Program
|
||||
{
|
||||
Material()
|
||||
Program()
|
||||
: m_vsh(NULL)
|
||||
, m_fsh(NULL)
|
||||
{
|
||||
|
|
|
@ -725,7 +725,7 @@ namespace bgfx
|
|||
VertexBuffer m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
|
||||
Shader m_vertexShaders[BGFX_CONFIG_MAX_VERTEX_SHADERS];
|
||||
Shader m_fragmentShaders[BGFX_CONFIG_MAX_FRAGMENT_SHADERS];
|
||||
Material m_materials[BGFX_CONFIG_MAX_MATERIALS];
|
||||
Program m_program[BGFX_CONFIG_MAX_PROGRAMS];
|
||||
Texture m_textures[BGFX_CONFIG_MAX_TEXTURES];
|
||||
VertexDeclaration m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
|
||||
RenderTarget m_renderTargets[BGFX_CONFIG_MAX_RENDER_TARGETS];
|
||||
|
@ -1675,9 +1675,9 @@ namespace bgfx
|
|||
DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE) );
|
||||
DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) );
|
||||
|
||||
Material& material = s_renderCtx.m_materials[m_material.idx];
|
||||
s_renderCtx.m_device->SetVertexShader( (IDirect3DVertexShader9*)material.m_vsh->m_ptr);
|
||||
s_renderCtx.m_device->SetPixelShader( (IDirect3DPixelShader9*)material.m_fsh->m_ptr);
|
||||
Program& program = s_renderCtx.m_program[m_program.idx];
|
||||
s_renderCtx.m_device->SetVertexShader( (IDirect3DVertexShader9*)program.m_vsh->m_ptr);
|
||||
s_renderCtx.m_device->SetPixelShader( (IDirect3DPixelShader9*)program.m_fsh->m_ptr);
|
||||
|
||||
VertexBuffer& vb = s_renderCtx.m_vertexBuffers[m_vb->handle.idx];
|
||||
VertexDeclaration& vertexDecl = s_renderCtx.m_vertexDecls[m_vb->decl.idx];
|
||||
|
@ -1690,7 +1690,7 @@ namespace bgfx
|
|||
float proj[16];
|
||||
matrix_ortho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
|
||||
|
||||
PredefinedUniform& predefined = material.m_predefined[0];
|
||||
PredefinedUniform& predefined = program.m_predefined[0];
|
||||
uint8_t flags = predefined.m_type;
|
||||
s_renderCtx.setShaderConstantF(flags, predefined.m_loc, proj, 4);
|
||||
|
||||
|
@ -1808,14 +1808,14 @@ namespace bgfx
|
|||
s_renderCtx.m_fragmentShaders[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateMaterial(MaterialHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
void Context::rendererCreateProgram(ProgramHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
s_renderCtx.m_program[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
}
|
||||
|
||||
void Context::rendererDestroyMaterial(FragmentShaderHandle _handle)
|
||||
void Context::rendererDestroyProgram(FragmentShaderHandle _handle)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].destroy();
|
||||
s_renderCtx.m_program[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags)
|
||||
|
@ -1902,7 +1902,7 @@ namespace bgfx
|
|||
}
|
||||
|
||||
DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, m_render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) );
|
||||
uint16_t materialIdx = invalidHandle;
|
||||
uint16_t programIdx = invalidHandle;
|
||||
SortKey key;
|
||||
uint8_t view = 0xff;
|
||||
RenderTargetHandle rt = BGFX_INVALID_HANDLE;
|
||||
|
@ -1939,7 +1939,7 @@ namespace bgfx
|
|||
|
||||
view = key.m_view;
|
||||
|
||||
materialIdx = invalidHandle;
|
||||
programIdx = invalidHandle;
|
||||
|
||||
if (m_render->m_rt[view].idx != rt.idx)
|
||||
{
|
||||
|
@ -2088,44 +2088,43 @@ namespace bgfx
|
|||
primNumVerts = s_primNumVerts[primIndex];
|
||||
}
|
||||
|
||||
bool materialChanged = false;
|
||||
bool programChanged = false;
|
||||
bool constantsChanged = state.m_constBegin < state.m_constEnd;
|
||||
rendererUpdateUniforms(m_render->m_constantBuffer, state.m_constBegin, state.m_constEnd);
|
||||
|
||||
if (key.m_material != materialIdx)
|
||||
if (key.m_program != programIdx)
|
||||
{
|
||||
materialIdx = key.m_material;
|
||||
programIdx = key.m_program;
|
||||
|
||||
if (invalidHandle == materialIdx)
|
||||
if (invalidHandle == programIdx)
|
||||
{
|
||||
device->SetVertexShader(NULL);
|
||||
device->SetPixelShader(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
device->SetVertexShader( (IDirect3DVertexShader9*)material.m_vsh->m_ptr);
|
||||
device->SetPixelShader( (IDirect3DPixelShader9*)material.m_fsh->m_ptr);
|
||||
Program& program = s_renderCtx.m_program[programIdx];
|
||||
device->SetVertexShader( (IDirect3DVertexShader9*)program.m_vsh->m_ptr);
|
||||
device->SetPixelShader( (IDirect3DPixelShader9*)program.m_fsh->m_ptr);
|
||||
}
|
||||
|
||||
materialChanged =
|
||||
programChanged =
|
||||
constantsChanged = true;
|
||||
}
|
||||
|
||||
if (invalidHandle != materialIdx)
|
||||
if (invalidHandle != programIdx)
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
Program& program = s_renderCtx.m_program[programIdx];
|
||||
|
||||
if (constantsChanged)
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
material.m_vsh->m_constantBuffer->commit();
|
||||
material.m_fsh->m_constantBuffer->commit();
|
||||
program.m_vsh->m_constantBuffer->commit();
|
||||
program.m_fsh->m_constantBuffer->commit();
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = material.m_numPredefined; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
|
||||
{
|
||||
PredefinedUniform& predefined = material.m_predefined[ii];
|
||||
PredefinedUniform& predefined = program.m_predefined[ii];
|
||||
uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT;
|
||||
switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) )
|
||||
{
|
||||
|
@ -2242,7 +2241,7 @@ namespace bgfx
|
|||
Sampler& current = currentState.m_sampler[stage];
|
||||
if (current.m_idx != sampler.m_idx
|
||||
|| current.m_flags != sampler.m_flags
|
||||
|| materialChanged)
|
||||
|| programChanged)
|
||||
{
|
||||
if (invalidHandle != sampler.m_idx)
|
||||
{
|
||||
|
@ -2272,7 +2271,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || materialChanged)
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || programChanged)
|
||||
{
|
||||
currentState.m_vertexBuffer = state.m_vertexBuffer;
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ namespace bgfx
|
|||
uint8_t m_numPredefined;
|
||||
};
|
||||
|
||||
struct Material
|
||||
struct Program
|
||||
{
|
||||
void create(const Shader& _vsh, const Shader& _fsh)
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace bgfx
|
|||
BGFX_FATAL(display, Fatal::OPENGL_UnableToCreateContext, "Failed to open X display (0).");
|
||||
|
||||
int glxMajor, glxMinor;
|
||||
if (!glXQueryVersion(display, &glxMajor, &glxMinor))
|
||||
if (!glXQueryVersion(display, &glxMajor, &glxMinor) )
|
||||
{
|
||||
BGFX_FATAL(false, Fatal::OPENGL_UnableToCreateContext, "Failed to query GLX version");
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ namespace bgfx
|
|||
VertexBuffer m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
|
||||
Shader m_vertexShaders[BGFX_CONFIG_MAX_VERTEX_SHADERS];
|
||||
Shader m_fragmentShaders[BGFX_CONFIG_MAX_FRAGMENT_SHADERS];
|
||||
Material m_materials[BGFX_CONFIG_MAX_MATERIALS];
|
||||
Program m_program[BGFX_CONFIG_MAX_PROGRAMS];
|
||||
Texture m_textures[BGFX_CONFIG_MAX_TEXTURES];
|
||||
VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
|
||||
RenderTarget m_renderTargets[BGFX_CONFIG_MAX_RENDER_TARGETS];
|
||||
|
@ -837,10 +837,10 @@ namespace bgfx
|
|||
return ConstantType::End;
|
||||
}
|
||||
|
||||
void Material::create(const Shader& _vsh, const Shader& _fsh)
|
||||
void Program::create(const Shader& _vsh, const Shader& _fsh)
|
||||
{
|
||||
m_id = glCreateProgram();
|
||||
BX_TRACE("material create: %d: %d, %d", m_id, _vsh.m_id, _fsh.m_id);
|
||||
BX_TRACE("program create: %d: %d, %d", m_id, _vsh.m_id, _fsh.m_id);
|
||||
|
||||
bool cached = false;
|
||||
|
||||
|
@ -916,13 +916,13 @@ namespace bgfx
|
|||
init();
|
||||
}
|
||||
|
||||
void Material::destroy()
|
||||
void Program::destroy()
|
||||
{
|
||||
GL_CHECK(glUseProgram(0) );
|
||||
GL_CHECK(glDeleteProgram(m_id) );
|
||||
}
|
||||
|
||||
void Material::init()
|
||||
void Program::init()
|
||||
{
|
||||
GLint activeAttribs;
|
||||
GLint activeUniforms;
|
||||
|
@ -1048,7 +1048,7 @@ namespace bgfx
|
|||
m_instanceData[used] = 0xffff;
|
||||
}
|
||||
|
||||
void Material::bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex) const
|
||||
void Program::bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex) const
|
||||
{
|
||||
uint32_t enabled = 0;
|
||||
for (uint32_t ii = 0; Attrib::Count != m_used[ii]; ++ii)
|
||||
|
@ -1102,7 +1102,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
void Material::bindInstanceData(uint32_t _stride, uint32_t _baseVertex) const
|
||||
void Program::bindInstanceData(uint32_t _stride, uint32_t _baseVertex) const
|
||||
{
|
||||
uint32_t baseVertex = _baseVertex;
|
||||
for (uint32_t ii = 0; 0xffff != m_instanceData[ii]; ++ii)
|
||||
|
@ -1698,14 +1698,14 @@ namespace bgfx
|
|||
GL_CHECK(glDisable(GL_ALPHA_TEST) );
|
||||
#endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||
|
||||
Material& material = s_renderCtx.m_materials[m_material.idx];
|
||||
GL_CHECK(glUseProgram(material.m_id) );
|
||||
GL_CHECK(glUniform1i(material.m_sampler[0], 0) );
|
||||
Program& program = s_renderCtx.m_program[m_program.idx];
|
||||
GL_CHECK(glUseProgram(program.m_id) );
|
||||
GL_CHECK(glUniform1i(program.m_sampler[0], 0) );
|
||||
|
||||
float proj[16];
|
||||
matrix_ortho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
|
||||
|
||||
GL_CHECK(glUniformMatrix4fv(material.m_predefined[0].m_loc
|
||||
GL_CHECK(glUniformMatrix4fv(program.m_predefined[0].m_loc
|
||||
, 1
|
||||
, GL_FALSE
|
||||
, proj
|
||||
|
@ -1727,8 +1727,8 @@ namespace bgfx
|
|||
IndexBuffer& ib = s_renderCtx.m_indexBuffers[m_ib->handle.idx];
|
||||
GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
|
||||
|
||||
Material& material = s_renderCtx.m_materials[m_material.idx];
|
||||
material.bindAttributes(m_decl, 0);
|
||||
Program& program = s_renderCtx.m_program[m_program.idx];
|
||||
program.bindAttributes(m_decl, 0);
|
||||
|
||||
GL_CHECK(glDrawElements(GL_TRIANGLES
|
||||
, _numIndices
|
||||
|
@ -1931,14 +1931,14 @@ namespace bgfx
|
|||
s_renderCtx.m_fragmentShaders[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateMaterial(MaterialHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
void Context::rendererCreateProgram(ProgramHandle _handle, VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
s_renderCtx.m_program[_handle.idx].create(s_renderCtx.m_vertexShaders[_vsh.idx], s_renderCtx.m_fragmentShaders[_fsh.idx]);
|
||||
}
|
||||
|
||||
void Context::rendererDestroyMaterial(FragmentShaderHandle _handle)
|
||||
void Context::rendererDestroyProgram(FragmentShaderHandle _handle)
|
||||
{
|
||||
s_renderCtx.m_materials[_handle.idx].destroy();
|
||||
s_renderCtx.m_program[_handle.idx].destroy();
|
||||
}
|
||||
|
||||
void Context::rendererCreateTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags)
|
||||
|
@ -2026,7 +2026,7 @@ namespace bgfx
|
|||
matrix_mul(viewProj[ii].val, m_render->m_view[ii].val, m_render->m_proj[ii].val);
|
||||
}
|
||||
|
||||
uint16_t materialIdx = invalidHandle;
|
||||
uint16_t programIdx = invalidHandle;
|
||||
SortKey key;
|
||||
uint8_t view = 0xff;
|
||||
RenderTargetHandle rt = BGFX_INVALID_HANDLE;
|
||||
|
@ -2063,7 +2063,7 @@ namespace bgfx
|
|||
GREMEDY_SETMARKER("view");
|
||||
|
||||
view = key.m_view;
|
||||
materialIdx = invalidHandle;
|
||||
programIdx = invalidHandle;
|
||||
|
||||
if (m_render->m_rt[view].idx != rt.idx)
|
||||
{
|
||||
|
@ -2227,33 +2227,33 @@ namespace bgfx
|
|||
primNumVerts = s_primNumVerts[primIndex];
|
||||
}
|
||||
|
||||
bool materialChanged = false;
|
||||
bool programChanged = false;
|
||||
bool constantsChanged = state.m_constBegin < state.m_constEnd;
|
||||
bool bindAttribs = false;
|
||||
rendererUpdateUniforms(m_render->m_constantBuffer, state.m_constBegin, state.m_constEnd);
|
||||
|
||||
if (key.m_material != materialIdx)
|
||||
if (key.m_program != programIdx)
|
||||
{
|
||||
materialIdx = key.m_material;
|
||||
GLuint id = invalidHandle == materialIdx ? 0 : s_renderCtx.m_materials[materialIdx].m_id;
|
||||
programIdx = key.m_program;
|
||||
GLuint id = invalidHandle == programIdx ? 0 : s_renderCtx.m_program[programIdx].m_id;
|
||||
GL_CHECK(glUseProgram(id) );
|
||||
materialChanged =
|
||||
programChanged =
|
||||
constantsChanged =
|
||||
bindAttribs = true;
|
||||
}
|
||||
|
||||
if (invalidHandle != materialIdx)
|
||||
if (invalidHandle != programIdx)
|
||||
{
|
||||
Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
Program& program = s_renderCtx.m_program[programIdx];
|
||||
|
||||
if (constantsChanged)
|
||||
{
|
||||
material.m_constantBuffer->commit();
|
||||
program.m_constantBuffer->commit();
|
||||
}
|
||||
|
||||
for (uint32_t ii = 0, num = material.m_numPredefined; ii < num; ++ii)
|
||||
for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
|
||||
{
|
||||
PredefinedUniform& predefined = material.m_predefined[ii];
|
||||
PredefinedUniform& predefined = program.m_predefined[ii];
|
||||
switch (predefined.m_type)
|
||||
{
|
||||
case PredefinedUniform::ViewRect:
|
||||
|
@ -2398,7 +2398,7 @@ namespace bgfx
|
|||
Sampler& current = currentState.m_sampler[stage];
|
||||
if (current.m_idx != sampler.m_idx
|
||||
|| current.m_flags != sampler.m_flags
|
||||
|| materialChanged)
|
||||
|| programChanged)
|
||||
{
|
||||
if (invalidHandle != sampler.m_idx)
|
||||
{
|
||||
|
@ -2434,7 +2434,7 @@ namespace bgfx
|
|||
}
|
||||
}
|
||||
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || materialChanged)
|
||||
if (currentState.m_vertexBuffer.idx != state.m_vertexBuffer.idx || programChanged)
|
||||
{
|
||||
currentState.m_vertexBuffer = state.m_vertexBuffer;
|
||||
|
||||
|
@ -2475,13 +2475,13 @@ namespace bgfx
|
|||
baseVertex = state.m_startVertex;
|
||||
VertexBuffer& vb = s_renderCtx.m_vertexBuffers[state.m_vertexBuffer.idx];
|
||||
uint16_t decl = vb.m_decl.idx == invalidHandle ? state.m_vertexDecl.idx : vb.m_decl.idx;
|
||||
const Material& material = s_renderCtx.m_materials[materialIdx];
|
||||
material.bindAttributes(s_renderCtx.m_vertexDecls[decl], state.m_startVertex);
|
||||
const Program& program = s_renderCtx.m_program[programIdx];
|
||||
program.bindAttributes(s_renderCtx.m_vertexDecls[decl], state.m_startVertex);
|
||||
|
||||
if (invalidHandle != state.m_instanceDataBuffer.idx)
|
||||
{
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, s_renderCtx.m_vertexBuffers[state.m_instanceDataBuffer.idx].m_id) );
|
||||
material.bindInstanceData(state.m_instanceDataStride, state.m_instanceDataOffset);
|
||||
program.bindInstanceData(state.m_instanceDataStride, state.m_instanceDataOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ namespace bgfx
|
|||
GLuint m_rbo;
|
||||
};
|
||||
|
||||
struct Material
|
||||
struct Program
|
||||
{
|
||||
void create(const Shader& _vsh, const Shader& _fsh);
|
||||
void destroy();
|
||||
|
|
|
@ -97,11 +97,11 @@ namespace bgfx
|
|||
{
|
||||
}
|
||||
|
||||
void Context::rendererCreateMaterial(MaterialHandle /*_handle*/, VertexShaderHandle /*_vsh*/, FragmentShaderHandle /*_fsh*/)
|
||||
void Context::rendererCreateProgram(ProgramHandle /*_handle*/, VertexShaderHandle /*_vsh*/, FragmentShaderHandle /*_fsh*/)
|
||||
{
|
||||
}
|
||||
|
||||
void Context::rendererDestroyMaterial(FragmentShaderHandle /*_handle*/)
|
||||
void Context::rendererDestroyProgram(FragmentShaderHandle /*_handle*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
10
src/varying.def.sc
Normal file
10
src/varying.def.sc
Normal file
|
@ -0,0 +1,10 @@
|
|||
vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
vec4 v_color1 : COLOR1 = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
|
||||
vec3 v_normal : TEXCOORD1 = vec3(0.0, 1.0, 0.0);
|
||||
|
||||
vec3 a_position : POSITION;
|
||||
vec3 a_normal : NORMAL0;
|
||||
vec4 a_color : COLOR0;
|
||||
vec4 a_color1 : COLOR1;
|
||||
vec2 a_texcoord0 : TEXCOORD0;
|
15
src/vs_clear.sc
Normal file
15
src/vs_clear.sc
Normal file
|
@ -0,0 +1,15 @@
|
|||
$input a_position, a_color
|
||||
$output v_color0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(a_position, 1.0);
|
||||
v_color0 = a_color;
|
||||
}
|
17
src/vs_debugfont.sc
Normal file
17
src/vs_debugfont.sc
Normal file
|
@ -0,0 +1,17 @@
|
|||
$input a_position, a_color, a_color1, a_texcoord0
|
||||
$output v_color0, v_color1, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
|
||||
v_texcoord0 = a_texcoord0;
|
||||
v_color0 = a_color;
|
||||
v_color1 = a_color1;
|
||||
}
|
|
@ -1,180 +1,96 @@
|
|||
static const uint8_t vs_debugfont_dx11[2823] =
|
||||
static const uint8_t vs_debugfont_dx11[1475] =
|
||||
{
|
||||
0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................
|
||||
0xc0, 0x0a, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // ...u_modelViewPr
|
||||
0x6f, 0x6a, 0x09, 0x00, 0x00, 0x0a, 0x40, 0x00, 0xdc, 0x0a, 0x44, 0x58, 0x42, 0x43, 0x49, 0xc3, // oj....@...DXBCI.
|
||||
0x37, 0x49, 0xa7, 0x55, 0xe6, 0x4d, 0x05, 0x66, 0x2d, 0x74, 0x33, 0xa1, 0xec, 0xf1, 0x01, 0x00, // 7I.U.M.f-t3.....
|
||||
0x00, 0x00, 0xdc, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xcc, 0x07, // ..........4.....
|
||||
0x00, 0x00, 0x54, 0x08, 0x00, 0x00, 0xe0, 0x08, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, 0x52, 0x44, // ..T.......@...RD
|
||||
0x45, 0x46, 0x90, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, // EF........h.....
|
||||
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xfe, 0xff, 0x00, 0x91, 0x00, 0x00, 0x5d, 0x07, // ..<...........].
|
||||
0xc0, 0x01, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // ...u_modelViewPr
|
||||
0x6f, 0x6a, 0x09, 0x00, 0x00, 0x01, 0x40, 0x00, 0x98, 0x05, 0x44, 0x58, 0x42, 0x43, 0x46, 0xbf, // oj....@...DXBCF.
|
||||
0xfc, 0xa7, 0xce, 0x2a, 0xea, 0x90, 0xbc, 0x31, 0x32, 0x0a, 0x66, 0x1f, 0xa2, 0x34, 0x01, 0x00, // ...*...12.f..4..
|
||||
0x00, 0x00, 0x98, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x88, 0x02, // ..........4.....
|
||||
0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x9c, 0x03, 0x00, 0x00, 0xfc, 0x04, 0x00, 0x00, 0x52, 0x44, // ..............RD
|
||||
0x45, 0x46, 0x4c, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, // EFL.......h.....
|
||||
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xfe, 0xff, 0x00, 0x91, 0x00, 0x00, 0x18, 0x02, // ..<.............
|
||||
0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, // ..RD11<....... .
|
||||
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..(...$.........
|
||||
0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x73, 0x00, 0xab, 0xab, 0xab, 0x5c, 0x00, // ..$Globals......
|
||||
0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x0a, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x18, 0x05, // ................
|
||||
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, // ................
|
||||
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, // ..............@.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x01, // ................
|
||||
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, // ..@...@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x31, 0x05, // ..............1.
|
||||
0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, // ..............@.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xdf, 0x01, // ................
|
||||
0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, // ......@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x05, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, // ......=.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x44, 0x05, // ..............D.
|
||||
0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x04, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, // ..............@.
|
||||
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x01, // ................
|
||||
0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, // ..@...@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x05, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, // ......O.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ......`.........
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x84, 0x05, // ................
|
||||
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x05, // .. .............
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x05, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........0.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x05, // ................
|
||||
0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ..@.............
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........P.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0x06, // ................
|
||||
0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ..`.............
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x06, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........p.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x06, // ................
|
||||
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x06, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x10, 0x00, // ......>.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x49, 0x06, // ..............I.
|
||||
0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x53, 0x06, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x10, 0x00, // ......S.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x06, // ..............^.
|
||||
0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x06, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x10, 0x00, // ......j.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x78, 0x06, // ..............x.
|
||||
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x85, 0x06, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x93, 0x06, // ................
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, // ......@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x06, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x80, 0x00, // ..........@.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x06, // ................
|
||||
0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x24, 0x07, 0x00, 0x00, 0xc0, 0x09, 0x00, 0x00, 0x40, 0x00, // ......$.......@.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x07, // ..............0.
|
||||
0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x06, // ......@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x40, 0x07, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, 0x40, 0x00, // ......@...@...@.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x51, 0x07, // ..............Q.
|
||||
0x00, 0x00, 0x80, 0x0a, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x06, // ......@.........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef
|
||||
0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0xab, 0xab, 0xab, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, // .float..........
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x04, 0x00, 0x00, 0x75, 0x5f, // ..............u_
|
||||
0x74, 0x69, 0x6d, 0x65, 0x00, 0x75, 0x5f, 0x72, 0x67, 0x62, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, // time.u_rgbdispla
|
||||
0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x61, // cement.u_interla
|
||||
0x63, 0x65, 0x00, 0x75, 0x5f, 0x7a, 0x6f, 0x6f, 0x6d, 0x00, 0x75, 0x5f, 0x73, 0x74, 0x72, 0x65, // ce.u_zoom.u_stre
|
||||
0x6e, 0x67, 0x74, 0x68, 0x00, 0x75, 0x5f, 0x63, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x00, 0x66, 0x6c, // ngth.u_center.fl
|
||||
0x6f, 0x61, 0x74, 0x32, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, // oat2............
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x05, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x65, 0x73, 0x68, // ......X...u_mesh
|
||||
0x54, 0x69, 0x6c, 0x65, 0x55, 0x56, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x00, 0x01, 0x00, // TileUV.float3...
|
||||
0x03, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x05, // ................
|
||||
0x00, 0x00, 0x75, 0x5f, 0x6d, 0x61, 0x74, 0x44, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x00, 0x66, // ..u_matDiffuse.f
|
||||
0x6c, 0x6f, 0x61, 0x74, 0x34, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, // loat4...........
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc9, 0x05, 0x00, 0x00, 0x75, 0x5f, 0x68, 0x69, 0x67, 0x68, // ..........u_high
|
||||
0x6c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, // lightColor.u_lig
|
||||
0x68, 0x74, 0x44, 0x69, 0x72, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x41, 0x6d, 0x62, // htDir.u_lightAmb
|
||||
0x69, 0x65, 0x6e, 0x74, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, 0x66, 0x66, // ient.u_lightDiff
|
||||
0x75, 0x73, 0x65, 0x00, 0x75, 0x5f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x53, 0x70, 0x65, 0x63, 0x75, // use.u_lightSpecu
|
||||
0x6c, 0x61, 0x72, 0x00, 0x75, 0x5f, 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x75, // lar.u_fogColor.u
|
||||
0x5f, 0x66, 0x6f, 0x67, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // _fogArgs.u_viewR
|
||||
0x65, 0x63, 0x74, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ect.u_viewTexel.
|
||||
0x75, 0x5f, 0x73, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x75, 0x5f, // u_shadowColor.u_
|
||||
0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x63, 0x6f, 0x6e, // filterArgs.u_con
|
||||
0x74, 0x6f, 0x75, 0x72, 0x41, 0x72, 0x67, 0x73, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // tourArgs.u_view.
|
||||
0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, // float4x4........
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x75, 0x5f, // ..............u_
|
||||
0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, // viewProj........
|
||||
0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x75, 0x5f, // ..............u_
|
||||
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x00, // model......... .
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode
|
||||
0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // lView.u_modelVie
|
||||
0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // wProj.u_modelVie
|
||||
0x77, 0x50, 0x72, 0x6f, 0x6a, 0x58, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // wProjX.u_viewPro
|
||||
0x6a, 0x58, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, // jX.Microsoft (R)
|
||||
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, // HLSL Shader Com
|
||||
0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, // piler 9.29.952.3
|
||||
0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, // 111...ISGN......
|
||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......h.........
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x71, 0x00, // ..............q.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................
|
||||
0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......q.........
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x77, 0x00, // ..............w.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, // ................
|
||||
0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, // ......POSITION.C
|
||||
0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, // OLOR.TEXCOORD.OS
|
||||
0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, // GN............h.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......t.........
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, // ..............t.
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................
|
||||
0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......z.........
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, // ..............SV
|
||||
0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, // _POSITION.COLOR.
|
||||
0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x45, 0x58, 0x58, 0x01, // TEXCOORD..SHEXX.
|
||||
0x00, 0x00, 0x50, 0x00, 0x01, 0x00, 0x56, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, // ..P...V...j...Y.
|
||||
0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x5f, 0x00, // ..F. ........._.
|
||||
0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, // ..r......._.....
|
||||
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, // ......_.........
|
||||
0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x67, 0x00, // .._...2.......g.
|
||||
0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, // ... ..........e.
|
||||
0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ... ......e....
|
||||
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, // ......e...2 ....
|
||||
0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..h.......8.....
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......V.......F.
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, // .........2.....
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, // ......F. .......
|
||||
0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F.....
|
||||
0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ..2...........F.
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x00, 0x00, // ...............
|
||||
0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, // ..F............
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......F.......F.
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, // .........6....
|
||||
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6.
|
||||
0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x02, 0x00, // ... ......F.....
|
||||
0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x10, // ..6...2 ......F.
|
||||
0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, // ......>...STAT..
|
||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // ................
|
||||
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x40, 0x00, // ..............@.
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, // ................
|
||||
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_
|
||||
0x76, 0x69, 0x65, 0x77, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x00, 0x03, 0x00, // view.float4x4...
|
||||
0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x01, // ................
|
||||
0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x6d, // ..u_viewProj.u_m
|
||||
0x6f, 0x64, 0x65, 0x6c, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // odel.u_modelView
|
||||
0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj
|
||||
0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj
|
||||
0x58, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x58, 0x00, 0x4d, 0x69, // X.u_viewProjX.Mi
|
||||
0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, // crosoft (R) HLSL
|
||||
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, // Shader Compiler
|
||||
0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, // 9.29.952.3111..
|
||||
0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, // ..ISGN..........
|
||||
0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..h.............
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........q.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, // ................
|
||||
0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..q.............
|
||||
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........w.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, // ................
|
||||
0x00, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, // ..POSITION.COLOR
|
||||
0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x84, 0x00, // .TEXCOORD.OSGN..
|
||||
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........h.....
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................
|
||||
0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..t.............
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........t.....
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................
|
||||
0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ..z.............
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, // ..........SV_POS
|
||||
0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, // ITION.COLOR.TEXC
|
||||
0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x45, 0x58, 0x58, 0x01, 0x00, 0x00, 0x50, 0x00, // OORD..SHEXX...P.
|
||||
0x01, 0x00, 0x56, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..V...j...Y...F.
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, // ........._...r.
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, // ......_.........
|
||||
0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5f, 0x00, // .._..........._.
|
||||
0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, // ..2.......g....
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..........e....
|
||||
0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, // ......e.... ....
|
||||
0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e...2 ......h.
|
||||
0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8.........
|
||||
0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..V.......F. ...
|
||||
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2.........
|
||||
0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x10, // ..F. ...........
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2.
|
||||
0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ...
|
||||
0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F.
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ........... ....
|
||||
0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ...
|
||||
0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, // ......6.... ....
|
||||
0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, // ..F.......6....
|
||||
0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6.
|
||||
0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, // ..2 ......F.....
|
||||
0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x08, 0x00, // ..>...STAT......
|
||||
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .......
|
||||
0x00, 0x00, 0x00, // ...
|
||||
};
|
||||
|
|
BIN
tools/bin/shaderc.exe
Normal file
BIN
tools/bin/shaderc.exe
Normal file
Binary file not shown.
Loading…
Reference in a new issue