Working on model loading and added poker table
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
build/*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
|
@ -81,10 +81,17 @@ typedef struct {
|
||||
tileset_t *kagamiTileset;
|
||||
primitive_t *kagamiQuad;
|
||||
|
||||
primitive_t *tablePrimitive;
|
||||
texture_t *tableTexture;
|
||||
|
||||
texture_t *cardTexture;
|
||||
tileset_t *cardTileset;
|
||||
primitive_t *cardPrimitive;
|
||||
|
||||
texture_t *fontTexture;
|
||||
tileset_t *fontTileset;
|
||||
spritebatch_t *fontBatch;
|
||||
|
||||
/** Game Render Frames */
|
||||
framebuffer_t *frameLeft;
|
||||
framebuffer_t *frameRight;
|
||||
|
@ -16,6 +16,10 @@
|
||||
#include "display/texture.h"
|
||||
#include "display/tileset.h"
|
||||
|
||||
#include "display/debug/position.h"
|
||||
|
||||
#include "display/gui/font.h"
|
||||
|
||||
// File / Asset Management
|
||||
#include "file/asset.h"
|
||||
|
||||
|
27
include/dawn/display/debug/position.h
Normal file
27
include/dawn/display/debug/position.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../primitive.h"
|
||||
#include "../texture.h"
|
||||
#include "../tileset.h"
|
||||
|
||||
#define POSITION_DEBUG_FONT_CHARS_MAX 256
|
||||
|
||||
/** Struct representing a positionable object in space */
|
||||
typedef struct {
|
||||
primitive_t *primitive;
|
||||
|
||||
spritebatch_t *textBatch;
|
||||
texture_t *textTexture;
|
||||
tileset_t *textTileset;
|
||||
|
||||
float x, y, z;
|
||||
float pitch, yaw, roll;
|
||||
float scaleX, scaleY, scaleZ;
|
||||
} positiondebug_t;
|
25
include/dawn/display/gui/font.h
Normal file
25
include/dawn/display/gui/font.h
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
|
||||
/** Which is the first character within the font tilemap */
|
||||
#define FONT_CHAR_START 33
|
||||
|
||||
/** Center a font along the X axis */
|
||||
#define FONT_CENTER_X 9876543
|
||||
/** Center a font along the Y axis */
|
||||
#define FONT_CENTER_Y -FONT_CENTER_X
|
||||
|
||||
/** Align right edge of font to origin */
|
||||
#define FONT_RIGHT_X (FONT_CENTER_X-1)
|
||||
|
||||
typedef struct {
|
||||
float width, height;
|
||||
int32_t lines;
|
||||
} fontmeasure_t;
|
@ -8,14 +8,26 @@
|
||||
#include "../util/list.h"
|
||||
|
||||
|
||||
/** Inputs */
|
||||
#define INPUT_UP (inputbind_t)0x01
|
||||
#define INPUT_DOWN (inputbind_t)0x02
|
||||
#define INPUT_LEFT (inputbind_t)0x03
|
||||
#define INPUT_RIGHT (inputbind_t)0x04
|
||||
/** Debug Inputs */
|
||||
#define INPUT_NULL (inputbind_t)0x00
|
||||
#define INPUT_DEBUG_UP (inputbind_t)0x01
|
||||
#define INPUT_DEBUG_DOWN (inputbind_t)0x02
|
||||
#define INPUT_DEBUG_LEFT (inputbind_t)0x03
|
||||
#define INPUT_DEBUG_RIGHT (inputbind_t)0x04
|
||||
#define INPUT_DEBUG_RAISE (inputbind_t)0x05
|
||||
#define INPUT_DEBUG_LOWER (inputbind_t)0x06
|
||||
#define INPUT_DEBUG_FINE (inputbind_t)0x07
|
||||
#define INPUT_DEBUG_PLUS (inputbind_t)0x08
|
||||
#define INPUT_DEBUG_MINUS (inputbind_t)0x09
|
||||
|
||||
#define INPUT_NULL (inputbind_t)0x00
|
||||
#define INPUT_BIND_COUNT 128
|
||||
/** Real Inputs (Starts at 128/0x80) */
|
||||
#define INPUT_UP (inputbind_t)0x80
|
||||
#define INPUT_DOWN (inputbind_t)0x81
|
||||
#define INPUT_LEFT (inputbind_t)0x82
|
||||
#define INPUT_RIGHT (inputbind_t)0x83
|
||||
|
||||
|
||||
#define INPUT_BIND_COUNT 0xFF
|
||||
#define INPUT_SOURCE_COUNT 4096
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,19 @@ void holdemGameInit() {
|
||||
HOLDEM_GAME_STATE.quadLeft = quadCreate(0, 0, 0, 0, 0, lWidth, height, 1, 1);
|
||||
HOLDEM_GAME_STATE.quadRight = quadCreate(0, 0, 0, 0, 0, rWidth, height, 1, 1);
|
||||
|
||||
// Font
|
||||
HOLDEM_GAME_STATE.fontTexture = assetTextureLoad("font.png");
|
||||
HOLDEM_GAME_STATE.fontTileset = tilesetCreate(20, 20,
|
||||
HOLDEM_GAME_STATE.fontTexture->width,
|
||||
HOLDEM_GAME_STATE.fontTexture->height,
|
||||
1, 1, 1, 1
|
||||
);
|
||||
HOLDEM_GAME_STATE.fontBatch = spriteBatchCreate(1024);
|
||||
|
||||
// Poker Table
|
||||
HOLDEM_GAME_STATE.tablePrimitive = pokerTableCreate();
|
||||
HOLDEM_GAME_STATE.tableTexture = assetTextureLoad("pokertable.png");
|
||||
|
||||
// Kagami
|
||||
HOLDEM_GAME_STATE.kagamiTexture = assetTextureLoad("kagami.png");
|
||||
HOLDEM_GAME_STATE.kagamiTileset = tilesetCreate(3, 2,
|
||||
@ -54,15 +67,23 @@ void holdemGameInit() {
|
||||
|
||||
// Prepare match
|
||||
holdemMatchInit(&HOLDEM_GAME_STATE.match);
|
||||
holdemRoundInit(&HOLDEM_GAME_STATE.match);
|
||||
cardShuffle(HOLDEM_GAME_STATE.match.deck, HOLDEM_GAME_STATE.match.deckSize);
|
||||
holdemFlop(&HOLDEM_GAME_STATE.match);
|
||||
}
|
||||
|
||||
void holdemGameUpdate() {
|
||||
int32_t lWidth, rWidth, height;
|
||||
|
||||
TIME_STATE.current;
|
||||
|
||||
// Resize Frame buffers.
|
||||
lWidth = HOLDEM_GAME_FRAME_LEFT_WIDTH, rWidth = HOLDEM_GAME_FRAME_RIGHT_WIDTH;
|
||||
height = HOLDEM_GAME_FRAME_HEIGHT;
|
||||
if(HOLDEM_GAME_STATE.frameLeft->texture->width != lWidth) {
|
||||
if(
|
||||
HOLDEM_GAME_STATE.frameLeft->texture->width != lWidth ||
|
||||
HOLDEM_GAME_STATE.frameLeft->texture->height != height
|
||||
) {
|
||||
frameBufferDispose(HOLDEM_GAME_STATE.frameLeft);
|
||||
frameBufferDispose(HOLDEM_GAME_STATE.frameRight);
|
||||
HOLDEM_GAME_STATE.frameLeft = frameBufferCreate(lWidth, height);
|
||||
|
@ -9,7 +9,9 @@
|
||||
#include <dawn/dawn.h>
|
||||
#include "holdem.h"
|
||||
#include "render/holdemrender.h"
|
||||
#include "../card.h"
|
||||
#include "../../display/framebuffer.h"
|
||||
#include "../../display/debug/position.h"
|
||||
#include "../../display/primitive.h"
|
||||
#include "../../display/shader.h"
|
||||
#include "../../display/camera.h"
|
||||
@ -17,6 +19,8 @@
|
||||
#include "../../display/tileset.h"
|
||||
#include "../../display/primitives/quad.h"
|
||||
#include "../../file/asset.h"
|
||||
#include "../../display/gui/font.h"
|
||||
#include "model/pokertable.h"
|
||||
|
||||
|
||||
void holdemGameInit();
|
||||
|
697
src/card/poker/model/pokertable.c
Normal file
697
src/card/poker/model/pokertable.c
Normal file
@ -0,0 +1,697 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokertable.h"
|
||||
|
||||
primitive_t * pokerTableCreate() {
|
||||
vertice_t vertices[POKER_TABLE_VERTICE_COUNT] = {
|
||||
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.836914, .v = 0.265625 },
|
||||
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.853516, .v = 0.06445299999999998 },
|
||||
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.836914, .v = 0.06445299999999998 },
|
||||
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.426758, .v = 0.009766000000000052 },
|
||||
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.411133, .v = 0.18261700000000003 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.426758, .v = 0.18261700000000003 },
|
||||
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.9375, .v = 0.43359400000000003 },
|
||||
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.952148, .v = 0.23828099999999997 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.9375, .v = 0.23828099999999997 },
|
||||
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.920898, .v = 1 },
|
||||
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.936523, .v = 0.800781 },
|
||||
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.920898, .v = 0.800781 },
|
||||
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.473633, .v = 0.23828099999999997 },
|
||||
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.489258, .v = 0.03808599999999995 },
|
||||
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.473633, .v = 0.03808599999999995 },
|
||||
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.984375, .v = 0.765625 },
|
||||
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0.96875, .v = 0.592773 },
|
||||
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0.96875, .v = 0.765625 },
|
||||
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.914062, .v = 0.030272999999999994 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.928711, .v = 0.22558599999999995 },
|
||||
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.928711, .v = 0.030272999999999994 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.936523, .v = 0.592773 },
|
||||
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.920898, .v = 0.791992 },
|
||||
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.936523, .v = 0.791992 },
|
||||
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.914062, .v = 0.233398 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.929688, .v = 0.43359400000000003 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.929688, .v = 0.233398 },
|
||||
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.960938, .v = 0.592773 },
|
||||
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0.944336, .v = 0.765625 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.960938, .v = 0.765625 },
|
||||
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.615234, .v = 0.23828099999999997 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.630859, .v = 0.042969000000000035 },
|
||||
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.615234, .v = 0.042969000000000035 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.861328, .v = 0.264648 },
|
||||
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.876953, .v = 0.06445299999999998 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.861328, .v = 0.06445299999999998 },
|
||||
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.544922, .v = 0.03808599999999995 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0.560547, .v = 0.23828099999999997 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.560547, .v = 0.03808599999999995 },
|
||||
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.967773, .v = 0.826172 },
|
||||
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.983398, .v = 1 },
|
||||
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.983398, .v = 0.826172 },
|
||||
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.9375, .v = 0.22949200000000003 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.953125, .v = 0.03320299999999998 },
|
||||
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.9375, .v = 0.03320299999999998 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.49707, .v = 0.23828099999999997 },
|
||||
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.512695, .v = 0.03808599999999995 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.49707, .v = 0.03808599999999995 },
|
||||
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.805664, .v = 0.06445299999999998 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0.790039, .v = 0.264648 },
|
||||
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.805664, .v = 0.264648 },
|
||||
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.43457, .v = 0.009766000000000052 },
|
||||
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.450195, .v = 0.18261700000000003 },
|
||||
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.450195, .v = 0.009766000000000052 },
|
||||
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.944336, .v = 1 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.959961, .v = 0.804688 },
|
||||
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.944336, .v = 0.804688 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.813477, .v = 0.264648 },
|
||||
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.829102, .v = 0.06445299999999998 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.813477, .v = 0.06445299999999998 },
|
||||
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.757812, .v = 0.06445299999999998 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.742188, .v = 0.263672 },
|
||||
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.757812, .v = 0.263672 },
|
||||
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.960938, .v = 0.251953 },
|
||||
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.976562, .v = 0.078125 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.960938, .v = 0.078125 },
|
||||
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.638672, .v = 0.042969000000000035 },
|
||||
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.654297, .v = 0.23828099999999997 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.654297, .v = 0.042969000000000035 },
|
||||
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.765625, .v = 0.264648 },
|
||||
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.78125, .v = 0.06445299999999998 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.765625, .v = 0.06445299999999998 },
|
||||
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.520508, .v = 0.03808599999999995 },
|
||||
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.536133, .v = 0.23828099999999997 },
|
||||
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.536133, .v = 0.03808599999999995 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.026367, .v = 0.851562 },
|
||||
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.136719, .v = 1 },
|
||||
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.146484, .v = 0.97168 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 1, .v = 0.25976600000000005 },
|
||||
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.984375, .v = 0.43359400000000003 },
|
||||
{ .x = 0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 1, .v = 0.43359400000000003 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.889648, .v = 0.22558599999999995 },
|
||||
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.905273, .v = 0.030272999999999994 },
|
||||
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.889648, .v = 0.030272999999999994 },
|
||||
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.568359, .v = 0.23828099999999997 },
|
||||
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.583984, .v = 0.03808599999999995 },
|
||||
{ .x = 0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.568359, .v = 0.03808599999999995 },
|
||||
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.889648, .v = 0.43457 },
|
||||
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.90625, .v = 0.233398 },
|
||||
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.889648, .v = 0.233398 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 0.976562, .v = 0.43359400000000003 },
|
||||
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.960938, .v = 0.25976600000000005 },
|
||||
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.960938, .v = 0.43359400000000003 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.592773, .v = 0.042969000000000035 },
|
||||
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.608398, .v = 0.23828099999999997 },
|
||||
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.608398, .v = 0.042969000000000035 },
|
||||
{ .x = 0.29349590000000003, .y = -0.0176777, .z = -0.12157000000000001, .u = 0.734375, .v = 0.06445299999999998 },
|
||||
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.717773, .v = 0.264648 },
|
||||
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.734375, .v = 0.264648 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = 0.12157000000000001, .u = 0, .v = 0.6660159999999999 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0, .v = 0.863281 },
|
||||
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.026367, .v = 0.676758 },
|
||||
{ .x = -0.29349590000000003, .y = 0.0176777, .z = -0.12156990000000001, .u = 0.136719, .v = 0.529297 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.318359, .v = 0.5566409999999999 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.328125, .v = 0.529297 },
|
||||
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.46582, .v = 0.666992 },
|
||||
{ .x = 0.10804000000000001, .y = 0.0176777, .z = -0.2608318, .u = 0.438477, .v = 0.676758 },
|
||||
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.46582, .v = 0.862305 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = 0.10804020000000002, .u = 0.318359, .v = 0.97168 },
|
||||
{ .x = 0.29349580000000003, .y = 0.0176777, .z = 0.1215701, .u = 0.328125, .v = 1 },
|
||||
{ .x = -0.10523800000000001, .y = 0, .z = 0.25406680000000004, .u = 0.40222, .v = 0.23327200000000003 },
|
||||
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.119141, .v = 0.11425799999999997 },
|
||||
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0, .v = 0.40136700000000003 },
|
||||
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.472656, .v = 0.685547 },
|
||||
{ .x = 0.114805, .y = -0.025, .z = -0.2771639, .u = 0.472656, .v = 0.8691409999999999 },
|
||||
{ .x = -0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.916016, .v = 0.685547 },
|
||||
{ .x = 0, .y = -0.025, .z = -0.05625, .u = 0.881836, .v = 0.27246099999999995 },
|
||||
{ .x = 0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.84668, .v = 0.43359400000000003 },
|
||||
{ .x = 0, .y = -0.225, .z = -0.05625, .u = 0.881836, .v = 0.43359400000000003 },
|
||||
{ .x = 0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.75293, .v = 0.27246099999999995 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0, .u = 0.717773, .v = 0.43359400000000003 },
|
||||
{ .x = 0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.75293, .v = 0.43359400000000003 },
|
||||
{ .x = 0.05625, .y = -0.025, .z = 0, .u = 0.709961, .v = 0.10351600000000005 },
|
||||
{ .x = 0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.674805, .v = 0.264648 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0, .u = 0.709961, .v = 0.264648 },
|
||||
{ .x = 0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.709961, .v = 0.27246099999999995 },
|
||||
{ .x = 0, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.43359400000000003 },
|
||||
{ .x = 0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.709961, .v = 0.43359400000000003 },
|
||||
{ .x = 0, .y = -0.025, .z = 0.05625, .u = 0.795898, .v = 0.27246099999999995 },
|
||||
{ .x = -0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.760742, .v = 0.43359400000000003 },
|
||||
{ .x = 0, .y = -0.225, .z = 0.05625, .u = 0.795898, .v = 0.43359400000000003 },
|
||||
{ .x = -0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.445312, .v = 0.19140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0, .u = 0.410156, .v = 0.35253900000000005 },
|
||||
{ .x = -0.0397748, .y = -0.225, .z = 0.0397748, .u = 0.445312, .v = 0.35253900000000005 },
|
||||
{ .x = -0.05625, .y = -0.025, .z = 0, .u = 0.838867, .v = 0.27246099999999995 },
|
||||
{ .x = -0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.803711, .v = 0.43359400000000003 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0, .u = 0.838867, .v = 0.43359400000000003 },
|
||||
{ .x = -0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.445312, .v = 0.360352 },
|
||||
{ .x = 0, .y = -0.225, .z = -0.05625, .u = 0.410156, .v = 0.5214840000000001 },
|
||||
{ .x = -0.0397748, .y = -0.225, .z = -0.0397748, .u = 0.445312, .v = 0.5214840000000001 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0.028691, .v = 0.015013999999999972 },
|
||||
{ .x = -0.1875, .y = -0.25, .z = -0.05625, .u = 0.048481, .v = 0.10509500000000005 },
|
||||
{ .x = -0.1875, .y = -0.25, .z = 0.05625, .u = 0.048481, .v = 0.015013999999999972 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.801758, .v = 0.44140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = 0.05625, .u = 0.822266, .v = 0.547852 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = 0.1875, .u = 0.822266, .v = 0.44140599999999997 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.057383, .v = 0.015013999999999972 },
|
||||
{ .x = 0.1875, .y = -0.25, .z = 0.05625, .u = 0.077172, .v = 0.10509500000000005 },
|
||||
{ .x = 0.1875, .y = -0.25, .z = -0.05625, .u = 0.077172, .v = 0.015013999999999972 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.114766, .v = 0.015013999999999972 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = 0.1875, .u = 0.134555, .v = 0.10509500000000005 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = 0.1875, .u = 0.134555, .v = 0.015013999999999972 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.086074, .v = 0.015013999999999972 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = -0.1875, .u = 0.105863, .v = 0.10509500000000005 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = -0.1875, .u = 0.105863, .v = 0.015013999999999972 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = -0.1875, .u = 0.879883, .v = 0.547852 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.858398, .v = 0.44140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.858398, .v = 0.547852 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.830078, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = -0.05625, .u = 0.850586, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.830078, .v = 0.44140599999999997 },
|
||||
{ .x = 0.1875, .y = -0.25, .z = 0.05625, .u = 0.9375, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.916016, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = 0.05625, .u = 0.9375, .v = 0.547852 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.945312, .v = 0.44140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = -0.05625, .u = 0.96582, .v = 0.547852 },
|
||||
{ .x = -0.1875, .y = -0.25, .z = -0.05625, .u = 0.96582, .v = 0.44140599999999997 },
|
||||
{ .x = -0.1875, .y = -0.25, .z = 0.05625, .u = 0.020508, .v = 0.10449200000000003 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0, .v = 0 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0, .v = 0.10449200000000003 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = 0.1875, .u = 0.793945, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.772461, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.772461, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.887695, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = -0.05625, .u = 0.908203, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = -0.1875, .u = 0.908203, .v = 0.44140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.547852 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.764648, .v = 0.44140599999999997 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = 0.05625, .u = 0.674805, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.577148, .v = 0.44238299999999997 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.1875, .u = 0.666487, .v = 0.547131 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.666992, .v = 0.24609400000000003 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.472656, .v = 0.35156200000000004 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = -0.05625, .u = 0.472656, .v = 0.44238299999999997 },
|
||||
{ .x = 0.12156990000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.853516, .v = 0.265625 },
|
||||
{ .x = 0.1052379, .y = 0, .z = -0.2540669, .u = 0.411133, .v = 0.009766000000000052 },
|
||||
{ .x = 0.12156990000000001, .y = -0.0176777, .z = -0.29349590000000003, .u = 0.952148, .v = 0.43359400000000003 },
|
||||
{ .x = 0.12437210000000001, .y = 0, .z = -0.30026090000000005, .u = 0.936523, .v = 1 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = -0.29349590000000003, .u = 0.489258, .v = 0.23828099999999997 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = -0.2608318, .u = 0.984375, .v = 0.592773 },
|
||||
{ .x = -0.114805, .y = -0.025, .z = -0.2771638, .u = 0.914062, .v = 0.22558599999999995 },
|
||||
{ .x = -0.12437210000000001, .y = 0, .z = -0.3002608, .u = 0.920898, .v = 0.592773 },
|
||||
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.914062, .v = 0.43359400000000003 },
|
||||
{ .x = -0.2540669, .y = 0, .z = -0.1052379, .u = 0.944336, .v = 0.592773 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = -0.12156990000000001, .u = 0.630859, .v = 0.23828099999999997 },
|
||||
{ .x = -0.30026090000000005, .y = 0, .z = -0.124372, .u = 0.876953, .v = 0.264648 },
|
||||
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.544922, .v = 0.23828099999999997 },
|
||||
{ .x = -0.2608318, .y = 0.0176777, .z = 0.1080401, .u = 0.967773, .v = 1 },
|
||||
{ .x = -0.29349590000000003, .y = -0.0176777, .z = 0.12157000000000001, .u = 0.953125, .v = 0.22949200000000003 },
|
||||
{ .x = -0.3002608, .y = 0, .z = 0.12437210000000001, .u = 0.512695, .v = 0.23828099999999997 },
|
||||
{ .x = -0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.790039, .v = 0.06445299999999998 },
|
||||
{ .x = -0.1080401, .y = 0.0176777, .z = 0.2608318, .u = 0.43457, .v = 0.18261700000000003 },
|
||||
{ .x = -0.12157000000000001, .y = -0.0176777, .z = 0.29349590000000003, .u = 0.959961, .v = 1 },
|
||||
{ .x = -0.1243722, .y = 0, .z = 0.3002608, .u = 0.829102, .v = 0.264648 },
|
||||
{ .x = 0.12157000000000001, .y = 0.0176777, .z = 0.29349590000000003, .u = 0.742188, .v = 0.06445299999999998 },
|
||||
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.976562, .v = 0.251953 },
|
||||
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.638672, .v = 0.23828099999999997 },
|
||||
{ .x = 0.1243722, .y = 0, .z = 0.3002608, .u = 0.78125, .v = 0.264648 },
|
||||
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.520508, .v = 0.23828099999999997 },
|
||||
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.984375, .v = 0.25976600000000005 },
|
||||
{ .x = 0.29349580000000003, .y = -0.0176777, .z = 0.1215701, .u = 0.905273, .v = 0.22558599999999995 },
|
||||
{ .x = 0.3002608, .y = 0, .z = 0.1243722, .u = 0.583984, .v = 0.23828099999999997 },
|
||||
{ .x = 0.29349590000000003, .y = 0.0176777, .z = -0.12157000000000001, .u = 0.90625, .v = 0.43457 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.976562, .v = 0.25976600000000005 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.592773, .v = 0.23828099999999997 },
|
||||
{ .x = 0.3002608, .y = 0, .z = -0.12437210000000001, .u = 0.717773, .v = 0.06445299999999998 },
|
||||
{ .x = -0.2608319, .y = 0.0176777, .z = -0.10804000000000001, .u = 0.146484, .v = 0.5566409999999999 },
|
||||
{ .x = 0.2608318, .y = 0.0176777, .z = -0.1080401, .u = 0.438477, .v = 0.851562 },
|
||||
{ .x = 0.2540669, .y = 0, .z = -0.10523800000000001, .u = 0.119141, .v = 0.520508 },
|
||||
{ .x = 0.25406680000000004, .y = 0, .z = 0.1052381, .u = 0.283203, .v = 0.520508 },
|
||||
{ .x = 0.10523800000000001, .y = 0, .z = 0.2540669, .u = 0.402344, .v = 0.40136700000000003 },
|
||||
{ .x = -0.2540669, .y = 0, .z = 0.1052379, .u = 0.283203, .v = 0.11425799999999997 },
|
||||
{ .x = -0.1052379, .y = 0, .z = -0.2540669, .u = 0, .v = 0.233398 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = -0.1148051, .u = 0.602539, .v = 0.999023 },
|
||||
{ .x = 0.2771638, .y = -0.025, .z = 0.11480520000000001, .u = 0.786133, .v = 0.999023 },
|
||||
{ .x = 0.1148051, .y = -0.025, .z = 0.2771638, .u = 0.916016, .v = 0.8691409999999999 },
|
||||
{ .x = -0.2771638, .y = -0.025, .z = 0.114805, .u = 0.786133, .v = 0.5556639999999999 },
|
||||
{ .x = -0.2771639, .y = -0.025, .z = -0.11480490000000002, .u = 0.602539, .v = 0.5556639999999999 },
|
||||
{ .x = 0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.84668, .v = 0.27246099999999995 },
|
||||
{ .x = 0.05625, .y = -0.025, .z = 0, .u = 0.717773, .v = 0.27246099999999995 },
|
||||
{ .x = 0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.674805, .v = 0.10351600000000005 },
|
||||
{ .x = 0, .y = -0.025, .z = 0.05625, .u = 0.674805, .v = 0.27246099999999995 },
|
||||
{ .x = -0.0397748, .y = -0.025, .z = 0.0397748, .u = 0.760742, .v = 0.27246099999999995 },
|
||||
{ .x = -0.05625, .y = -0.025, .z = 0, .u = 0.410156, .v = 0.19140599999999997 },
|
||||
{ .x = -0.0397748, .y = -0.025, .z = -0.0397748, .u = 0.803711, .v = 0.27246099999999995 },
|
||||
{ .x = 0, .y = -0.025, .z = -0.05625, .u = 0.410156, .v = 0.360352 },
|
||||
{ .x = -0.1875, .y = -0.225, .z = -0.05625, .u = 0.028691, .v = 0.10509500000000005 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.05625, .u = 0.801758, .v = 0.547852 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.057383, .v = 0.10509500000000005 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = 0.1875, .u = 0.114766, .v = 0.10509500000000005 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.086074, .v = 0.10509500000000005 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = -0.05625, .u = 0.879883, .v = 0.44140599999999997 },
|
||||
{ .x = 0.1875, .y = -0.25, .z = -0.05625, .u = 0.850586, .v = 0.547852 },
|
||||
{ .x = 0.1875, .y = -0.225, .z = 0.05625, .u = 0.916016, .v = 0.44140599999999997 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.945312, .v = 0.547852 },
|
||||
{ .x = -0.05625, .y = -0.25, .z = 0.05625, .u = 0.020508, .v = 0 },
|
||||
{ .x = 0.05625, .y = -0.25, .z = 0.05625, .u = 0.793945, .v = 0.44140599999999997 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.05625, .u = 0.887695, .v = 0.547852 },
|
||||
{ .x = -0.05625, .y = -0.225, .z = -0.05625, .u = 0.764648, .v = 0.547852 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.1875, .u = 0.577148, .v = 0.24609400000000003 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = 0.05625, .u = 0.577148, .v = 0.35156200000000004 },
|
||||
{ .x = 0.05625, .y = -0.225, .z = -0.1875, .u = 0.577436, .v = 0.547131 }
|
||||
};
|
||||
|
||||
indice_t indices[POKER_TABLE_INDICE_COUNT] = {
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
31,
|
||||
32,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36,
|
||||
37,
|
||||
38,
|
||||
39,
|
||||
40,
|
||||
41,
|
||||
42,
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
46,
|
||||
47,
|
||||
48,
|
||||
49,
|
||||
50,
|
||||
51,
|
||||
52,
|
||||
53,
|
||||
54,
|
||||
55,
|
||||
56,
|
||||
57,
|
||||
58,
|
||||
59,
|
||||
60,
|
||||
61,
|
||||
62,
|
||||
63,
|
||||
64,
|
||||
65,
|
||||
66,
|
||||
67,
|
||||
68,
|
||||
69,
|
||||
70,
|
||||
71,
|
||||
72,
|
||||
73,
|
||||
74,
|
||||
75,
|
||||
76,
|
||||
77,
|
||||
78,
|
||||
79,
|
||||
80,
|
||||
81,
|
||||
82,
|
||||
83,
|
||||
84,
|
||||
85,
|
||||
86,
|
||||
87,
|
||||
88,
|
||||
89,
|
||||
90,
|
||||
91,
|
||||
92,
|
||||
93,
|
||||
94,
|
||||
95,
|
||||
96,
|
||||
97,
|
||||
98,
|
||||
75,
|
||||
99,
|
||||
100,
|
||||
101,
|
||||
102,
|
||||
99,
|
||||
102,
|
||||
103,
|
||||
104,
|
||||
103,
|
||||
105,
|
||||
104,
|
||||
106,
|
||||
107,
|
||||
105,
|
||||
107,
|
||||
108,
|
||||
109,
|
||||
77,
|
||||
109,
|
||||
108,
|
||||
110,
|
||||
111,
|
||||
112,
|
||||
113,
|
||||
114,
|
||||
115,
|
||||
116,
|
||||
117,
|
||||
118,
|
||||
119,
|
||||
120,
|
||||
121,
|
||||
122,
|
||||
123,
|
||||
124,
|
||||
125,
|
||||
126,
|
||||
127,
|
||||
128,
|
||||
129,
|
||||
130,
|
||||
131,
|
||||
132,
|
||||
133,
|
||||
134,
|
||||
135,
|
||||
136,
|
||||
137,
|
||||
138,
|
||||
139,
|
||||
140,
|
||||
141,
|
||||
142,
|
||||
143,
|
||||
144,
|
||||
145,
|
||||
146,
|
||||
147,
|
||||
148,
|
||||
149,
|
||||
150,
|
||||
151,
|
||||
152,
|
||||
153,
|
||||
154,
|
||||
155,
|
||||
156,
|
||||
157,
|
||||
158,
|
||||
159,
|
||||
160,
|
||||
161,
|
||||
162,
|
||||
163,
|
||||
164,
|
||||
165,
|
||||
166,
|
||||
167,
|
||||
168,
|
||||
169,
|
||||
170,
|
||||
171,
|
||||
172,
|
||||
173,
|
||||
174,
|
||||
175,
|
||||
176,
|
||||
177,
|
||||
178,
|
||||
179,
|
||||
180,
|
||||
181,
|
||||
179,
|
||||
182,
|
||||
183,
|
||||
0,
|
||||
184,
|
||||
1,
|
||||
3,
|
||||
185,
|
||||
4,
|
||||
6,
|
||||
186,
|
||||
7,
|
||||
9,
|
||||
187,
|
||||
10,
|
||||
12,
|
||||
188,
|
||||
13,
|
||||
15,
|
||||
189,
|
||||
16,
|
||||
18,
|
||||
190,
|
||||
19,
|
||||
21,
|
||||
191,
|
||||
22,
|
||||
24,
|
||||
192,
|
||||
25,
|
||||
27,
|
||||
193,
|
||||
28,
|
||||
30,
|
||||
194,
|
||||
31,
|
||||
33,
|
||||
195,
|
||||
34,
|
||||
36,
|
||||
196,
|
||||
37,
|
||||
39,
|
||||
197,
|
||||
40,
|
||||
42,
|
||||
198,
|
||||
43,
|
||||
45,
|
||||
199,
|
||||
46,
|
||||
48,
|
||||
200,
|
||||
49,
|
||||
51,
|
||||
201,
|
||||
52,
|
||||
54,
|
||||
202,
|
||||
55,
|
||||
57,
|
||||
203,
|
||||
58,
|
||||
60,
|
||||
204,
|
||||
61,
|
||||
63,
|
||||
205,
|
||||
64,
|
||||
66,
|
||||
206,
|
||||
67,
|
||||
69,
|
||||
207,
|
||||
70,
|
||||
72,
|
||||
208,
|
||||
73,
|
||||
75,
|
||||
100,
|
||||
76,
|
||||
78,
|
||||
209,
|
||||
79,
|
||||
81,
|
||||
210,
|
||||
82,
|
||||
84,
|
||||
211,
|
||||
85,
|
||||
87,
|
||||
212,
|
||||
88,
|
||||
90,
|
||||
213,
|
||||
91,
|
||||
93,
|
||||
214,
|
||||
94,
|
||||
96,
|
||||
215,
|
||||
97,
|
||||
75,
|
||||
101,
|
||||
99,
|
||||
101,
|
||||
216,
|
||||
102,
|
||||
102,
|
||||
216,
|
||||
103,
|
||||
103,
|
||||
106,
|
||||
105,
|
||||
106,
|
||||
217,
|
||||
107,
|
||||
107,
|
||||
217,
|
||||
108,
|
||||
77,
|
||||
76,
|
||||
109,
|
||||
112,
|
||||
218,
|
||||
110,
|
||||
218,
|
||||
219,
|
||||
110,
|
||||
219,
|
||||
220,
|
||||
110,
|
||||
110,
|
||||
221,
|
||||
111,
|
||||
111,
|
||||
222,
|
||||
112,
|
||||
114,
|
||||
223,
|
||||
224,
|
||||
224,
|
||||
225,
|
||||
114,
|
||||
225,
|
||||
115,
|
||||
114,
|
||||
115,
|
||||
226,
|
||||
227,
|
||||
227,
|
||||
113,
|
||||
115,
|
||||
116,
|
||||
228,
|
||||
117,
|
||||
119,
|
||||
229,
|
||||
120,
|
||||
122,
|
||||
230,
|
||||
123,
|
||||
125,
|
||||
231,
|
||||
126,
|
||||
128,
|
||||
232,
|
||||
129,
|
||||
131,
|
||||
233,
|
||||
132,
|
||||
134,
|
||||
234,
|
||||
135,
|
||||
137,
|
||||
235,
|
||||
138,
|
||||
140,
|
||||
236,
|
||||
141,
|
||||
143,
|
||||
237,
|
||||
144,
|
||||
146,
|
||||
238,
|
||||
147,
|
||||
149,
|
||||
239,
|
||||
150,
|
||||
152,
|
||||
240,
|
||||
153,
|
||||
155,
|
||||
241,
|
||||
156,
|
||||
158,
|
||||
242,
|
||||
159,
|
||||
161,
|
||||
243,
|
||||
162,
|
||||
164,
|
||||
244,
|
||||
165,
|
||||
167,
|
||||
245,
|
||||
168,
|
||||
170,
|
||||
246,
|
||||
171,
|
||||
173,
|
||||
247,
|
||||
174,
|
||||
176,
|
||||
248,
|
||||
177,
|
||||
181,
|
||||
249,
|
||||
250,
|
||||
179,
|
||||
251,
|
||||
180,
|
||||
181,
|
||||
250,
|
||||
179,
|
||||
179,
|
||||
250,
|
||||
182
|
||||
};
|
||||
|
||||
primitive_t *primitive = primitiveCreate(
|
||||
POKER_TABLE_VERTICE_COUNT,
|
||||
POKER_TABLE_INDICE_COUNT
|
||||
);
|
||||
|
||||
primitiveBufferVertices(primitive, 0, POKER_TABLE_VERTICE_COUNT, vertices);
|
||||
primitiveBufferIndices(primitive, 0, POKER_TABLE_INDICE_COUNT, indices);
|
||||
return primitive;
|
||||
}
|
22
src/card/poker/model/pokertable.h
Normal file
22
src/card/poker/model/pokertable.h
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../../../display/primitive.h"
|
||||
|
||||
#define POKER_TABLE_NAME "Poker Table"
|
||||
#define POKER_TABLE_VERTICE_COUNT 252
|
||||
#define POKER_TABLE_INDICE_COUNT 420
|
||||
#define POKER_TABLE_TRIANGLE_COUNT 140
|
||||
|
||||
/**
|
||||
* Generated Model Poker Table
|
||||
* Generated at Sun, 09 May 2021 21:15:45 GMT
|
||||
* @returns Poker Table as a primitive.
|
||||
*/
|
||||
primitive_t * pokerTableCreate();
|
@ -9,10 +9,10 @@
|
||||
|
||||
void holdemRenderPlayer(float x, float y, float z, float yaw) {
|
||||
float w, h;
|
||||
w = 1, h = (
|
||||
w = 0.75, h = (
|
||||
(float)HOLDEM_GAME_STATE.kagamiTileset->divY /
|
||||
(float)HOLDEM_GAME_STATE.kagamiTileset->divX
|
||||
);
|
||||
) * w;
|
||||
|
||||
int i = (int32_t)(TIME_STATE.current*10)%HOLDEM_GAME_STATE.kagamiTileset->count;
|
||||
quadBuffer(HOLDEM_GAME_STATE.kagamiQuad, 0,
|
||||
@ -48,12 +48,62 @@ void holdemRenderCard(card_t card,
|
||||
}
|
||||
|
||||
void holdemRenderWorld() {
|
||||
holdemRenderCard(CARD_HEARTS_QUEEN, 0, 0, 0, mathDeg2Rad(-90), 0, 0);
|
||||
uint8_t i, j;
|
||||
float pitch;
|
||||
holdemplayer_t *player;
|
||||
char name[16];
|
||||
|
||||
// Poker Table
|
||||
shaderUsePositionAndScale(GAME_STATE.shaderWorld,
|
||||
0, -0.01, 0.05,
|
||||
0, 0, 0,
|
||||
3.29, 3.29, 3.29
|
||||
);
|
||||
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.tableTexture);
|
||||
primitiveDraw(HOLDEM_GAME_STATE.tablePrimitive, 0, -1);
|
||||
|
||||
for(j = 0; j < HOLDEM_GAME_STATE.match.cardsFacing; j++) {
|
||||
pitch = mathDeg2Rad(-90);
|
||||
holdemRenderCard(HOLDEM_GAME_STATE.match.cards[j], j*0.2, 0, -0.2, pitch, 0, 0);
|
||||
}
|
||||
|
||||
for(i = 0; i < HOLDEM_PLAYER_COUNT; i++) {
|
||||
player = HOLDEM_GAME_STATE.match.players + i;
|
||||
if(player->state & HOLDEM_STATE_FOLDED) continue;
|
||||
sprintf(name, "Player %i", i);
|
||||
|
||||
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.fontTexture);
|
||||
spriteBatchFlush(HOLDEM_GAME_STATE.fontBatch);
|
||||
shaderUsePosition(GAME_STATE.shaderWorld, -0.1,0,i*0.2, mathDeg2Rad(-90),0,0);
|
||||
fontSpriteBatchBuffer(
|
||||
HOLDEM_GAME_STATE.fontBatch,
|
||||
HOLDEM_GAME_STATE.fontTileset,
|
||||
name, FONT_RIGHT_X, FONT_CENTER_Y, 0, -1, 0.1
|
||||
);
|
||||
spriteBatchDraw(HOLDEM_GAME_STATE.fontBatch, 0, -1);
|
||||
|
||||
for(j = 0; j < HOLDEM_PLAYER_HAND; j++) {
|
||||
// pitch = mathDeg2Rad(player->state & HOLDEM_STATE_SHOWING ? -90 : 90);
|
||||
holdemRenderCard(player->cards[j], j*0.2, 0, i*0.2, pitch, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
shaderUseTexture(GAME_STATE.shaderWorld, HOLDEM_GAME_STATE.fontTexture);
|
||||
|
||||
spriteBatchFlush(HOLDEM_GAME_STATE.fontBatch);
|
||||
shaderUsePosition(GAME_STATE.shaderWorld, -0.1,0,-0.2, mathDeg2Rad(-90),0,0);
|
||||
fontSpriteBatchBuffer(
|
||||
HOLDEM_GAME_STATE.fontBatch,
|
||||
HOLDEM_GAME_STATE.fontTileset,
|
||||
"Dealer", FONT_RIGHT_X, FONT_CENTER_Y, 0, -1, 0.1
|
||||
);
|
||||
spriteBatchDraw(HOLDEM_GAME_STATE.fontBatch, 0, -1);
|
||||
|
||||
// Draw the players
|
||||
holdemRenderPlayer(0, 0, -1, 0);
|
||||
holdemRenderPlayer(-1, 0, -0, 90);
|
||||
holdemRenderPlayer(-0.75, 0, 0.75, -45);
|
||||
holdemRenderPlayer(0.75, 0, 0.75, 45);
|
||||
holdemRenderPlayer(1, 0, 0, -90);
|
||||
float playerY = 0;
|
||||
holdemRenderPlayer(0, playerY, -1, 0);
|
||||
holdemRenderPlayer(-1, playerY, -0, 90);
|
||||
holdemRenderPlayer(-0.75, playerY, 0.75, -45);
|
||||
holdemRenderPlayer(0.75, playerY, 0.75, 45);
|
||||
holdemRenderPlayer(1, playerY, 0, -90);
|
||||
}
|
@ -10,6 +10,8 @@
|
||||
#include "../../../display/shader.h"
|
||||
#include "../../../display/primitive.h"
|
||||
#include "../../../display/primitives/quad.h"
|
||||
#include "../../../display/spritebatch.h"
|
||||
#include "../../../display/gui/font.h"
|
||||
#include "../../../util/math.h"
|
||||
|
||||
void holdemRenderPlayer(float x, float y, float z, float yaw);
|
||||
|
81
src/display/debug/position.c
Normal file
81
src/display/debug/position.c
Normal file
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "position.h"
|
||||
|
||||
positiondebug_t positionDebugCreate(
|
||||
primitive_t *debugPrimitive,
|
||||
texture_t *fontTexture, tileset_t *fontTileset
|
||||
) {
|
||||
positiondebug_t debug = {
|
||||
.primitive = debugPrimitive,
|
||||
.textTexture = fontTexture,
|
||||
.textTileset = fontTileset,
|
||||
.x = 0, .y = 0, .z = 0,
|
||||
.pitch = 0, .yaw = 0, .roll = 0,
|
||||
.scaleX = 1, .scaleY = 1, .scaleZ = 1
|
||||
};
|
||||
|
||||
debug.textBatch = spriteBatchCreate(POSITION_DEBUG_FONT_CHARS_MAX);
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
void positionDebugRender(shader_t *shader, positiondebug_t *debug) {
|
||||
float speed = 0.5;
|
||||
|
||||
// Update values.
|
||||
if(inputIsDown(INPUT_DEBUG_FINE)) speed *= 0.1;
|
||||
if(inputIsDown(INPUT_DEBUG_UP)) debug->z -= TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_DOWN)) debug->z += TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_LEFT)) debug->x -= TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_RIGHT)) debug->x += TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_LOWER)) debug->y -= TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_RAISE)) debug->y += TIME_STATE.delta * speed;
|
||||
if(inputIsDown(INPUT_DEBUG_MINUS)) {
|
||||
debug->scaleX -= TIME_STATE.delta * speed;
|
||||
debug->scaleY -= TIME_STATE.delta * speed;
|
||||
debug->scaleZ -= TIME_STATE.delta * speed;
|
||||
}
|
||||
if(inputIsDown(INPUT_DEBUG_PLUS)) {
|
||||
debug->scaleX += TIME_STATE.delta * speed;
|
||||
debug->scaleY += TIME_STATE.delta * speed;
|
||||
debug->scaleZ += TIME_STATE.delta * speed;
|
||||
}
|
||||
|
||||
// Render object
|
||||
shaderUsePositionAndScale(shader,
|
||||
debug->x, debug->y, debug->z,
|
||||
mathDeg2Rad(debug->pitch),mathDeg2Rad(debug->yaw),mathDeg2Rad(debug->roll),
|
||||
debug->scaleX, debug->scaleY, debug->scaleZ
|
||||
);
|
||||
primitiveDraw(debug->primitive, 0, -1);
|
||||
|
||||
// Render debug text
|
||||
char text[POSITION_DEBUG_FONT_CHARS_MAX];
|
||||
sprintf(text, "%.2f, %.2f, %.2f\n%.2f, %.2f, %.2f \n%.2f, %.2f, %.2f",
|
||||
debug->x, debug->y, debug->z,
|
||||
debug->pitch, debug->yaw, debug->roll,
|
||||
debug->scaleX, debug->scaleY, debug->scaleZ
|
||||
);
|
||||
|
||||
shaderUseTexture(shader, debug->textTexture);
|
||||
shaderUsePosition(shader,
|
||||
0, 1, 0,
|
||||
mathDeg2Rad(-90), mathDeg2Rad(0), 0
|
||||
);
|
||||
spriteBatchFlush(debug->textBatch);
|
||||
fontSpriteBatchBuffer(debug->textBatch, debug->textTileset, text,
|
||||
FONT_CENTER_X, FONT_CENTER_Y, 0,
|
||||
-1, 0.1
|
||||
);
|
||||
spriteBatchDraw(debug->textBatch, 0, -1);
|
||||
}
|
||||
|
||||
void positionDebugDispose(positiondebug_t *debug) {
|
||||
spriteBatchDispose(debug->textBatch);
|
||||
}
|
27
src/display/debug/position.h
Normal file
27
src/display/debug/position.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dawn/dawn.h>
|
||||
#include "../primitive.h"
|
||||
#include "../texture.h"
|
||||
#include "../tileset.h"
|
||||
#include "../gui/font.h"
|
||||
#include "../spritebatch.h"
|
||||
#include "../shader.h"
|
||||
#include "../../input/input.h"
|
||||
#include "../../util/math.h"
|
||||
|
||||
positiondebug_t positionDebugCreate(
|
||||
primitive_t *debugPrimitive,
|
||||
texture_t *fontTexture, tileset_t *fontTileset
|
||||
);
|
||||
|
||||
void positionDebugRender(shader_t *shader, positiondebug_t *debug);
|
||||
|
||||
void positionDebugDispose(positiondebug_t *debug);
|
@ -12,14 +12,74 @@ tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character) {
|
||||
return tileset->divisions + i;
|
||||
}
|
||||
|
||||
void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
|
||||
fontmeasure_t fontMeasure(char *string, float charWidth, float charHeight) {
|
||||
int32_t i;
|
||||
float x, y;
|
||||
char c;
|
||||
fontmeasure_t measure = {
|
||||
.height = 0, .lines = 1, .width = 0
|
||||
};
|
||||
|
||||
i = 0;
|
||||
y = 0;
|
||||
x = 0;
|
||||
|
||||
while(true) {
|
||||
c = string[i];
|
||||
if(c == '\0') break;
|
||||
i++;
|
||||
|
||||
if(c == '\n') {
|
||||
measure.width = mathMax(x, measure.width);
|
||||
x = 0;
|
||||
y += charHeight;
|
||||
measure.lines++;
|
||||
continue;
|
||||
} else if(c == ' ') {
|
||||
x += charWidth;
|
||||
continue;
|
||||
}
|
||||
|
||||
x += charWidth;
|
||||
}
|
||||
|
||||
measure.width = mathMax(x, measure.width);
|
||||
measure.height = y + charHeight;
|
||||
|
||||
return measure;
|
||||
}
|
||||
|
||||
fontmeasure_t fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
|
||||
char *string, float x, float y, float z, float charWidth, float charHeight
|
||||
) {
|
||||
int32_t i;
|
||||
char c;
|
||||
tilesetdiv_t *div;
|
||||
float cx, cy;
|
||||
fontmeasure_t measure;
|
||||
|
||||
// Detect char dimensions
|
||||
if(charWidth == -1) charWidth = tileset->divX * (charHeight / tileset->divY);
|
||||
if(charHeight == -1) charHeight = tileset->divY * (charWidth / tileset->divX);
|
||||
|
||||
// Position the text.
|
||||
if(x == FONT_CENTER_X ||
|
||||
y == FONT_CENTER_Y ||
|
||||
x == FONT_RIGHT_X
|
||||
) {
|
||||
measure = fontMeasure(string, charWidth, charHeight);
|
||||
if(x == FONT_CENTER_X) {
|
||||
x = -(measure.width/2);
|
||||
} else if(x == FONT_RIGHT_X) {
|
||||
x = -measure.width;
|
||||
}
|
||||
if(y == FONT_CENTER_Y) y = -(measure.height/2);
|
||||
}
|
||||
|
||||
// Begin buffering the sprite batch
|
||||
measure.width = 0;
|
||||
measure.height = 0;
|
||||
measure.lines = 1;
|
||||
i = 0;
|
||||
cx = x, cy = y;
|
||||
|
||||
@ -28,20 +88,28 @@ void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
|
||||
if(c == '\0') break;
|
||||
i++;
|
||||
|
||||
// Special chars
|
||||
if(c == '\n') {
|
||||
measure.width = mathMax(cx-x, measure.width);
|
||||
cx = x;
|
||||
cy += charWidth;
|
||||
cy += charHeight;
|
||||
measure.lines++;
|
||||
continue;
|
||||
} else if(c == ' ') {
|
||||
cx += charHeight;
|
||||
cx += charWidth;
|
||||
continue;
|
||||
}
|
||||
|
||||
div = fontGetCharacterDivision(tileset, c);
|
||||
spriteBatchQuad(batch, -1,
|
||||
cx, cy, z, charWidth, charHeight,
|
||||
div->x0, div->y0, div->x1, div->y1
|
||||
div->x0, div->y1, div->x1, div->y0
|
||||
);
|
||||
cx += charWidth;
|
||||
}
|
||||
|
||||
measure.width = mathMax(cx-x, measure.width);
|
||||
measure.height = cy-y + charHeight;
|
||||
|
||||
return measure;
|
||||
}
|
@ -8,8 +8,7 @@
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../spritebatch.h"
|
||||
|
||||
#define FONT_CHAR_START 33
|
||||
#include "../../util/math.h"
|
||||
|
||||
/**
|
||||
* Get the division for a given character.
|
||||
@ -20,6 +19,16 @@
|
||||
*/
|
||||
tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character);
|
||||
|
||||
/**
|
||||
* Measures a string's fully rendered size.
|
||||
*
|
||||
* @param string The string to measure
|
||||
* @param charWidth The width of each character.
|
||||
* @param charHeight The height of each character.
|
||||
* @return The measured string.
|
||||
*/
|
||||
fontmeasure_t fontMeasure(char *string, float charWidth, float charHeight);
|
||||
|
||||
/**
|
||||
* Renders a set of font characters to the sprite. Coordinates are anchored to
|
||||
* the top left (0,0) origin.
|
||||
@ -30,9 +39,10 @@ tilesetdiv_t * fontGetCharacterDivision(tileset_t *tileset, char character);
|
||||
* @param x Position in X space.
|
||||
* @param y Position in Y space.
|
||||
* @param z Position in Z space.
|
||||
* @param charWidth Width of each character.
|
||||
* @param charHeight Height of each character.
|
||||
* @param charWidth Width of each character. Set to -1 to use the height ratio.
|
||||
* @param charHeight Height of each character. Set to -1 to be the width ratio.
|
||||
* @returns The string measurement.
|
||||
*/
|
||||
void fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
|
||||
fontmeasure_t fontSpriteBatchBuffer(spritebatch_t *batch, tileset_t *tileset,
|
||||
char *string, float x, float y, float z, float charWidth, float charHeight
|
||||
);
|
@ -131,13 +131,41 @@ void shaderUsePosition(shader_t *shader,
|
||||
//Rotation, we do each axis individually
|
||||
axis[0] = 1, axis[1] = 0, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
|
||||
axis[0] = 0, axis[1] = 1;
|
||||
glm_rotate(MATRIX_POSITION, yaw, axis);
|
||||
|
||||
axis[1] = 0, axis[2] = 1;
|
||||
glm_rotate(MATRIX_POSITION, roll, axis);
|
||||
|
||||
//Send to the shader.
|
||||
glUniformMatrix4fv(shader->uniModl, 1, GL_FALSE, MATRIX_POSITION[0]);
|
||||
}
|
||||
|
||||
void shaderUsePositionAndScale(shader_t *shader,
|
||||
float x, float y, float z,
|
||||
float pitch, float yaw, float roll,
|
||||
float scaleX, float scaleY, float scaleZ
|
||||
) {
|
||||
mat4 MATRIX_POSITION;
|
||||
vec3 axis;
|
||||
|
||||
// Identify mat.
|
||||
glm_mat4_identity(MATRIX_POSITION);
|
||||
|
||||
// Position
|
||||
axis[0] = x, axis[1] = y, axis[2] = z;
|
||||
glm_translate(MATRIX_POSITION, axis);
|
||||
|
||||
// Rotation
|
||||
axis[0] = 1, axis[1] = 0, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
axis[0] = 0, axis[1] = 1;
|
||||
glm_rotate(MATRIX_POSITION, yaw, axis);
|
||||
axis[1] = 0, axis[2] = 1;
|
||||
glm_rotate(MATRIX_POSITION, roll, axis);
|
||||
|
||||
// Scale
|
||||
axis[0] = scaleX, axis[1] = scaleY, axis[2] = scaleZ;
|
||||
glm_scale(MATRIX_POSITION, axis);
|
||||
|
||||
glUniformMatrix4fv(shader->uniModl, 1, GL_FALSE, MATRIX_POSITION[0]);
|
||||
}
|
@ -61,4 +61,26 @@ void shaderUseTexture(shader_t *shader, texture_t *texture);
|
||||
void shaderUsePosition(shader_t *shader,
|
||||
float x, float y, float z,
|
||||
float pitch, float yaw, float roll
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Set's the current translation matrix onto the shader for the next
|
||||
* render to use. Also provides scaling controls.
|
||||
*
|
||||
* @param shader Shader to attach to.
|
||||
* @param x X coordinate (world space).
|
||||
* @param y Y coordinate (world space).
|
||||
* @param z Z coordinate (world space).
|
||||
* @param pitch Pitch of the object (local space).
|
||||
* @param yaw Yaw of the object (local space).
|
||||
* @param roll Roll of the object (local space).
|
||||
* @param scaleX X scale of model (1 being 100% scaled).
|
||||
* @param scaleY Y scale of model (1 being 100% scaled).
|
||||
* @param scaleZ Z scale of model (1 being 100% scaled).
|
||||
*/
|
||||
void shaderUsePositionAndScale(shader_t *shader,
|
||||
float x, float y, float z,
|
||||
float pitch, float yaw, float roll,
|
||||
float scaleX, float scaleY, float scaleZ
|
||||
);
|
@ -44,7 +44,6 @@ bool gameUpdate(float platformDelta) {
|
||||
|
||||
void gameDispose() {
|
||||
shaderDispose(GAME_STATE.shaderWorld);
|
||||
worldDispose();
|
||||
inputDispose();
|
||||
renderDispose();
|
||||
}
|
@ -38,15 +38,25 @@ int32_t main() {
|
||||
// Init the game
|
||||
if(gameInit()) {
|
||||
// Bind initial keys
|
||||
inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
|
||||
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_UP);
|
||||
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
|
||||
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
|
||||
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
|
||||
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
|
||||
inputBind(INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(INPUT_DEBUG_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(INPUT_DEBUG_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(INPUT_DEBUG_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
inputBind(INPUT_DEBUG_RAISE, (inputsource_t)GLFW_KEY_Q);
|
||||
inputBind(INPUT_DEBUG_LOWER, (inputsource_t)GLFW_KEY_E);
|
||||
inputBind(INPUT_DEBUG_FINE, (inputsource_t)GLFW_KEY_LEFT_CONTROL);
|
||||
inputBind(INPUT_DEBUG_PLUS, (inputsource_t)GLFW_KEY_EQUAL);
|
||||
inputBind(INPUT_DEBUG_MINUS, (inputsource_t)GLFW_KEY_MINUS);
|
||||
|
||||
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_UP);
|
||||
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_DOWN);
|
||||
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_LEFT);
|
||||
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_RIGHT);
|
||||
inputBind(INPUT_UP, (inputsource_t)GLFW_KEY_W);
|
||||
inputBind(INPUT_DOWN, (inputsource_t)GLFW_KEY_S);
|
||||
inputBind(INPUT_LEFT, (inputsource_t)GLFW_KEY_A);
|
||||
inputBind(INPUT_RIGHT, (inputsource_t)GLFW_KEY_D);
|
||||
|
||||
// Init the render resolution
|
||||
renderSetResolution(WINDOW_WIDTH_DEFAULT, WINDOW_HEIGHT_DEFAULT);
|
||||
|
143
tools/model/obj_to_c.js
Normal file
143
tools/model/obj_to_c.js
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright (c) 2021 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const MODEL_NAME = 'Poker Table';
|
||||
const FLIP_TEXTURE_Y = true;
|
||||
|
||||
let rawVertices = [];
|
||||
let faces = [];
|
||||
let coordinates = [];
|
||||
const filePath = path.join(__dirname, 'model.obj');
|
||||
const data = fs.readFileSync(filePath, 'utf-8');
|
||||
|
||||
const scale = 0.1;
|
||||
|
||||
data.split('\n').forEach(line => {
|
||||
const bits = line.trim().split(' ');
|
||||
if(!bits.length || bits.every(n => !n || !bits.length)) return;
|
||||
const lineType = bits.shift();
|
||||
|
||||
if(lineType === 'v') {
|
||||
const [ x, y, z ] = bits.map(n => {
|
||||
const val = parseFloat(n) * scale;
|
||||
return val;
|
||||
});
|
||||
rawVertices.push({ x, y, z });
|
||||
} else if(lineType === 'vt') {
|
||||
let [ u, v ] = bits.map(n => parseFloat(n));
|
||||
if(FLIP_TEXTURE_Y) v = 1 - v;
|
||||
coordinates.push({ u, v });
|
||||
} else if(lineType === 'f') {
|
||||
faces.push(bits.map(n => {
|
||||
const [ vertice, coordinate ] = n.split('/').map(n => parseInt(n));
|
||||
return { vertice, coordinate };
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
const verticeCompare = (vl, vr) => (
|
||||
vl.x === vr.x &&
|
||||
vl.y === vr.y &&
|
||||
vl.z === vr.z &&
|
||||
vl.u === vr.u &&
|
||||
vl.v === vr.v
|
||||
);
|
||||
|
||||
const indices = [];
|
||||
const vertices = [];
|
||||
|
||||
faces.forEach(face => {
|
||||
face.forEach(faceIndice => {
|
||||
const rawVert = rawVertices[faceIndice.vertice-1];
|
||||
const rawCoord = coordinates[faceIndice.coordinate-1];
|
||||
const vertice = { ...rawVert, ...rawCoord };
|
||||
|
||||
const indice = vertices.findIndex(vert => {
|
||||
return verticeCompare(vert, vertice);
|
||||
});
|
||||
|
||||
if(indice === -1) {
|
||||
indices.push(vertices.length);
|
||||
vertices.push(vertice);
|
||||
} else {
|
||||
indices.push(indice);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
const MODEL_NAME_CAPS = MODEL_NAME.replace(/\s/g, '_').toUpperCase();
|
||||
const MODEL_NAME_CAMEL = [
|
||||
MODEL_NAME[0].toLowerCase(),
|
||||
MODEL_NAME.split(' ').join('').substr(1)
|
||||
].join('')
|
||||
// const fn = MODEL_NAME.toLowerCase().split(' ').join('');
|
||||
const fn = 'model';
|
||||
|
||||
const license = `/**
|
||||
* Copyright (c) ${new Date().getFullYear()} Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
`;
|
||||
|
||||
// Write header file
|
||||
const header = `${license}
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../primitive.h"
|
||||
|
||||
#define ${MODEL_NAME_CAPS}_NAME "${MODEL_NAME}"
|
||||
#define ${MODEL_NAME_CAPS}_VERTICE_COUNT ${vertices.length}
|
||||
#define ${MODEL_NAME_CAPS}_INDICE_COUNT ${indices.length}
|
||||
#define ${MODEL_NAME_CAPS}_TRIANGLE_COUNT ${indices.length/3}
|
||||
|
||||
/**
|
||||
* Generated Model ${MODEL_NAME}
|
||||
* Generated at ${new Date().toUTCString()}
|
||||
* @returns ${MODEL_NAME} as a primitive.
|
||||
*/
|
||||
primitive_t * ${MODEL_NAME_CAMEL}Create();
|
||||
`;
|
||||
|
||||
// Write Source file
|
||||
const strVertices = vertices.map((v,i) => {
|
||||
return `{ .x = ${v.x}, .y = ${v.y}, .z = ${v.z}, .u = ${v.u}, .v = ${v.v} }`;
|
||||
}).join(',\n ');
|
||||
|
||||
const strIndices = indices.map(i => {
|
||||
return `${i}`;
|
||||
}).join(',\n ');
|
||||
|
||||
const source = `${license}
|
||||
#include "${fn}.h"
|
||||
|
||||
primitive_t * ${MODEL_NAME_CAMEL}Create() {
|
||||
vertice_t vertices[${MODEL_NAME_CAPS}_VERTICE_COUNT] = {
|
||||
${strVertices}
|
||||
};
|
||||
|
||||
indice_t indices[${MODEL_NAME_CAPS}_INDICE_COUNT] = {
|
||||
${strIndices}
|
||||
};
|
||||
|
||||
primitive_t *primitive = primitiveCreate(
|
||||
${MODEL_NAME_CAPS}_VERTICE_COUNT,
|
||||
${MODEL_NAME_CAPS}_INDICE_COUNT
|
||||
);
|
||||
|
||||
primitiveBufferVertices(primitive, 0, ${MODEL_NAME_CAPS}_VERTICE_COUNT, vertices);
|
||||
primitiveBufferIndices(primitive, 0, ${MODEL_NAME_CAPS}_INDICE_COUNT, indices);
|
||||
return primitive;
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, fn+'.h'), header);
|
||||
fs.writeFileSync(path.join(__dirname, fn+'.c'), source);
|
Reference in New Issue
Block a user