Added Car Crime City #2
@ -0,0 +1,256 @@ |
||||
/*
|
||||
** $Id: lauxlib.h,v 1.129 2015/11/23 11:29:43 roberto Exp $ |
||||
** Auxiliary functions for building Lua libraries |
||||
** See Copyright Notice in lua.h |
||||
*/ |
||||
|
||||
|
||||
#ifndef lauxlib_h |
||||
#define lauxlib_h |
||||
|
||||
|
||||
#include <stddef.h> |
||||
#include <stdio.h> |
||||
|
||||
#include "lua.h" |
||||
|
||||
|
||||
|
||||
/* extra error code for 'luaL_load' */ |
||||
#define LUA_ERRFILE (LUA_ERRERR+1) |
||||
|
||||
|
||||
typedef struct luaL_Reg { |
||||
const char *name; |
||||
lua_CFunction func; |
||||
} luaL_Reg; |
||||
|
||||
|
||||
#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) |
||||
|
||||
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); |
||||
#define luaL_checkversion(L) \ |
||||
luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) |
||||
|
||||
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); |
||||
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); |
||||
LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); |
||||
LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); |
||||
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, |
||||
size_t *l); |
||||
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, |
||||
const char *def, size_t *l); |
||||
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); |
||||
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); |
||||
|
||||
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); |
||||
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, |
||||
lua_Integer def); |
||||
|
||||
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); |
||||
LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); |
||||
LUALIB_API void (luaL_checkany) (lua_State *L, int arg); |
||||
|
||||
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); |
||||
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); |
||||
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); |
||||
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); |
||||
|
||||
LUALIB_API void (luaL_where) (lua_State *L, int lvl); |
||||
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); |
||||
|
||||
LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, |
||||
const char *const lst[]); |
||||
|
||||
LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); |
||||
LUALIB_API int (luaL_execresult) (lua_State *L, int stat); |
||||
|
||||
/* predefined references */ |
||||
#define LUA_NOREF (-2) |
||||
#define LUA_REFNIL (-1) |
||||
|
||||
LUALIB_API int (luaL_ref) (lua_State *L, int t); |
||||
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); |
||||
|
||||
LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, |
||||
const char *mode); |
||||
|
||||
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) |
||||
|
||||
LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, |
||||
const char *name, const char *mode); |
||||
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); |
||||
|
||||
LUALIB_API lua_State *(luaL_newstate) (void); |
||||
|
||||
LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); |
||||
|
||||
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, |
||||
const char *r); |
||||
|
||||
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); |
||||
|
||||
LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); |
||||
|
||||
LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, |
||||
const char *msg, int level); |
||||
|
||||
LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, |
||||
lua_CFunction openf, int glb); |
||||
|
||||
/*
|
||||
** =============================================================== |
||||
** some useful macros |
||||
** =============================================================== |
||||
*/ |
||||
|
||||
|
||||
#define luaL_newlibtable(L,l) \ |
||||
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) |
||||
|
||||
#define luaL_newlib(L,l) \ |
||||
(luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) |
||||
|
||||
#define luaL_argcheck(L, cond,arg,extramsg) \ |
||||
((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) |
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) |
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) |
||||
|
||||
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) |
||||
|
||||
#define luaL_dofile(L, fn) \ |
||||
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) |
||||
|
||||
#define luaL_dostring(L, s) \ |
||||
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) |
||||
|
||||
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) |
||||
|
||||
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) |
||||
|
||||
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) |
||||
|
||||
|
||||
/*
|
||||
** {====================================================== |
||||
** Generic Buffer manipulation |
||||
** ======================================================= |
||||
*/ |
||||
|
||||
typedef struct luaL_Buffer { |
||||
char *b; /* buffer address */ |
||||
size_t size; /* buffer size */ |
||||
size_t n; /* number of characters in buffer */ |
||||
lua_State *L; |
||||
char initb[LUAL_BUFFERSIZE]; /* initial buffer */ |
||||
} luaL_Buffer; |
||||
|
||||
|
||||
#define luaL_addchar(B,c) \ |
||||
((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
|
||||
((B)->b[(B)->n++] = (c))) |
||||
|
||||
#define luaL_addsize(B,s) ((B)->n += (s)) |
||||
|
||||
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); |
||||
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); |
||||
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); |
||||
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); |
||||
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); |
||||
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); |
||||
LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); |
||||
LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); |
||||
|
||||
#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) |
||||
|
||||
/* }====================================================== */ |
||||
|
||||
|
||||
|
||||
/*
|
||||
** {====================================================== |
||||
** File handles for IO library |
||||
** ======================================================= |
||||
*/ |
||||
|
||||
/*
|
||||
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and |
||||
** initial structure 'luaL_Stream' (it may contain other fields |
||||
** after that initial structure). |
||||
*/ |
||||
|
||||
#define LUA_FILEHANDLE "FILE*" |
||||
|
||||
|
||||
typedef struct luaL_Stream { |
||||
FILE *f; /* stream (NULL for incompletely created streams) */ |
||||
lua_CFunction closef; /* to close stream (NULL for closed streams) */ |
||||
} luaL_Stream; |
||||
|
||||
/* }====================================================== */ |
||||
|
||||
|
||||
|
||||
/* compatibility with old module system */ |
||||
#if defined(LUA_COMPAT_MODULE) |
||||
|
||||
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, |
||||
int sizehint); |
||||
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, |
||||
const luaL_Reg *l, int nup); |
||||
|
||||
#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) |
||||
|
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** "Abstraction Layer" for basic report of messages and errors |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/* print a string */ |
||||
#if !defined(lua_writestring) |
||||
#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) |
||||
#endif |
||||
|
||||
/* print a newline and flush the output */ |
||||
#if !defined(lua_writeline) |
||||
#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) |
||||
#endif |
||||
|
||||
/* print an error message */ |
||||
#if !defined(lua_writestringerror) |
||||
#define lua_writestringerror(s,p) \ |
||||
(fprintf(stderr, (s), (p)), fflush(stderr)) |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {============================================================ |
||||
** Compatibility with deprecated conversions |
||||
** ============================================================= |
||||
*/ |
||||
#if defined(LUA_COMPAT_APIINTCASTS) |
||||
|
||||
#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) |
||||
#define luaL_optunsigned(L,a,d) \ |
||||
((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) |
||||
|
||||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) |
||||
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) |
||||
|
||||
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) |
||||
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) |
||||
|
||||
#endif |
||||
/* }============================================================ */ |
||||
|
||||
|
||||
|
||||
#endif |
||||
|
||||
|
@ -0,0 +1,486 @@ |
||||
/*
|
||||
** $Id: lua.h,v 1.331 2016/05/30 15:53:28 roberto Exp $ |
||||
** Lua - A Scripting Language |
||||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
||||
** See Copyright Notice at the end of this file |
||||
*/ |
||||
|
||||
|
||||
#ifndef lua_h |
||||
#define lua_h |
||||
|
||||
#include <stdarg.h> |
||||
#include <stddef.h> |
||||
|
||||
|
||||
#include "luaconf.h" |
||||
|
||||
|
||||
#define LUA_VERSION_MAJOR "5" |
||||
#define LUA_VERSION_MINOR "3" |
||||
#define LUA_VERSION_NUM 503 |
||||
#define LUA_VERSION_RELEASE "3" |
||||
|
||||
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
||||
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE |
||||
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2016 Lua.org, PUC-Rio" |
||||
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" |
||||
|
||||
|
||||
/* mark for precompiled code ('<esc>Lua') */ |
||||
#define LUA_SIGNATURE "\x1bLua" |
||||
|
||||
/* option for multiple returns in 'lua_pcall' and 'lua_call' */ |
||||
#define LUA_MULTRET (-1) |
||||
|
||||
|
||||
/*
|
||||
** Pseudo-indices |
||||
** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty |
||||
** space after that to help overflow detection) |
||||
*/ |
||||
#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) |
||||
#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) |
||||
|
||||
|
||||
/* thread status */ |
||||
#define LUA_OK 0 |
||||
#define LUA_YIELD 1 |
||||
#define LUA_ERRRUN 2 |
||||
#define LUA_ERRSYNTAX 3 |
||||
#define LUA_ERRMEM 4 |
||||
#define LUA_ERRGCMM 5 |
||||
#define LUA_ERRERR 6 |
||||
|
||||
|
||||
typedef struct lua_State lua_State; |
||||
|
||||
|
||||
/*
|
||||
** basic types |
||||
*/ |
||||
#define LUA_TNONE (-1) |
||||
|
||||
#define LUA_TNIL 0 |
||||
#define LUA_TBOOLEAN 1 |
||||
#define LUA_TLIGHTUSERDATA 2 |
||||
#define LUA_TNUMBER 3 |
||||
#define LUA_TSTRING 4 |
||||
#define LUA_TTABLE 5 |
||||
#define LUA_TFUNCTION 6 |
||||
#define LUA_TUSERDATA 7 |
||||
#define LUA_TTHREAD 8 |
||||
|
||||
#define LUA_NUMTAGS 9 |
||||
|
||||
|
||||
|
||||
/* minimum Lua stack available to a C function */ |
||||
#define LUA_MINSTACK 20 |
||||
|
||||
|
||||
/* predefined values in the registry */ |
||||
#define LUA_RIDX_MAINTHREAD 1 |
||||
#define LUA_RIDX_GLOBALS 2 |
||||
#define LUA_RIDX_LAST LUA_RIDX_GLOBALS |
||||
|
||||
|
||||
/* type of numbers in Lua */ |
||||
typedef LUA_NUMBER lua_Number; |
||||
|
||||
|
||||
/* type for integer functions */ |
||||
typedef LUA_INTEGER lua_Integer; |
||||
|
||||
/* unsigned integer type */ |
||||
typedef LUA_UNSIGNED lua_Unsigned; |
||||
|
||||
/* type for continuation-function contexts */ |
||||
typedef LUA_KCONTEXT lua_KContext; |
||||
|
||||
|
||||
/*
|
||||
** Type for C functions registered with Lua |
||||
*/ |
||||
typedef int (*lua_CFunction) (lua_State *L); |
||||
|
||||
/*
|
||||
** Type for continuation functions |
||||
*/ |
||||
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); |
||||
|
||||
|
||||
/*
|
||||
** Type for functions that read/write blocks when loading/dumping Lua chunks |
||||
*/ |
||||
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); |
||||
|
||||
typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); |
||||
|
||||
|
||||
/*
|
||||
** Type for memory-allocation functions |
||||
*/ |
||||
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); |
||||
|
||||
|
||||
|
||||
/*
|
||||
** generic extra include file |
||||
*/ |
||||
#if defined(LUA_USER_H) |
||||
#include LUA_USER_H |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
** RCS ident string |
||||
*/ |
||||
extern const char lua_ident[]; |
||||
|
||||
|
||||
/*
|
||||
** state manipulation |
||||
*/ |
||||
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); |
||||
LUA_API void (lua_close) (lua_State *L); |
||||
LUA_API lua_State *(lua_newthread) (lua_State *L); |
||||
|
||||
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); |
||||
|
||||
|
||||
LUA_API const lua_Number *(lua_version) (lua_State *L); |
||||
|
||||
|
||||
/*
|
||||
** basic stack manipulation |
||||
*/ |
||||
LUA_API int (lua_absindex) (lua_State *L, int idx); |
||||
LUA_API int (lua_gettop) (lua_State *L); |
||||
LUA_API void (lua_settop) (lua_State *L, int idx); |
||||
LUA_API void (lua_pushvalue) (lua_State *L, int idx); |
||||
LUA_API void (lua_rotate) (lua_State *L, int idx, int n); |
||||
LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); |
||||
LUA_API int (lua_checkstack) (lua_State *L, int n); |
||||
|
||||
LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); |
||||
|
||||
|
||||
/*
|
||||
** access functions (stack -> C) |
||||
*/ |
||||
|
||||
LUA_API int (lua_isnumber) (lua_State *L, int idx); |
||||
LUA_API int (lua_isstring) (lua_State *L, int idx); |
||||
LUA_API int (lua_iscfunction) (lua_State *L, int idx); |
||||
LUA_API int (lua_isinteger) (lua_State *L, int idx); |
||||
LUA_API int (lua_isuserdata) (lua_State *L, int idx); |
||||
LUA_API int (lua_type) (lua_State *L, int idx); |
||||
LUA_API const char *(lua_typename) (lua_State *L, int tp); |
||||
|
||||
LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); |
||||
LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); |
||||
LUA_API int (lua_toboolean) (lua_State *L, int idx); |
||||
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); |
||||
LUA_API size_t (lua_rawlen) (lua_State *L, int idx); |
||||
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); |
||||
LUA_API void *(lua_touserdata) (lua_State *L, int idx); |
||||
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); |
||||
LUA_API const void *(lua_topointer) (lua_State *L, int idx); |
||||
|
||||
|
||||
/*
|
||||
** Comparison and arithmetic functions |
||||
*/ |
||||
|
||||
#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ |
||||
#define LUA_OPSUB 1 |
||||
#define LUA_OPMUL 2 |
||||
#define LUA_OPMOD 3 |
||||
#define LUA_OPPOW 4 |
||||
#define LUA_OPDIV 5 |
||||
#define LUA_OPIDIV 6 |
||||
#define LUA_OPBAND 7 |
||||
#define LUA_OPBOR 8 |
||||
#define LUA_OPBXOR 9 |
||||
#define LUA_OPSHL 10 |
||||
#define LUA_OPSHR 11 |
||||
#define LUA_OPUNM 12 |
||||
#define LUA_OPBNOT 13 |
||||
|
||||
LUA_API void (lua_arith) (lua_State *L, int op); |
||||
|
||||
#define LUA_OPEQ 0 |
||||
#define LUA_OPLT 1 |
||||
#define LUA_OPLE 2 |
||||
|
||||
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); |
||||
LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); |
||||
|
||||
|
||||
/*
|
||||
** push functions (C -> stack) |
||||
*/ |
||||
LUA_API void (lua_pushnil) (lua_State *L); |
||||
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); |
||||
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); |
||||
LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); |
||||
LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); |
||||
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, |
||||
va_list argp); |
||||
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); |
||||
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); |
||||
LUA_API void (lua_pushboolean) (lua_State *L, int b); |
||||
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); |
||||
LUA_API int (lua_pushthread) (lua_State *L); |
||||
|
||||
|
||||
/*
|
||||
** get functions (Lua -> stack) |
||||
*/ |
||||
LUA_API int (lua_getglobal) (lua_State *L, const char *name); |
||||
LUA_API int (lua_gettable) (lua_State *L, int idx); |
||||
LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); |
||||
LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); |
||||
LUA_API int (lua_rawget) (lua_State *L, int idx); |
||||
LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); |
||||
LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); |
||||
|
||||
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
||||
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); |
||||
LUA_API int (lua_getmetatable) (lua_State *L, int objindex); |
||||
LUA_API int (lua_getuservalue) (lua_State *L, int idx); |
||||
|
||||
|
||||
/*
|
||||
** set functions (stack -> Lua) |
||||
*/ |
||||
LUA_API void (lua_setglobal) (lua_State *L, const char *name); |
||||
LUA_API void (lua_settable) (lua_State *L, int idx); |
||||
LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); |
||||
LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); |
||||
LUA_API void (lua_rawset) (lua_State *L, int idx); |
||||
LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); |
||||
LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); |
||||
LUA_API int (lua_setmetatable) (lua_State *L, int objindex); |
||||
LUA_API void (lua_setuservalue) (lua_State *L, int idx); |
||||
|
||||
|
||||
/*
|
||||
** 'load' and 'call' functions (load and run Lua code) |
||||
*/ |
||||
LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, |
||||
lua_KContext ctx, lua_KFunction k); |
||||
#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) |
||||
|
||||
LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, |
||||
lua_KContext ctx, lua_KFunction k); |
||||
#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) |
||||
|
||||
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, |
||||
const char *chunkname, const char *mode); |
||||
|
||||
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); |
||||
|
||||
|
||||
/*
|
||||
** coroutine functions |
||||
*/ |
||||
LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, |
||||
lua_KFunction k); |
||||
LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); |
||||
LUA_API int (lua_status) (lua_State *L); |
||||
LUA_API int (lua_isyieldable) (lua_State *L); |
||||
|
||||
#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) |
||||
|
||||
|
||||
/*
|
||||
** garbage-collection function and options |
||||
*/ |
||||
|
||||
#define LUA_GCSTOP 0 |
||||
#define LUA_GCRESTART 1 |
||||
#define LUA_GCCOLLECT 2 |
||||
#define LUA_GCCOUNT 3 |
||||
#define LUA_GCCOUNTB 4 |
||||
#define LUA_GCSTEP 5 |
||||
#define LUA_GCSETPAUSE 6 |
||||
#define LUA_GCSETSTEPMUL 7 |
||||
#define LUA_GCISRUNNING 9 |
||||
|
||||
LUA_API int (lua_gc) (lua_State *L, int what, int data); |
||||
|
||||
|
||||
/*
|
||||
** miscellaneous functions |
||||
*/ |
||||
|
||||
LUA_API int (lua_error) (lua_State *L); |
||||
|
||||
LUA_API int (lua_next) (lua_State *L, int idx); |
||||
|
||||
LUA_API void (lua_concat) (lua_State *L, int n); |
||||
LUA_API void (lua_len) (lua_State *L, int idx); |
||||
|
||||
LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); |
||||
|
||||
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
||||
LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); |
||||
|
||||
|
||||
|
||||
/*
|
||||
** {============================================================== |
||||
** some useful macros |
||||
** =============================================================== |
||||
*/ |
||||
|
||||
#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) |
||||
|
||||
#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) |
||||
#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) |
||||
|
||||
#define lua_pop(L,n) lua_settop(L, -(n)-1) |
||||
|
||||
#define lua_newtable(L) lua_createtable(L, 0, 0) |
||||
|
||||
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) |
||||
|
||||
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
||||
|
||||
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) |
||||
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) |
||||
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) |
||||
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) |
||||
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) |
||||
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) |
||||
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) |
||||
#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) |
||||
|
||||
#define lua_pushliteral(L, s) lua_pushstring(L, "" s) |
||||
|
||||
#define lua_pushglobaltable(L) \ |
||||
((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)) |
||||
|
||||
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) |
||||
|
||||
|
||||
#define lua_insert(L,idx) lua_rotate(L, (idx), 1) |
||||
|
||||
#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) |
||||
|
||||
#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) |
||||
|
||||
/* }============================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {============================================================== |
||||
** compatibility macros for unsigned conversions |
||||
** =============================================================== |
||||
*/ |
||||
#if defined(LUA_COMPAT_APIINTCASTS) |
||||
|
||||
#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) |
||||
#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) |
||||
#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) |
||||
|
||||
#endif |
||||
/* }============================================================== */ |
||||
|
||||
/*
|
||||
** {====================================================================== |
||||
** Debug API |
||||
** ======================================================================= |
||||
*/ |
||||
|
||||
|
||||
/*
|
||||
** Event codes |
||||
*/ |
||||
#define LUA_HOOKCALL 0 |
||||
#define LUA_HOOKRET 1 |
||||
#define LUA_HOOKLINE 2 |
||||
#define LUA_HOOKCOUNT 3 |
||||
#define LUA_HOOKTAILCALL 4 |
||||
|
||||
|
||||
/*
|
||||
** Event masks |
||||
*/ |
||||
#define LUA_MASKCALL (1 << LUA_HOOKCALL) |
||||
#define LUA_MASKRET (1 << LUA_HOOKRET) |
||||
#define LUA_MASKLINE (1 << LUA_HOOKLINE) |
||||
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) |
||||
|
||||
typedef struct lua_Debug lua_Debug; /* activation record */ |
||||
|
||||
|
||||
/* Functions to be called by the debugger in specific events */ |
||||
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); |
||||
|
||||
|
||||
LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); |
||||
LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); |
||||
LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); |
||||
LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); |
||||
LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); |
||||
LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); |
||||
|
||||
LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); |
||||
LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, |
||||
int fidx2, int n2); |
||||
|
||||
LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); |
||||
LUA_API lua_Hook (lua_gethook) (lua_State *L); |
||||
LUA_API int (lua_gethookmask) (lua_State *L); |
||||
LUA_API int (lua_gethookcount) (lua_State *L); |
||||
|
||||
|
||||
struct lua_Debug { |
||||
int event; |
||||
const char *name; /* (n) */ |
||||
const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ |
||||
const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ |
||||
const char *source; /* (S) */ |
||||
int currentline; /* (l) */ |
||||
int linedefined; /* (S) */ |
||||
int lastlinedefined; /* (S) */ |
||||
unsigned char nups; /* (u) number of upvalues */ |
||||
unsigned char nparams;/* (u) number of parameters */ |
||||
char isvararg; /* (u) */ |
||||
char istailcall; /* (t) */ |
||||
char short_src[LUA_IDSIZE]; /* (S) */ |
||||
/* private part */ |
||||
struct CallInfo *i_ci; /* active function */ |
||||
}; |
||||
|
||||
/* }====================================================================== */ |
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright (C) 1994-2016 Lua.org, PUC-Rio. |
||||
* |
||||
* Permission is hereby granted, free of charge, to any person obtaining |
||||
* a copy of this software and associated documentation files (the |
||||
* "Software"), to deal in the Software without restriction, including |
||||
* without limitation the rights to use, copy, modify, merge, publish, |
||||
* distribute, sublicense, and/or sell copies of the Software, and to |
||||
* permit persons to whom the Software is furnished to do so, subject to |
||||
* the following conditions: |
||||
* |
||||
* The above copyright notice and this permission notice shall be |
||||
* included in all copies or substantial portions of the Software. |
||||
* |
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||||
******************************************************************************/ |
||||
|
||||
|
||||
#endif |
@ -0,0 +1,9 @@ |
||||
// lua.hpp
|
||||
// Lua header files for C++
|
||||
// <<extern "C">> not supplied automatically because Lua also compiles as C++
|
||||
|
||||
extern "C" { |
||||
#include "lua.h" |
||||
#include "lualib.h" |
||||
#include "lauxlib.h" |
||||
} |
@ -0,0 +1,769 @@ |
||||
/*
|
||||
** $Id: luaconf.h,v 1.255 2016/05/01 20:06:09 roberto Exp $ |
||||
** Configuration file for Lua |
||||
** See Copyright Notice in lua.h |
||||
*/ |
||||
|
||||
|
||||
#ifndef luaconf_h |
||||
#define luaconf_h |
||||
|
||||
#include <limits.h> |
||||
#include <stddef.h> |
||||
|
||||
|
||||
/*
|
||||
** =================================================================== |
||||
** Search for "@@" to find all configurable definitions. |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
|
||||
/*
|
||||
** {==================================================================== |
||||
** System Configuration: macros to adapt (if needed) Lua to some |
||||
** particular platform, for instance compiling it with 32-bit numbers or |
||||
** restricting it to C89. |
||||
** ===================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You |
||||
** can also define LUA_32BITS in the make file, but changing here you |
||||
** ensure that all software connected to Lua will be compiled with the |
||||
** same configuration. |
||||
*/ |
||||
/* #define LUA_32BITS */ |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_USE_C89 controls the use of non-ISO-C89 features. |
||||
** Define it if you want Lua to avoid the use of a few C99 features |
||||
** or Windows-specific features on Windows. |
||||
*/ |
||||
/* #define LUA_USE_C89 */ |
||||
|
||||
|
||||
/*
|
||||
** By default, Lua on Windows use (some) specific Windows features |
||||
*/ |
||||
#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) |
||||
#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ |
||||
#endif |
||||
|
||||
|
||||
#if defined(LUA_USE_WINDOWS) |
||||
#define LUA_DL_DLL /* enable support for DLL */ |
||||
#define LUA_USE_C89 /* broadly, Windows is C89 */ |
||||
#endif |
||||
|
||||
|
||||
#if defined(LUA_USE_LINUX) |
||||
#define LUA_USE_POSIX |
||||
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
||||
#define LUA_USE_READLINE /* needs some extra libraries */ |
||||
#endif |
||||
|
||||
|
||||
#if defined(LUA_USE_MACOSX) |
||||
#define LUA_USE_POSIX |
||||
#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ |
||||
#define LUA_USE_READLINE /* needs an extra library: -lreadline */ |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for |
||||
** C89 ('long' and 'double'); Windows always has '__int64', so it does |
||||
** not need to use this case. |
||||
*/ |
||||
#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) |
||||
#define LUA_C89_NUMBERS |
||||
#endif |
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. |
||||
*/ |
||||
/* avoid undefined shifts */ |
||||
#if ((INT_MAX >> 15) >> 15) >= 1 |
||||
#define LUAI_BITSINT 32 |
||||
#else |
||||
/* 'int' always must have at least 16 bits */ |
||||
#define LUAI_BITSINT 16 |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_INT_TYPE defines the type for Lua integers. |
||||
@@ LUA_FLOAT_TYPE defines the type for Lua floats. |
||||
** Lua should work fine with any mix of these options (if supported |
||||
** by your C compiler). The usual configurations are 64-bit integers |
||||
** and 'double' (the default), 32-bit integers and 'float' (for |
||||
** restricted platforms), and 'long'/'double' (for C compilers not |
||||
** compliant with C99, which may not have support for 'long long'). |
||||
*/ |
||||
|
||||
/* predefined options for LUA_INT_TYPE */ |
||||
#define LUA_INT_INT 1 |
||||
#define LUA_INT_LONG 2 |
||||
#define LUA_INT_LONGLONG 3 |
||||
|
||||
/* predefined options for LUA_FLOAT_TYPE */ |
||||
#define LUA_FLOAT_FLOAT 1 |
||||
#define LUA_FLOAT_DOUBLE 2 |
||||
#define LUA_FLOAT_LONGDOUBLE 3 |
||||
|
||||
#if defined(LUA_32BITS) /* { */ |
||||
/*
|
||||
** 32-bit integers and 'float' |
||||
*/ |
||||
#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ |
||||
#define LUA_INT_TYPE LUA_INT_INT |
||||
#else /* otherwise use 'long' */ |
||||
#define LUA_INT_TYPE LUA_INT_LONG |
||||
#endif |
||||
#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT |
||||
|
||||
#elif defined(LUA_C89_NUMBERS) /* }{ */ |
||||
/*
|
||||
** largest types available for C89 ('long' and 'double') |
||||
*/ |
||||
#define LUA_INT_TYPE LUA_INT_LONG |
||||
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE |
||||
|
||||
#endif /* } */ |
||||
|
||||
|
||||
/*
|
||||
** default configuration for 64-bit Lua ('long long' and 'double') |
||||
*/ |
||||
#if !defined(LUA_INT_TYPE) |
||||
#define LUA_INT_TYPE LUA_INT_LONGLONG |
||||
#endif |
||||
|
||||
#if !defined(LUA_FLOAT_TYPE) |
||||
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Configuration for Paths. |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for |
||||
** Lua libraries. |
||||
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for |
||||
** C libraries. |
||||
** CHANGE them if your machine has a non-conventional directory |
||||
** hierarchy or if you want to install your libraries in |
||||
** non-conventional directories. |
||||
*/ |
||||
#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
||||
#if defined(_WIN32) /* { */ |
||||
/*
|
||||
** In Windows, any exclamation mark ('!') in the path is replaced by the |
||||
** path of the directory of the executable file of the current process. |
||||
*/ |
||||
#define LUA_LDIR "!\\lua\\" |
||||
#define LUA_CDIR "!\\" |
||||
#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" |
||||
#define LUA_PATH_DEFAULT \ |
||||
LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
|
||||
LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
|
||||
".\\?.lua;" ".\\?\\init.lua" |
||||
#define LUA_CPATH_DEFAULT \ |
||||
LUA_CDIR"?.dll;" \
|
||||
LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
|
||||
LUA_CDIR"loadall.dll;" ".\\?.dll;" \
|
||||
LUA_CDIR"?53.dll;" ".\\?53.dll" |
||||
|
||||
#else /* }{ */ |
||||
|
||||
#define LUA_ROOT "/usr/local/" |
||||
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" |
||||
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" |
||||
#define LUA_PATH_DEFAULT \ |
||||
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
|
||||
"./?.lua;" "./?/init.lua" |
||||
#define LUA_CPATH_DEFAULT \ |
||||
LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so;" \
|
||||
LUA_CDIR"lib?53.so;" "./lib?53.so" |
||||
#endif /* } */ |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_DIRSEP is the directory separator (for submodules). |
||||
** CHANGE it if your machine does not use "/" as the directory separator |
||||
** and is not Windows. (On Windows Lua automatically uses "\".) |
||||
*/ |
||||
#if defined(_WIN32) |
||||
#define LUA_DIRSEP "\\" |
||||
#else |
||||
#define LUA_DIRSEP "/" |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Marks for exported symbols in the C code |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_API is a mark for all core API functions. |
||||
@@ LUALIB_API is a mark for all auxiliary library functions. |
||||
@@ LUAMOD_API is a mark for all standard library opening functions. |
||||
** CHANGE them if you need to define those functions in some special way. |
||||
** For instance, if you want to create one Windows DLL with the core and |
||||
** the libraries, you may want to use the following definition (define |
||||
** LUA_BUILD_AS_DLL to get it). |
||||
*/ |
||||
#if defined(LUA_BUILD_AS_DLL) /* { */ |
||||
|
||||
#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ |
||||
#define LUA_API __declspec(dllexport) |
||||
#else /* }{ */ |
||||
#define LUA_API __declspec(dllimport) |
||||
#endif /* } */ |
||||
|
||||
#else /* }{ */ |
||||
|
||||
#define LUA_API extern |
||||
|
||||
#endif /* } */ |
||||
|
||||
|
||||
/* more often than not the libs go together with the core */ |
||||
#define LUALIB_API LUA_API |
||||
#define LUAMOD_API LUALIB_API |
||||
|
||||
|
||||
/*
|
||||
@@ LUAI_FUNC is a mark for all extern functions that are not to be |
||||
** exported to outside modules. |
||||
@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables |
||||
** that are not to be exported to outside modules (LUAI_DDEF for |
||||
** definitions and LUAI_DDEC for declarations). |
||||
** CHANGE them if you need to mark them in some special way. Elf/gcc |
||||
** (versions 3.2 and later) mark them as "hidden" to optimize access |
||||
** when Lua is compiled as a shared library. Not all elf targets support |
||||
** this attribute. Unfortunately, gcc does not offer a way to check |
||||
** whether the target offers that support, and those without support |
||||
** give a warning about it. To avoid these warnings, change to the |
||||
** default definition. |
||||
*/ |
||||
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ |
||||
defined(__ELF__) /* { */ |
||||
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern |
||||
#else /* }{ */ |
||||
#define LUAI_FUNC extern |
||||
#endif /* } */ |
||||
|
||||
#define LUAI_DDEC LUAI_FUNC |
||||
#define LUAI_DDEF /* empty */ |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Compatibility with previous versions |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. |
||||
@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. |
||||
** You can define it to get all options, or change specific options |
||||
** to fit your specific needs. |
||||
*/ |
||||
#if defined(LUA_COMPAT_5_2) /* { */ |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated |
||||
** functions in the mathematical library. |
||||
*/ |
||||
#define LUA_COMPAT_MATHLIB |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. |
||||
*/ |
||||
#define LUA_COMPAT_BITLIB |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. |
||||
*/ |
||||
#define LUA_COMPAT_IPAIRS |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for |
||||
** manipulating other integer types (lua_pushunsigned, lua_tounsigned, |
||||
** luaL_checkint, luaL_checklong, etc.) |
||||
*/ |
||||
#define LUA_COMPAT_APIINTCASTS |
||||
|
||||
#endif /* } */ |
||||
|
||||
|
||||
#if defined(LUA_COMPAT_5_1) /* { */ |
||||
|
||||
/* Incompatibilities from 5.2 -> 5.3 */ |
||||
#define LUA_COMPAT_MATHLIB |
||||
#define LUA_COMPAT_APIINTCASTS |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. |
||||
** You can replace it with 'table.unpack'. |
||||
*/ |
||||
#define LUA_COMPAT_UNPACK |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. |
||||
** You can replace it with 'package.searchers'. |
||||
*/ |
||||
#define LUA_COMPAT_LOADERS |
||||
|
||||
/*
|
||||
@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. |
||||
** You can call your C function directly (with light C functions). |
||||
*/ |
||||
#define lua_cpcall(L,f,u) \ |
||||
(lua_pushcfunction(L, (f)), \
|
||||
lua_pushlightuserdata(L,(u)), \
|
||||
lua_pcall(L,1,0,0)) |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. |
||||
** You can rewrite 'log10(x)' as 'log(x, 10)'. |
||||
*/ |
||||
#define LUA_COMPAT_LOG10 |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base |
||||
** library. You can rewrite 'loadstring(s)' as 'load(s)'. |
||||
*/ |
||||
#define LUA_COMPAT_LOADSTRING |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. |
||||
*/ |
||||
#define LUA_COMPAT_MAXN |
||||
|
||||
/*
|
||||
@@ The following macros supply trivial compatibility for some |
||||
** changes in the API. The macros themselves document how to |
||||
** change your code to avoid using them. |
||||
*/ |
||||
#define lua_strlen(L,i) lua_rawlen(L, (i)) |
||||
|
||||
#define lua_objlen(L,i) lua_rawlen(L, (i)) |
||||
|
||||
#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) |
||||
#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) |
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_MODULE controls compatibility with previous |
||||
** module functions 'module' (Lua) and 'luaL_register' (C). |
||||
*/ |
||||
#define LUA_COMPAT_MODULE |
||||
|
||||
#endif /* } */ |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a |
||||
@@ a float mark ('.0'). |
||||
** This macro is not on by default even in compatibility mode, |
||||
** because this is not really an incompatibility. |
||||
*/ |
||||
/* #define LUA_COMPAT_FLOATSTRING */ |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Configuration for Numbers. |
||||
** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* |
||||
** satisfy your needs. |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_NUMBER is the floating-point type used by Lua. |
||||
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' |
||||
@@ over a floating number. |
||||
@@ l_mathlim(x) corrects limit name 'x' to the proper float type |
||||
** by prefixing it with one of FLT/DBL/LDBL. |
||||
@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. |
||||
@@ LUA_NUMBER_FMT is the format for writing floats. |
||||
@@ lua_number2str converts a float to a string. |
||||
@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. |
||||
@@ l_floor takes the floor of a float. |
||||
@@ lua_str2number converts a decimal numeric string to a number. |
||||
*/ |
||||
|
||||
|
||||
/* The following definitions are good for most cases here */ |
||||
|
||||
#define l_floor(x) (l_mathop(floor)(x)) |
||||
|
||||
#define lua_number2str(s,sz,n) l_sprintf((s), sz, LUA_NUMBER_FMT, (n)) |
||||
|
||||
/*
|
||||
@@ lua_numbertointeger converts a float number to an integer, or |
||||
** returns 0 if float is not within the range of a lua_Integer. |
||||
** (The range comparisons are tricky because of rounding. The tests |
||||
** here assume a two-complement representation, where MININTEGER always |
||||
** has an exact representation as a float; MAXINTEGER may not have one, |
||||
** and therefore its conversion to float may have an ill-defined value.) |
||||
*/ |
||||
#define lua_numbertointeger(n,p) \ |
||||
((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
|
||||
(n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
|
||||
(*(p) = (LUA_INTEGER)(n), 1)) |
||||
|
||||
|
||||
/* now the variable definitions */ |
||||
|
||||
#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ |
||||
|
||||
#define LUA_NUMBER float |
||||
|
||||
#define l_mathlim(n) (FLT_##n) |
||||
|
||||
#define LUAI_UACNUMBER double |
||||
|
||||
#define LUA_NUMBER_FRMLEN "" |
||||
#define LUA_NUMBER_FMT "%.7g" |
||||
|
||||
#define l_mathop(op) op##f |
||||
|
||||
#define lua_str2number(s,p) strtof((s), (p)) |
||||
|
||||
|
||||
#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ |
||||
|
||||
#define LUA_NUMBER long double |
||||
|
||||
#define l_mathlim(n) (LDBL_##n) |
||||
|
||||
#define LUAI_UACNUMBER long double |
||||
|
||||
#define LUA_NUMBER_FRMLEN "L" |
||||
#define LUA_NUMBER_FMT "%.19Lg" |
||||
|
||||
#define l_mathop(op) op##l |
||||
|
||||
#define lua_str2number(s,p) strtold((s), (p)) |
||||
|
||||
#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ |
||||
|
||||
#define LUA_NUMBER double |
||||
|
||||
#define l_mathlim(n) (DBL_##n) |
||||
|
||||
#define LUAI_UACNUMBER double |
||||
|
||||
#define LUA_NUMBER_FRMLEN "" |
||||
#define LUA_NUMBER_FMT "%.14g" |
||||
|
||||
#define l_mathop(op) op |
||||
|
||||
#define lua_str2number(s,p) strtod((s), (p)) |
||||
|
||||
#else /* }{ */ |
||||
|
||||
#error "numeric float type not defined" |
||||
|
||||
#endif /* } */ |
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ LUA_INTEGER is the integer type used by Lua. |
||||
** |
||||
@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. |
||||
** |
||||
@@ LUAI_UACINT is the result of an 'usual argument conversion' |
||||
@@ over a lUA_INTEGER. |
||||
@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. |
||||
@@ LUA_INTEGER_FMT is the format for writing integers. |
||||
@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. |
||||
@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. |
||||
@@ lua_integer2str converts an integer to a string. |
||||
*/ |
||||
|
||||
|
||||
/* The following definitions are good for most cases here */ |
||||
|
||||
#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" |
||||
#define lua_integer2str(s,sz,n) l_sprintf((s), sz, LUA_INTEGER_FMT, (n)) |
||||
|
||||
#define LUAI_UACINT LUA_INTEGER |
||||
|
||||
/*
|
||||
** use LUAI_UACINT here to avoid problems with promotions (which |
||||
** can turn a comparison between unsigneds into a signed comparison) |
||||
*/ |
||||
#define LUA_UNSIGNED unsigned LUAI_UACINT |
||||
|
||||
|
||||
/* now the variable definitions */ |
||||
|
||||
#if LUA_INT_TYPE == LUA_INT_INT /* { int */ |
||||
|
||||
#define LUA_INTEGER int |
||||
#define LUA_INTEGER_FRMLEN "" |
||||
|
||||
#define LUA_MAXINTEGER INT_MAX |
||||
#define LUA_MININTEGER INT_MIN |
||||
|
||||
#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ |
||||
|
||||
#define LUA_INTEGER long |
||||
#define LUA_INTEGER_FRMLEN "l" |
||||
|
||||
#define LUA_MAXINTEGER LONG_MAX |
||||
#define LUA_MININTEGER LONG_MIN |
||||
|
||||
#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ |
||||
|
||||
/* use presence of macro LLONG_MAX as proxy for C99 compliance */ |
||||
#if defined(LLONG_MAX) /* { */ |
||||
/* use ISO C99 stuff */ |
||||
|
||||
#define LUA_INTEGER long long |
||||
#define LUA_INTEGER_FRMLEN "ll" |
||||
|
||||
#define LUA_MAXINTEGER LLONG_MAX |
||||
#define LUA_MININTEGER LLONG_MIN |
||||
|
||||
#elif defined(LUA_USE_WINDOWS) /* }{ */ |
||||
/* in Windows, can use specific Windows types */ |
||||
|
||||
#define LUA_INTEGER __int64 |
||||
#define LUA_INTEGER_FRMLEN "I64" |
||||
|
||||
#define LUA_MAXINTEGER _I64_MAX |
||||
#define LUA_MININTEGER _I64_MIN |
||||
|
||||
#else /* }{ */ |
||||
|
||||
#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ |
||||
or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" |
||||
|
||||
#endif /* } */ |
||||
|
||||
#else /* }{ */ |
||||
|
||||
#error "numeric integer type not defined" |
||||
|
||||
#endif /* } */ |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Dependencies with C99 and other C details |
||||
** =================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. |
||||
** (All uses in Lua have only one format item.) |
||||
*/ |
||||
#if !defined(LUA_USE_C89) |
||||
#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) |
||||
#else |
||||
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ lua_strx2number converts an hexadecimal numeric string to a number. |
||||
** In C99, 'strtod' does that conversion. Otherwise, you can |
||||
** leave 'lua_strx2number' undefined and Lua will provide its own |
||||
** implementation. |
||||
*/ |
||||
#if !defined(LUA_USE_C89) |
||||
#define lua_strx2number(s,p) lua_str2number(s,p) |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ lua_number2strx converts a float to an hexadecimal numeric string.
|
||||
** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. |
||||
** Otherwise, you can leave 'lua_number2strx' undefined and Lua will |
||||
** provide its own implementation. |
||||
*/ |
||||
#if !defined(LUA_USE_C89) |
||||
#define lua_number2strx(L,b,sz,f,n) ((void)L, l_sprintf(b,sz,f,n)) |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
** 'strtof' and 'opf' variants for math functions are not valid in |
||||
** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the |
||||
** availability of these variants. ('math.h' is already included in |
||||
** all files that use these macros.) |
||||
*/ |
||||
#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) |
||||
#undef l_mathop /* variants not available */ |
||||
#undef lua_str2number |
||||
#define l_mathop(op) (lua_Number)op /* no variant */ |
||||
#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation |
||||
** functions. It must be a numerical type; Lua will use 'intptr_t' if |
||||
** available, otherwise it will use 'ptrdiff_t' (the nearest thing to |
||||
** 'intptr_t' in C89) |
||||
*/ |
||||
#define LUA_KCONTEXT ptrdiff_t |
||||
|
||||
#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ |
||||
__STDC_VERSION__ >= 199901L |
||||
#include <stdint.h> |
||||
#if defined(INTPTR_MAX) /* even in C99 this type is optional */ |
||||
#undef LUA_KCONTEXT |
||||
#define LUA_KCONTEXT intptr_t |
||||
#endif |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). |
||||
** Change that if you do not want to use C locales. (Code using this |
||||
** macro must include header 'locale.h'.) |
||||
*/ |
||||
#if !defined(lua_getlocaledecpoint) |
||||
#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Language Variations |
||||
** ===================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some |
||||
** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from |
||||
** numbers to strings. Define LUA_NOCVTS2N to turn off automatic |
||||
** coercion from strings to numbers. |
||||
*/ |
||||
/* #define LUA_NOCVTN2S */ |
||||
/* #define LUA_NOCVTS2N */ |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_USE_APICHECK turns on several consistency checks on the C API. |
||||
** Define it as a help when debugging C code. |
||||
*/ |
||||
#if defined(LUA_USE_APICHECK) |
||||
#include <assert.h> |
||||
#define luai_apicheck(l,e) assert(e) |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
** {================================================================== |
||||
** Macros that affect the API and must be stable (that is, must be the |
||||
** same when you compile Lua and when you compile code that links to |
||||
** Lua). You probably do not want/need to change them. |
||||
** ===================================================================== |
||||
*/ |
||||
|
||||
/*
|
||||
@@ LUAI_MAXSTACK limits the size of the Lua stack. |
||||
** CHANGE it if you need a different limit. This limit is arbitrary; |
||||
** its only purpose is to stop Lua from consuming unlimited stack |
||||
** space (and to reserve some numbers for pseudo-indices). |
||||
*/ |
||||
#if LUAI_BITSINT >= 32 |
||||
#define LUAI_MAXSTACK 1000000 |
||||
#else |
||||
#define LUAI_MAXSTACK 15000 |
||||
#endif |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_EXTRASPACE defines the size of a raw memory area associated with |
||||
** a Lua state with very fast access. |
||||
** CHANGE it if you need a different size. |
||||
*/ |
||||
#define LUA_EXTRASPACE (sizeof(void *)) |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_IDSIZE gives the maximum size for the description of the source |
||||
@@ of a function in debug information. |
||||
** CHANGE it if you want a different size. |
||||
*/ |
||||
#define LUA_IDSIZE 60 |
||||
|
||||
|
||||
/*
|
||||
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. |
||||
** CHANGE it if it uses too much C-stack space. (For long double, |
||||
** 'string.format("%.99f", 1e4932)' needs ~5030 bytes, so a |
||||
** smaller buffer would force a memory allocation for each call to |
||||
** 'string.format'.) |
||||
*/ |
||||
#if defined(LUA_FLOAT_LONGDOUBLE) |
||||
#define LUAL_BUFFERSIZE 8192 |
||||
#else |
||||
#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) |
||||
#endif |
||||
|
||||
/* }================================================================== */ |
||||
|
||||
|
||||
/*
|
||||
@@ LUA_QL describes how error messages quote program elements. |
||||
** Lua does not use these macros anymore; they are here for |
||||
** compatibility only. |
||||
*/ |
||||
#define LUA_QL(x) "'" x "'" |
||||
#define LUA_QS LUA_QL("%s") |
||||
|
||||
|
||||
|
||||
|
||||
/* =================================================================== */ |
||||
|
||||
/*
|
||||
** Local configuration. You can use this space to add your redefinitions |
||||
** without modifying the main part of the file. |
||||
*/ |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif |
||||
|
@ -0,0 +1,58 @@ |
||||
/*
|
||||
** $Id: lualib.h,v 1.44 2014/02/06 17:32:33 roberto Exp $ |
||||
** Lua standard libraries |
||||
** See Copyright Notice in lua.h |
||||
*/ |
||||
|
||||
|
||||
#ifndef lualib_h |
||||
#define lualib_h |
||||
|
||||
#include "lua.h" |
||||
|
||||
|
||||
|
||||
LUAMOD_API int (luaopen_base) (lua_State *L); |
||||
|
||||
#define LUA_COLIBNAME "coroutine" |
||||
LUAMOD_API int (luaopen_coroutine) (lua_State *L); |
||||
|
||||
#define LUA_TABLIBNAME "table" |
||||
LUAMOD_API int (luaopen_table) (lua_State *L); |
||||
|
||||
#define LUA_IOLIBNAME "io" |
||||
LUAMOD_API int (luaopen_io) (lua_State *L); |
||||
|
||||
#define LUA_OSLIBNAME "os" |
||||
LUAMOD_API int (luaopen_os) (lua_State *L); |
||||
|
||||
#define LUA_STRLIBNAME "string" |
||||
LUAMOD_API int (luaopen_string) (lua_State *L); |
||||
|
||||
#define LUA_UTF8LIBNAME "utf8" |
||||
LUAMOD_API int (luaopen_utf8) (lua_State *L); |
||||
|
||||
#define LUA_BITLIBNAME "bit32" |
||||
LUAMOD_API int (luaopen_bit32) (lua_State *L); |
||||
|
||||
#define LUA_MATHLIBNAME "math" |
||||
LUAMOD_API int (luaopen_math) (lua_State *L); |
||||
|
||||
#define LUA_DBLIBNAME "debug" |
||||
LUAMOD_API int (luaopen_debug) (lua_State *L); |
||||
|
||||
#define LUA_LOADLIBNAME "package" |
||||
LUAMOD_API int (luaopen_package) (lua_State *L); |
||||
|
||||
|
||||
/* open all previous libraries */ |
||||
LUALIB_API void (luaL_openlibs) (lua_State *L); |
||||
|
||||
|
||||
|
||||
#if !defined(lua_assert) |
||||
#define lua_assert(x) ((void)0) |
||||
#endif |
||||
|
||||
|
||||
#endif |
@ -0,0 +1,716 @@ |
||||
# Blender v2.79 (sub 0) OBJ File: 'olc_building0.blend' |
||||
# www.blender.org |
||||
mtllib olc_building0.mtl |
||||
o Plane |
||||
v 0.000000 0.000000 0.000000 |
||||
v 0.000000 -1.000000 0.000000 |
||||
v -1.000000 0.000000 0.000000 |
||||
v -1.000000 -1.000000 0.000000 |
||||
v -0.025000 -0.412671 -0.052133 |
||||
v -0.025000 -0.587329 -0.052133 |
||||
v -0.975000 -0.025000 -0.050000 |
||||
v -0.975000 -0.975000 -0.050000 |
||||
v -1.000000 0.000000 -0.050000 |
||||
v 0.000000 0.000000 -0.050000 |
||||
v 0.000000 -1.000000 -0.050000 |
||||
v -1.000000 -1.000000 -0.050000 |
||||
v -0.975000 -0.025000 -0.517611 |
||||
v -0.975000 -0.975000 -0.517611 |
||||
v -1.000000 0.000000 -0.527316 |
||||
v 0.000000 0.000000 -0.527316 |
||||
v 0.000000 -1.000000 -0.527316 |
||||
v -1.000000 -1.000000 -0.527316 |
||||
v -0.975000 -0.025000 -0.550000 |
||||
v -0.025000 -0.025000 -0.550000 |
||||
v -0.025000 -0.975000 -0.550000 |
||||
v -0.975000 -0.975000 -0.550000 |
||||
v -0.025000 -0.601364 -0.402078 |
||||
v -0.025000 -0.601364 -0.044706 |
||||
v -0.025000 -0.398636 -0.044706 |
||||
v -0.025000 -0.398636 -0.402078 |
||||
v -0.374620 -0.412671 -0.045097 |
||||
v -0.374620 -0.587329 -0.047815 |
||||
v -0.374620 -0.587329 -0.388044 |
||||
v -0.374620 -0.412671 -0.388044 |
||||
v -0.005099 -0.601364 -0.402078 |
||||
v -0.005099 -0.601364 -0.044706 |
||||
v -0.005099 -0.398636 -0.044706 |
||||
v -0.005099 -0.398636 -0.402078 |
||||
v -0.005099 -0.587329 -0.388044 |
||||
v -0.005099 -0.587329 -0.047815 |
||||
v -0.005099 -0.412671 -0.045097 |
||||
v -0.005099 -0.412671 -0.388044 |
||||
v -0.017305 -0.419472 -0.044438 |
||||
v -0.017305 -0.594130 -0.044438 |
||||
v -0.025000 -0.975000 -0.517611 |
||||
v -0.025000 -0.975000 -0.050000 |
||||
v -0.025000 -0.601364 -0.402078 |
||||
v -0.025000 -0.601364 -0.044706 |
||||
v -0.025000 -0.025000 -0.050000 |
||||
v -0.025000 -0.025000 -0.517611 |
||||
v -0.025000 -0.398636 -0.044706 |
||||
v -0.025000 -0.398636 -0.402078 |
||||
v -0.925000 -0.075000 -1.550000 |
||||
v -0.075000 -0.075000 -1.550000 |
||||
v -0.075000 -0.925000 -1.550000 |
||||
v -0.925000 -0.925000 -1.550000 |
||||
v -0.975000 -0.025000 -1.550000 |
||||
v -0.025000 -0.025000 -1.550000 |
||||
v -0.025000 -0.975000 -1.550000 |
||||
v -0.975000 -0.975000 -1.550000 |
||||
v -0.975000 -0.025000 -1.600000 |
||||
v -0.025000 -0.025000 -1.600000 |
||||
v -0.025000 -0.975000 -1.600000 |
||||
v -0.975000 -0.975000 -1.600000 |
||||
v -0.925000 -0.075000 -1.600000 |
||||
v -0.075000 -0.075000 -1.600000 |
||||
v -0.075000 -0.925000 -1.600000 |
||||
v -0.925000 -0.925000 -1.600000 |
||||
v 0.160449 -0.127295 -1.107365 |
||||
v 0.160449 -0.127295 -1.287365 |
||||
v -0.026426 -0.127295 -1.107365 |
||||
v -0.026426 -0.127295 -1.287365 |
||||
v 0.160449 -0.427295 -1.107365 |
||||
v 0.160449 -0.427295 -1.287365 |
||||
v -0.026426 -0.427295 -1.107365 |
||||
v -0.026426 -0.427295 -1.287365 |
||||
v -0.026426 -0.127295 -1.287365 |
||||
v -0.026426 -0.127295 -1.107365 |
||||
v 0.160449 -0.127295 -1.287365 |
||||
v 0.160449 -0.127295 -1.107365 |
||||
v 0.160449 -0.427295 -1.287365 |
||||
v 0.160449 -0.427295 -1.107365 |
||||
v 0.160449 -0.127295 -1.287365 |
||||
v 0.160449 -0.127295 -1.107365 |
||||
v -0.026426 -0.427295 -1.287365 |
||||
v -0.026426 -0.427295 -1.107365 |
||||
v 0.160449 -0.427295 -1.287365 |
||||
v 0.160449 -0.427295 -1.107365 |
||||
v -0.157753 -0.144986 -1.539514 |
||||
v -0.157753 -0.144986 -1.637282 |
||||
v -0.240677 -0.144986 -1.539514 |
||||
v -0.240677 -0.144986 -1.637282 |
||||
v -0.157753 -0.328413 -1.539514 |
||||
v -0.157753 -0.328413 -1.637282 |
||||
v -0.240677 -0.328413 -1.539514 |
||||
v -0.240677 -0.328413 -1.637282 |
||||
v -0.480538 -0.445573 -1.455033 |
||||
v -0.480538 -0.445573 -1.817243 |
||||
v -0.732419 -0.445573 -1.455033 |
||||
v -0.732419 -0.445573 -1.817243 |
||||
v -0.480538 -0.823959 -1.455033 |
||||
v -0.480538 -0.823959 -1.685969 |
||||
v -0.732419 -0.823959 -1.455033 |
||||
v -0.732419 -0.823959 -1.685969 |
||||
v -0.157753 -0.144986 -1.539514 |
||||
v -0.157753 -0.144986 -1.637282 |
||||
v -0.240677 -0.144986 -1.539514 |
||||
v -0.240677 -0.144986 -1.637282 |
||||
v -0.157753 -0.328413 -1.539514 |
||||
v -0.157753 -0.328413 -1.637282 |
||||
v -0.240677 -0.328413 -1.539514 |
||||
v -0.240677 -0.328413 -1.637282 |
||||
v -0.026426 -0.585532 -1.287365 |
||||
v -0.026426 -0.585532 -1.107365 |
||||
v 0.160449 -0.585532 -1.287365 |
||||
v 0.160449 -0.585532 -1.107365 |
||||
v 0.160449 -0.885532 -1.287365 |
||||
v 0.160449 -0.885532 -1.107365 |
||||
v 0.160449 -0.585532 -1.287365 |
||||
v 0.160449 -0.585532 -1.107365 |
||||
v -0.026426 -0.885532 -1.287365 |
||||
v -0.026426 -0.885532 -1.107365 |
||||
v 0.160449 -0.885532 -1.287365 |
||||
v 0.160449 -0.885532 -1.107365 |
||||
v 0.160449 -0.586497 -0.622366 |
||||
v 0.160449 -0.586497 -0.802366 |
||||
v -0.026426 -0.586497 -0.622366 |
||||
v -0.026426 -0.586497 -0.802366 |
||||
v 0.160449 -0.886497 -0.802366 |
||||
v 0.160449 -0.886497 -0.622366 |
||||
v 0.160449 -0.586497 -0.802366 |
||||
v 0.160449 -0.586497 -0.622366 |
||||
v -0.026426 -0.886497 -0.802366 |
||||
v -0.026426 -0.886497 -0.622366 |
||||
v 0.160449 -0.886497 -0.802366 |
||||
v 0.160449 -0.886497 -0.622366 |
||||
v 0.160449 -0.126028 -0.622366 |
||||
v 0.160449 -0.126028 -0.802366 |
||||
v -0.026426 -0.126028 -0.622366 |
||||
v -0.026426 -0.126028 -0.802366 |
||||
v 0.160449 -0.426028 -0.802366 |
||||
v 0.160449 -0.426028 -0.622366 |
||||
v 0.160449 -0.126028 -0.802366 |
||||
v 0.160449 -0.126028 -0.622366 |
||||
v -0.026426 -0.426028 -0.802366 |
||||
v -0.026426 -0.426028 -0.622366 |
||||
v 0.160449 -0.426028 -0.802366 |
||||
v 0.160449 -0.426028 -0.622366 |
||||
v -0.026426 -0.585532 -1.287365 |
||||
v -0.026426 -0.585532 -1.107365 |
||||
v 0.160449 -0.585532 -1.287365 |
||||
v 0.160449 -0.585532 -1.107365 |
||||
v 0.160449 -0.885532 -1.287365 |
||||
v 0.160449 -0.885532 -1.107365 |
||||
v 0.160449 -0.585532 -1.287365 |
||||
v 0.160449 -0.585532 -1.107365 |
||||
v -0.026426 -0.885532 -1.287365 |
||||
v -0.026426 -0.885532 -1.107365 |
||||
v 0.160449 -0.885532 -1.287365 |
||||
v 0.160449 -0.885532 -1.107365 |
||||
v 0.160449 -0.586497 -0.622366 |
||||
v 0.160449 -0.586497 -0.802366 |
||||
v -0.026426 -0.586497 -0.622366 |
||||
v -0.026426 -0.586497 -0.802366 |
||||
v 0.160449 -0.886497 -0.802366 |
||||
v 0.160449 -0.886497 -0.622366 |
||||
v 0.160449 -0.586497 -0.802366 |
||||
v 0.160449 -0.586497 -0.622366 |
||||
v -0.026426 -0.886497 -0.802366 |
||||
v -0.026426 -0.886497 -0.622366 |
||||
v 0.160449 -0.886497 -0.802366 |
||||
v 0.160449 -0.886497 -0.622366 |
||||
v 0.160449 -0.126028 -0.622366 |
||||
v 0.160449 -0.126028 -0.802366 |
||||
v -0.026426 -0.126028 -0.622366 |
||||
v -0.026426 -0.126028 -0.802366 |
||||
v 0.160449 -0.426028 -0.802366 |
||||
v 0.160449 -0.426028 -0.622366 |
||||
v 0.160449 -0.126028 -0.802366 |
||||
v 0.160449 -0.126028 -0.622366 |
||||
v -0.026426 -0.426028 -0.802366 |
||||
v -0.026426 -0.426028 -0.622366 |
||||
v 0.160449 -0.426028 -0.802366 |
||||
v 0.160449 -0.426028 -0.622366 |
||||
v 0.160449 -0.584850 -1.107365 |
||||
v -0.026426 -0.584850 -1.107365 |
||||
v 0.160449 -0.884850 -1.107365 |
||||
v -0.026426 -0.884850 -1.107365 |
||||
v 0.160449 -0.127295 -0.622373 |
||||
v -0.026426 -0.127295 -0.622373 |
||||
v 0.160449 -0.427295 -0.622373 |
||||
v -0.026426 -0.427295 -0.622373 |
||||
v 0.160449 -0.584850 -0.622373 |
||||
v -0.026426 -0.584850 -0.622373 |
||||
v 0.160449 -0.884850 -0.622373 |
||||
v -0.026426 -0.884850 -0.622373 |
||||
vt 0.014847 0.403582 |
||||
vt 0.153703 0.694145 |
||||
vt 0.014847 0.694145 |
||||
vt 0.034115 0.694145 |
||||
vt 0.048963 1.000000 |
||||
vt 0.034115 1.000000 |
||||
vt 0.047359 0.372997 |
||||
vt 0.032511 0.067142 |
||||
vt 0.047358 0.067142 |
||||
vt 0.048963 0.694145 |
||||
vt 0.063810 1.000000 |
||||
vt 0.048963 1.000000 |
||||
vt 0.019268 0.694145 |
||||
vt 0.034115 1.000000 |
||||
vt 0.019268 1.000000 |
||||
vt 0.710478 0.701791 |
||||
vt 1.000000 0.694145 |
||||
vt 0.992576 0.701791 |
||||
vt 1.000000 1.000000 |
||||
vt 0.992576 0.992353 |
||||
vt 0.703054 1.000000 |
||||
vt 0.710478 0.992354 |
||||
vt 0.703054 0.694145 |
||||
vt 1.000000 0.051849 |
||||
vt 0.717901 0.357704 |
||||
vt 0.717901 0.051849 |
||||
vt 0.047359 0.082435 |
||||
vt 0.186214 0.372997 |
||||
vt 0.047359 0.372997 |
||||
vt 0.186214 0.082435 |
||||
vt 0.325069 0.372997 |
||||
vt 0.186214 0.372997 |
||||
vt 1.000000 1.000000 |
||||
vt 1.000000 1.000000 |
||||
vt 1.000000 1.000000 |
||||
vt 0.703054 0.694145 |
||||
vt 0.413541 0.701796 |
||||
vt 0.406108 0.694145 |
||||
vt 0.703054 1.000000 |
||||
vt 0.695640 0.701796 |
||||
vt 0.406108 1.000000 |
||||
vt 0.695640 0.992358 |
||||
vt 0.413541 0.992358 |
||||
vt 0.004421 0.885721 |
||||
vt 0.002849 0.709438 |
||||
vt 0.004421 0.823716 |
||||
vt 0.118100 0.779467 |
||||
vt 0.115894 0.721754 |
||||
vt 0.118100 0.726047 |
||||
vt 1.000000 1.000000 |
||||
vt 1.000000 1.000000 |
||||
vt 0.119844 0.783760 |
||||
vt 0.124009 0.890693 |
||||
vt 0.124009 0.890693 |
||||
vt 0.509125 0.003716 |
||||
vt 0.515034 0.113020 |
||||
vt 0.509125 0.113020 |
||||
vt 0.616064 0.113020 |
||||
vt 0.717901 0.000000 |
||||
vt 0.717901 0.113020 |
||||
vt 1.000000 1.000000 |
||||
vt 1.000000 1.000000 |
||||
vt 0.119842 0.995708 |
||||
vt 0.124009 0.890696 |
||||
vt 0.124009 1.000000 |
||||
vt 0.067977 0.995708 |
||||
vt 0.063810 0.890696 |
||||
vt 0.067977 0.890815 |
||||
vt 0.063810 1.000000 |
||||
vt 0.515034 0.113020 |
||||
vt 0.616064 0.000000 |
||||
vt 0.616064 0.113020 |
||||
vt 0.118100 0.721754 |
||||
vt 0.124009 0.783760 |
||||
vt 0.118100 0.783760 |
||||
vt 0.509125 0.113020 |
||||
vt 0.503215 0.003716 |
||||
vt 0.509125 0.003716 |
||||
vt 0.115815 0.777387 |
||||
vt 0.115815 0.723967 |
||||
vt 0.431190 0.196713 |
||||
vt 0.465497 0.082435 |
||||
vt 0.465497 0.372997 |
||||
vt 0.465497 0.113020 |
||||
vt 0.717901 0.372997 |
||||
vt 0.465497 0.372997 |
||||
vt 0.717901 0.372997 |
||||
vt 0.435802 0.678852 |
||||
vt 0.435802 0.372997 |
||||
vt 1.000000 0.372997 |
||||
vt 0.717901 0.678852 |
||||
vt 0.717901 0.372997 |
||||
vt 0.435802 0.372997 |
||||
vt 0.153703 0.678852 |
||||
vt 0.153703 0.372997 |
||||
vt 0.717901 0.678852 |
||||
vt 0.435802 0.694145 |
||||
vt 0.017664 0.372997 |
||||
vt 0.002817 0.113020 |
||||
vt 0.017664 0.113020 |
||||
vt 1.000000 0.357704 |
||||
vt 0.717901 0.372997 |
||||
vt 0.032511 0.372997 |
||||
vt 0.017664 0.372997 |
||||
vt 0.138856 0.724730 |
||||
vt 0.406108 0.709437 |
||||
vt 0.391260 0.724730 |
||||
vt 0.406108 1.000000 |
||||
vt 0.391260 0.984707 |
||||
vt 0.124009 1.000000 |
||||
vt 0.138856 0.984707 |
||||
vt 0.124009 0.709438 |
||||
vt 0.014847 0.694145 |
||||
vt 0.000000 0.434168 |
||||
vt 0.014847 0.434168 |
||||
vt 1.000000 0.678852 |
||||
vt 0.717901 0.694145 |
||||
vt 0.435802 0.678852 |
||||
vt 0.153703 0.694145 |
||||
vt 0.004421 0.740023 |
||||
vt 0.019268 1.000000 |
||||
vt 0.004421 1.000000 |
||||
vt 0.316450 0.067652 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.248111 0.067096 |
||||
vt 0.165675 0.015745 |
||||
vt 0.248111 0.015745 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.483784 0.005787 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.000000 0.000000 |
||||
vt 0.525322 0.836366 |
||||
vt 0.586878 0.919862 |
||||
vt 0.525322 0.919862 |
||||
vt 0.552285 0.749140 |
||||
vt 0.608723 0.836366 |
||||
vt 0.552285 0.836366 |
||||
vt 0.586878 0.894429 |
||||
vt 0.643316 0.836366 |
||||
vt 0.643316 0.894429 |
||||
vt 0.520203 0.749140 |
||||
vt 0.463765 0.836366 |
||||
vt 0.463765 0.749140 |
||||
vt 0.463765 0.836366 |
||||
vt 0.525322 0.928691 |
||||
vt 0.463765 0.928691 |
||||
vt 0.892836 0.808021 |
||||
vt 0.844939 0.752099 |
||||
vt 0.892836 0.752099 |
||||
vt 0.884262 0.808021 |
||||
vt 0.827791 0.912939 |
||||
vt 0.827791 0.808021 |
||||
vt 0.940733 0.808021 |
||||
vt 0.892836 0.752099 |
||||
vt 0.940733 0.752099 |
||||
vt 0.884262 0.912939 |
||||
vt 0.940733 0.808021 |
||||
vt 0.940733 0.912939 |
||||
vt 0.779894 0.808021 |
||||
vt 0.827791 0.912939 |
||||
vt 0.779894 0.912939 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.483784 0.005787 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.483784 0.005787 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.483784 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.005787 |
||||
vt 0.316450 0.067652 |
||||
vt 0.252222 0.005787 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.067652 |
||||
vt 0.316449 0.005787 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.067652 |
||||
vt 0.419557 0.005787 |
||||
vt 0.483784 0.005787 |
||||
vt 0.248111 0.067096 |
||||
vt 0.165675 0.015745 |
||||
vt 0.248111 0.015745 |
||||
vt 0.248111 0.067096 |
||||
vt 0.165675 0.015745 |
||||
vt 0.248111 0.015745 |
||||
vt 0.248111 0.067096 |
||||
vt 0.165675 0.015745 |
||||
vt 0.248111 0.015745 |
||||
vt 0.153703 0.403582 |
||||
vt 0.048963 0.694145 |
||||
vt 0.032511 0.372997 |
||||
vt 0.063810 0.694145 |
||||
vt 0.034115 0.694145 |
||||
vt 0.186214 0.082435 |
||||
vt 0.325069 0.082435 |
||||
vt 0.002849 1.000000 |
||||
vt 0.115894 0.783760 |
||||
vt 1.000000 1.000000 |
||||
vt 0.119840 0.890696 |
||||
vt 0.067976 0.890695 |
||||
vt 0.067979 0.783760 |
||||
vt 0.063810 0.890691 |
||||
vt 0.063810 0.890691 |
||||
vt 0.515034 0.003716 |
||||
vt 0.616064 0.000000 |
||||
vt 0.119842 0.891647 |
||||
vt 0.515034 0.000000 |
||||
vt 0.124009 0.721754 |
||||
vt 0.503215 0.113020 |
||||
vt 0.326641 0.372997 |
||||
vt 0.431190 0.258718 |
||||
vt 0.325069 0.258718 |
||||
vt 0.325069 0.196713 |
||||
vt 0.326641 0.082435 |
||||
vt 0.717901 0.113020 |
||||
vt 0.717901 0.694145 |
||||
vt 0.002817 0.372997 |
||||
vt 1.000000 0.372997 |
||||
vt 0.032511 0.113020 |
||||
vt 0.000000 0.694145 |
||||
vt 1.000000 0.694145 |
||||
vt 0.435802 0.694145 |
||||
vt 0.019268 0.740023 |
||||
vt 0.252222 0.067652 |
||||
vt 0.165675 0.067096 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.586878 0.836366 |
||||
vt 0.640804 0.749140 |
||||
vt 0.586878 0.836366 |
||||
vt 0.552285 0.836366 |
||||
vt 0.844939 0.808021 |
||||
vt 0.884262 0.912939 |
||||
vt 0.892836 0.808021 |
||||
vt 0.884262 0.808021 |
||||
vt 0.827791 0.808021 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.252222 0.067652 |
||||
vt 0.316450 0.067652 |
||||
vt 0.419557 0.067652 |
||||
vt 0.165675 0.067096 |
||||
vt 0.165675 0.067096 |
||||
vt 0.165675 0.067096 |
||||
vn 0.0000 -1.0000 0.0000 |
||||
vn -1.0000 0.0000 0.0000 |
||||
vn 1.0000 0.0000 0.0000 |
||||
vn 0.0000 1.0000 0.0000 |
||||
vn 0.0000 0.0000 -1.0000 |
||||
vn 0.0000 0.0000 1.0000 |
||||
vn 0.0000 0.6720 -0.7406 |
||||
vn 0.6720 0.0000 -0.7406 |
||||
vn 0.0000 -0.6720 -0.7406 |
||||
vn -0.6720 0.0000 -0.7406 |
||||
vn 0.7071 0.0000 -0.7071 |
||||
vn 0.0000 -0.3278 -0.9448 |
||||
vn -0.0178 0.4677 -0.8837 |
||||
vn -0.0123 0.0000 -0.9999 |
||||
vn -0.0201 0.0156 -0.9997 |
||||
vn -0.0109 -0.4677 -0.8838 |
||||
usemtl Material.001 |
||||
s off |
||||
f 8/1/1 41/2/1 42/3/1 |
||||
f 3/4/2 12/5/2 4/6/2 |
||||
f 2/7/3 10/8/3 1/9/3 |
||||
f 4/10/1 11/11/1 2/12/1 |
||||
f 1/13/4 9/14/4 3/15/4 |
||||
f 7/16/5 10/17/5 45/18/5 |
||||
f 45/18/5 11/19/5 42/20/5 |
||||
f 42/20/5 12/21/5 8/22/5 |
||||
f 8/22/5 9/23/5 7/16/5 |
||||
f 22/24/1 55/25/1 21/26/1 |
||||
f 45/27/4 13/28/4 7/29/4 |
||||
f 7/30/2 14/31/2 8/32/2 |
||||
f 43/33/6 26/34/6 23/35/6 |
||||
f 16/36/7 19/37/7 15/38/7 |
||||
f 17/39/8 20/40/8 16/36/8 |
||||
f 18/41/9 21/42/9 17/39/9 |
||||
f 15/38/10 22/43/10 18/41/10 |
||||
f 47/44/2 42/45/2 44/46/2 |
||||
f 5/47/3 44/48/3 6/49/3 |
||||
f 48/50/6 25/51/6 26/34/6 |
||||
f 27/52/6 25/53/6 47/54/6 |
||||
f 25/55/4 34/56/4 26/57/4 |
||||
f 30/58/1 37/59/1 27/60/1 |
||||
f 44/61/6 23/35/6 24/62/6 |
||||
f 35/63/3 32/64/3 31/65/3 |
||||
f 38/66/3 33/67/3 37/68/3 |
||||
f 35/63/3 34/69/3 38/66/3 |
||||
f 28/70/4 35/71/4 29/72/4 |
||||
f 26/73/5 31/74/5 23/75/5 |
||||
f 23/76/1 32/77/1 24/78/1 |
||||
f 6/49/11 39/79/11 40/80/11 |
||||
f 43/81/3 41/82/3 46/83/3 |
||||
f 51/84/5 49/85/5 50/86/5 |
||||
f 20/87/4 53/88/4 19/89/4 |
||||
f 19/90/2 56/91/2 22/92/2 |
||||
f 21/93/3 54/94/3 20/95/3 |
||||
f 54/96/4 57/97/4 53/88/4 |
||||
f 52/98/3 61/99/3 49/100/3 |
||||
f 56/101/1 59/102/1 55/25/1 |
||||
f 49/100/1 62/103/1 50/104/1 |
||||
f 61/105/5 58/106/5 62/107/5 |
||||
f 62/107/5 59/108/5 63/109/5 |
||||
f 63/109/5 60/110/5 64/111/5 |
||||
f 64/111/5 57/112/5 61/105/5 |
||||
f 50/113/2 63/114/2 51/115/2 |
||||
f 53/116/2 60/117/2 56/91/2 |
||||
f 55/118/3 58/119/3 54/94/3 |
||||
f 51/120/4 64/121/4 52/122/4 |
||||
f 66/123/4 67/124/4 65/125/4 |
||||
f 72/126/1 69/127/1 71/128/1 |
||||
f 70/129/3 65/125/3 69/127/3 |
||||
f 65/130/5 71/131/5 67/132/5 |
||||
f 74/133/1 75/134/1 76/135/1 |
||||
f 80/136/2 77/137/2 78/138/2 |
||||
f 84/139/4 81/140/4 82/141/4 |
||||
f 86/142/4 87/143/4 85/144/4 |
||||
f 88/145/2 91/146/2 87/143/2 |
||||
f 92/147/1 89/148/1 91/146/1 |
||||
f 90/149/3 85/144/3 89/148/3 |
||||
f 88/145/5 90/149/5 92/147/5 |
||||
f 94/150/4 95/151/4 93/152/4 |
||||
f 95/153/2 100/154/2 99/155/2 |
||||
f 100/156/1 97/157/1 99/158/1 |
||||
f 98/159/3 93/160/3 97/161/3 |
||||
f 96/162/12 98/163/12 100/164/12 |
||||
f 102/165/4 103/166/4 101/167/4 |
||||
f 104/168/2 107/169/2 103/170/2 |
||||
f 108/171/1 105/172/1 107/173/1 |
||||
f 106/174/3 101/175/3 105/176/3 |
||||
f 104/177/5 106/178/5 108/179/5 |
||||
f 110/180/1 111/181/1 112/182/1 |
||||
f 116/183/2 113/184/2 114/185/2 |
||||
f 120/186/4 117/187/4 118/188/4 |
||||
f 123/189/1 122/190/1 121/191/1 |
||||
f 128/192/2 125/193/2 126/194/2 |
||||
f 132/195/4 129/196/4 130/197/4 |
||||
f 135/198/1 134/199/1 133/200/1 |
||||
f 140/201/2 137/202/2 138/203/2 |
||||
f 144/204/4 141/205/4 142/206/4 |
||||
f 147/207/4 146/208/4 148/209/4 |
||||
f 149/210/3 152/211/3 150/212/3 |
||||
f 153/213/1 156/214/1 154/215/1 |
||||
f 158/216/4 159/217/4 157/218/4 |
||||
f 161/219/3 164/220/3 162/221/3 |
||||
f 165/222/1 168/223/1 166/224/1 |
||||
f 170/225/4 171/226/4 169/227/4 |
||||
f 173/228/3 176/229/3 174/230/3 |
||||
f 177/231/1 180/232/1 178/233/1 |
||||
f 181/234/5 184/235/5 182/236/5 |
||||
f 185/237/5 188/238/5 186/239/5 |
||||
f 189/240/5 192/241/5 190/242/5 |
||||
f 8/1/1 14/243/1 41/2/1 |
||||
f 3/4/2 9/244/2 12/5/2 |
||||
f 2/7/3 11/245/3 10/8/3 |
||||
f 4/10/1 12/246/1 11/11/1 |
||||
f 1/13/4 10/247/4 9/14/4 |
||||
f 7/16/5 9/23/5 10/17/5 |
||||
f 45/18/5 10/17/5 11/19/5 |
||||
f 42/20/5 11/19/5 12/21/5 |
||||
f 8/22/5 12/21/5 9/23/5 |
||||
f 22/24/1 56/101/1 55/25/1 |
||||
f 45/27/4 46/248/4 13/28/4 |
||||
f 7/30/2 13/249/2 14/31/2 |
||||
f 43/33/6 48/50/6 26/34/6 |
||||
f 16/36/7 20/40/7 19/37/7 |
||||
f 17/39/8 21/42/8 20/40/8 |
||||
f 18/41/9 22/43/9 21/42/9 |
||||
f 15/38/10 19/37/10 22/43/10 |
||||
f 47/44/2 45/250/2 42/45/2 |
||||
f 5/47/3 47/251/3 44/48/3 |
||||
f 48/50/6 47/252/6 25/51/6 |
||||
f 47/54/13 5/253/13 27/52/13 |
||||
f 5/253/14 6/254/14 28/255/14 |
||||
f 44/256/6 24/257/6 28/255/6 |
||||
f 5/253/15 28/255/15 27/52/15 |
||||
f 6/254/16 44/256/16 28/255/16 |
||||
f 25/55/4 33/258/4 34/56/4 |
||||
f 30/58/1 38/259/1 37/59/1 |
||||
f 44/61/6 43/33/6 23/35/6 |
||||
f 35/63/3 36/260/3 32/64/3 |
||||
f 38/66/3 34/69/3 33/67/3 |
||||
f 35/63/3 31/65/3 34/69/3 |
||||
f 28/70/4 36/261/4 35/71/4 |
||||
f 26/73/5 34/262/5 31/74/5 |
||||
f 23/76/1 31/263/1 32/77/1 |
||||
f 6/49/11 5/47/11 39/79/11 |
||||
f 46/83/3 45/264/3 48/265/3 |
||||
f 45/264/3 47/266/3 48/265/3 |
||||
f 44/267/3 42/268/3 43/81/3 |
||||
f 42/268/3 41/82/3 43/81/3 |
||||
f 46/83/3 48/265/3 43/81/3 |
||||
f 51/84/5 52/269/5 49/85/5 |
||||
f 20/87/4 54/96/4 53/88/4 |
||||
f 19/90/2 53/116/2 56/91/2 |
||||
f 21/93/3 55/118/3 54/94/3 |
||||
f 54/96/4 58/270/4 57/97/4 |
||||
f 52/98/3 64/271/3 61/99/3 |
||||
f 56/101/1 60/272/1 59/102/1 |
||||
f 49/100/1 61/273/1 62/103/1 |
||||
f 61/105/5 57/112/5 58/106/5 |
||||
f 62/107/5 58/106/5 59/108/5 |
||||
f 63/109/5 59/108/5 60/110/5 |
||||
f 64/111/5 60/110/5 57/112/5 |
||||
f 50/113/2 62/274/2 63/114/2 |
||||
f 53/116/2 57/275/2 60/117/2 |
||||
f 55/118/3 59/276/3 58/119/3 |
||||
f 51/120/4 63/277/4 64/121/4 |
||||
f 66/123/4 68/278/4 67/124/4 |
||||
f 72/126/1 70/129/1 69/127/1 |
||||
f 70/129/3 66/123/3 65/125/3 |
||||
f 65/130/5 69/279/5 71/131/5 |
||||
f 74/133/1 73/280/1 75/134/1 |
||||
f 80/136/2 79/281/2 77/137/2 |
||||
f 84/139/4 83/282/4 81/140/4 |
||||
f 86/142/4 88/145/4 87/143/4 |
||||
f 88/145/2 92/147/2 91/146/2 |
||||
f 92/147/1 90/149/1 89/148/1 |
||||
f 90/149/3 86/142/3 85/144/3 |
||||
f 88/145/5 86/142/5 90/149/5 |
||||
f 94/150/4 96/283/4 95/151/4 |
||||
f 95/153/2 96/284/2 100/154/2 |
||||
f 100/156/1 98/285/1 97/157/1 |
||||
f 98/159/3 94/286/3 93/160/3 |
||||
f 96/162/12 94/150/12 98/163/12 |
||||
f 102/165/4 104/287/4 103/166/4 |
||||
f 104/168/2 108/288/2 107/169/2 |
||||
f 108/171/1 106/289/1 105/172/1 |
||||
f 106/174/3 102/290/3 101/175/3 |
||||
f 104/177/5 102/291/5 106/178/5 |
||||
f 110/180/1 109/292/1 111/181/1 |
||||
f 116/183/2 115/293/2 113/184/2 |
||||
f 120/186/4 119/294/4 117/187/4 |
||||
f 123/189/1 124/295/1 122/190/1 |
||||
f 128/192/2 127/296/2 125/193/2 |
||||
f 132/195/4 131/297/4 129/196/4 |
||||
f 135/198/1 136/298/1 134/199/1 |
||||
f 140/201/2 139/299/2 137/202/2 |
||||
f 144/204/4 143/300/4 141/205/4 |
||||
f 147/207/4 145/301/4 146/208/4 |
||||
f 149/210/3 151/302/3 152/211/3 |
||||
f 153/213/1 155/303/1 156/214/1 |
||||
f 158/216/4 160/304/4 159/217/4 |
||||
f 161/219/3 163/305/3 164/220/3 |
||||
f 165/222/1 167/306/1 168/223/1 |
||||
f 170/225/4 172/307/4 171/226/4 |
||||
f 173/228/3 175/308/3 176/229/3 |
||||
f 177/231/1 179/309/1 180/232/1 |
||||
f 181/234/5 183/310/5 184/235/5 |
||||
f 185/237/5 187/311/5 188/238/5 |
||||
f 189/240/5 191/312/5 192/241/5 |
After Width: | Height: | Size: 494 KiB |
@ -0,0 +1,26 @@ |
||||
# Blender v2.79 (sub 0) OBJ File: 'unit_building.blend' |
||||
# www.blender.org |
||||
v 1.0000 1.000 -0.000 |
||||
v 1.0000 1.0 -0.50 |
||||
v 0.0000 1.00 -0.000 |
||||
v 0.0000 1.000 -0.5 |
||||
v 1.0 0.00 0.000 |
||||
v 1.0 0.00000 -0.5 |
||||
v -0.000081 0.004528 0.004407 |
||||
v -0.000081 0.000101 -0.495573 |
||||
vn 0.0002 1.0000 -0.0089 |
||||
vn -1.0000 0.0002 -0.0000 |
||||
vn -0.0002 -1.0000 0.0089 |
||||
vn 1.0000 -0.0002 0.0000 |
||||
vn -0.0000 -0.0089 -1.0000 |
||||
s off |
||||
f 2//1 3//1 1//1 |
||||
f 4//2 7//2 3//2 |
||||
f 8//3 5//3 7//3 |
||||
f 6//4 1//4 5//4 |
||||
f 4//5 6//5 8//5 |
||||
f 2//1 4//1 3//1 |
||||
f 4//2 8//2 7//2 |
||||
f 8//3 6//3 5//3 |
||||
f 6//4 2//4 1//4 |
||||
f 4//5 2//5 6//5 |
@ -0,0 +1,50 @@ |
||||
|
||||
|
||||
-- Size of pixel |
||||
PixelWidth = 2 |
||||
PixelHeight = 2 |
||||
|
||||
-- Size of display window in pixels |
||||
ScreenWidth = 768 |
||||
ScreenHeight = 480 |
||||
--ScreenWidth = 384 |
||||
--ScreenHeight = 240 |
||||
|
||||
FullScreen = false |
||||
|
||||
-- Default city parameters |
||||
DefaultMapWidth = 64 |
||||
DefaultMapHeight = 32 |
||||
--DefaultCityFile = "assets/cities/example1.city" |
||||
|
||||
|
||||
-- Textures used by various game systems |
||||
Textures = {} |
||||
Textures[1] = {"Grass", "assets/system/grass1.png"} |
||||
Textures[2] = {"AllRoads", "assets/system/roads4.png"} |
||||
Textures[3] = {"Water", "assets/system/water1.png"} |
||||
Textures[4] = {"Clouds", "assets/system/clouds2.png"} |
||||
Textures[5] = {"WaterSide", "assets/system/waterside1.png"} |
||||
Textures[6] = {"Smoke", "assets/system/skidsmoke1.png"} |
||||
|
||||
-- Buildings |
||||
Buildings = {} |
||||
Buildings[1] = {"javidx9", "UnitBuilding_1", "assets/buildings/unit_building.obj", "", |
||||
0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0} |
||||
Buildings[2] = {"UDXS", "Apartments_1", "assets/buildings/udxs_building1.obj", "assets/buildings/udxs_building1.png", |
||||
0.0, 0.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 0.0} |
||||
|
||||
Vehicles = {} |
||||
Vehicles[1] = {"JustinRM", "Sedan", "assets/vehicles/CarCrime_Sedan.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 1.5708, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
Vehicles[2] = {"JustinRM", "SUV", "assets/vehicles/CarCrime_SUV.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 0.0, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
Vehicles[3] = {"JustinRM", "TruckCab", "assets/vehicles/CarCrime_Truck_Cab.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 0.0, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
Vehicles[4] = {"JustinRM", "TruckTrailer", "assets/vehicles/CarCrime_Truck_Trailer.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 0.0, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
Vehicles[5] = {"JustinRM", "UTE", "assets/vehicles/CarCrime_Ute.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 0.0, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
Vehicles[6] = {"JustinRM", "Wagon", "assets/vehicles/CarCrime_Wahon.obj", "assets/vehicles/CarTex_256.png", |
||||
0.0, 0.0, 0.0, 0.05, 0.05, 0.05, 0.0, 0.0, 0.0} |
||||
|
After Width: | Height: | Size: 181 KiB |
After Width: | Height: | Size: 284 KiB |
After Width: | Height: | Size: 181 KiB |
After Width: | Height: | Size: 482 KiB |
After Width: | Height: | Size: 383 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 691 KiB |
After Width: | Height: | Size: 732 KiB |
After Width: | Height: | Size: 616 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,121 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v 0.600000 -0.400000 -1.700000 |
||||
v 0.600000 1.700000 -1.700000 |
||||
v -0.600000 -0.400000 -1.700000 |
||||
v -0.600000 1.700000 -1.700000 |
||||
v -0.800000 2.000000 -1.100000 |
||||
v 0.800000 2.000000 -1.100000 |
||||
v -0.800000 2.000000 -1.100000 |
||||
v 0.800000 2.000000 -1.100000 |
||||
v -0.800000 -1.000000 -0.950000 |
||||
v 0.800000 -1.000000 -0.950000 |
||||
v -0.800000 -2.000000 -0.900000 |
||||
v 0.800000 -2.000000 -0.900000 |
||||
v -0.800000 2.000000 -0.400000 |
||||
v 0.800000 2.000000 -0.400000 |
||||
v -0.800000 -2.000000 -0.400000 |
||||
v 0.800000 -2.000000 -0.400000 |
||||
v 0.800000 -2.000000 -0.400000 |
||||
v 0.800000 2.000000 -0.400000 |
||||
v 0.800000 -2.000000 -0.900000 |
||||
v 0.800000 2.000000 -1.100000 |
||||
v -0.800000 -2.000000 -0.900000 |
||||
v -0.800000 2.000000 -1.100000 |
||||
v -0.800000 -2.000000 -0.400000 |
||||
v -0.800000 2.000000 -0.400000 |
||||
v 0.780000 1.200000 -0.400000 |
||||
v 0.780000 1.500000 -0.400000 |
||||
v 0.780000 1.400000 0.000000 |
||||
v 0.780000 1.000000 0.000000 |
||||
v 0.780000 0.900000 -0.400000 |
||||
v 0.780000 -1.100000 -0.400000 |
||||
v 0.780000 -0.800000 -0.400000 |
||||
v 0.780000 -0.900000 0.000000 |
||||
v 0.780000 -1.300000 0.000000 |
||||
v 0.780000 -1.400000 -0.400000 |
||||
v -0.780000 -1.100000 -0.400000 |
||||
v -0.780000 -1.400000 -0.400000 |
||||
v -0.780000 -1.300000 0.000000 |
||||
v -0.780000 -0.900000 0.000000 |
||||
v -0.780000 -0.800000 -0.400000 |
||||
v -0.780000 1.200000 -0.400000 |
||||
v -0.780000 0.900000 -0.400000 |
||||
v -0.780000 1.000000 0.000000 |
||||
v -0.780000 1.400000 0.000000 |
||||
v -0.780000 1.500000 -0.400000 |
||||
vt 0.564792 0.689981 |
||||
vt 0.564792 0.953949 |
||||
vt 0.338554 0.953949 |
||||
vt 0.338554 0.689981 |
||||
vt 0.334296 0.692438 |
||||
vt 0.334296 0.954445 |
||||
vt 0.203294 0.986197 |
||||
vt 0.203294 0.656186 |
||||
vt 0.695616 0.984433 |
||||
vt 0.572654 0.959219 |
||||
vt 0.695616 0.657719 |
||||
vt 0.572795 0.683358 |
||||
vt 0.941945 0.999442 |
||||
vt 0.694306 0.999442 |
||||
vt 0.941945 0.647349 |
||||
vt 0.694306 0.647349 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.331416 0.690927 |
||||
vt 0.238667 0.577426 |
||||
vt 0.563274 0.690927 |
||||
vt 0.735343 0.574985 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.743883 0.446331 |
||||
vt 0.779872 0.385852 |
||||
vt 0.817351 0.446331 |
||||
vt 0.853830 0.385852 |
||||
vt 0.890820 0.446331 |
||||
s off |
||||
f 1/1 3/2 4/3 |
||||
f 2/4 1/1 4/3 |
||||
f 2/5 4/6 5/7 |
||||
f 5/7 6/8 2/5 |
||||
f 9/9 3/10 10/11 |
||||
f 3/10 1/12 10/11 |
||||
f 11/13 9/14 12/15 |
||||
f 10/16 12/15 9/14 |
||||
f 8/17 7/18 13/19 |
||||
f 13/19 14/20 8/17 |
||||
f 15/21 11/22 16/23 |
||||
f 12/24 16/23 11/22 |
||||
f 2/25 6/26 1/27 |
||||
f 10/28 1/27 6/26 |
||||
f 4/25 3/27 5/26 |
||||
f 9/28 5/26 3/27 |
||||
f 17/29 19/30 20/31 |
||||
f 18/32 17/29 20/31 |
||||
f 21/30 23/29 24/32 |
||||
f 22/31 21/30 24/32 |
||||
f 26/33 27/34 25/35 |
||||
f 27/34 28/36 25/35 |
||||
f 28/36 29/37 25/35 |
||||
f 31/38 32/39 30/40 |
||||
f 32/39 33/41 30/40 |
||||
f 33/41 34/42 30/40 |
||||
f 36/42 37/41 35/40 |
||||
f 37/41 38/39 35/40 |
||||
f 38/39 39/38 35/40 |
||||
f 41/37 42/36 40/35 |
||||
f 42/36 43/34 40/35 |
||||
f 43/34 44/33 40/35 |
@ -0,0 +1,127 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v 0.600000 -0.200000 -1.100000 |
||||
v 0.600000 1.000000 -1.100000 |
||||
v -0.600000 -0.200000 -1.100000 |
||||
v -0.600000 1.000000 -1.100000 |
||||
v -0.800000 1.400000 -0.700000 |
||||
v 0.800000 1.400000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -1.000000 -0.700000 |
||||
v 0.800000 -1.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.780000 1.200000 -0.300000 |
||||
v 0.780000 1.500000 -0.300000 |
||||
v 0.780000 1.400000 0.000000 |
||||
v 0.780000 1.000000 0.000000 |
||||
v 0.780000 0.900000 -0.300000 |
||||
v 0.780000 -1.100000 -0.300000 |
||||
v 0.780000 -0.800000 -0.300000 |
||||
v 0.780000 -0.900000 0.000000 |
||||
v 0.780000 -1.300000 0.000000 |
||||
v 0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.100000 -0.300000 |
||||
v -0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.300000 0.000000 |
||||
v -0.780000 -0.900000 0.000000 |
||||
v -0.780000 -0.800000 -0.300000 |
||||
v -0.780000 1.200000 -0.300000 |
||||
v -0.780000 0.900000 -0.300000 |
||||
v -0.780000 1.000000 0.000000 |
||||
v -0.780000 1.400000 0.000000 |
||||
v -0.780000 1.500000 -0.300000 |
||||
vt 0.564792 0.689981 |
||||
vt 0.564792 0.953949 |
||||
vt 0.338554 0.953949 |
||||
vt 0.338554 0.689981 |
||||
vt 0.334296 0.692438 |
||||
vt 0.334296 0.954445 |
||||
vt 0.203294 0.986197 |
||||
vt 0.203294 0.656186 |
||||
vt 0.203326 0.657931 |
||||
vt 0.203326 0.986286 |
||||
vt 0.080997 0.986286 |
||||
vt 0.080997 0.657931 |
||||
vt 0.695616 0.984433 |
||||
vt 0.572654 0.959219 |
||||
vt 0.695616 0.657719 |
||||
vt 0.572795 0.683358 |
||||
vt 0.941945 0.999442 |
||||
vt 0.694306 0.999442 |
||||
vt 0.941945 0.647349 |
||||
vt 0.694306 0.647349 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.331416 0.690927 |
||||
vt 0.238667 0.577426 |
||||
vt 0.563274 0.690927 |
||||
vt 0.735343 0.574985 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.743883 0.446331 |
||||
vt 0.779872 0.385852 |
||||
vt 0.817351 0.446331 |
||||
vt 0.853830 0.385852 |
||||
vt 0.890820 0.446331 |
||||
s off |
||||
f 1/1 3/2 4/3 |
||||
f 2/4 1/1 4/3 |
||||
f 2/5 4/6 5/7 |
||||
f 5/7 6/8 2/5 |
||||
f 6/9 5/10 7/11 |
||||
f 7/11 8/12 6/9 |
||||
f 9/13 3/14 10/15 |
||||
f 3/14 1/16 10/15 |
||||
f 11/17 9/18 12/19 |
||||
f 10/20 12/19 9/18 |
||||
f 8/21 7/22 13/23 |
||||
f 13/23 14/24 8/21 |
||||
f 15/25 11/26 16/27 |
||||
f 12/28 16/27 11/26 |
||||
f 2/29 6/30 1/31 |
||||
f 10/32 1/31 6/30 |
||||
f 4/29 3/31 5/30 |
||||
f 9/32 5/30 3/31 |
||||
f 17/33 19/34 20/35 |
||||
f 18/36 17/33 20/35 |
||||
f 21/34 23/33 24/36 |
||||
f 22/35 21/34 24/36 |
||||
f 26/37 27/38 25/39 |
||||
f 27/38 28/40 25/39 |
||||
f 28/40 29/41 25/39 |
||||
f 31/42 32/43 30/44 |
||||
f 32/43 33/45 30/44 |
||||
f 33/45 34/46 30/44 |
||||
f 36/46 37/45 35/44 |
||||
f 37/45 38/43 35/44 |
||||
f 38/43 39/42 35/44 |
||||
f 41/41 42/40 40/39 |
||||
f 42/40 43/38 40/39 |
||||
f 43/38 44/37 40/39 |
@ -0,0 +1,137 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v 0.600000 -1.900000 -1.500000 |
||||
v 0.600000 -1.000000 -1.500000 |
||||
v -0.600000 -1.900000 -1.500000 |
||||
v -0.600000 -1.000000 -1.500000 |
||||
v -0.800000 -0.900000 -0.700000 |
||||
v 0.800000 -0.900000 -0.700000 |
||||
v -0.800000 0.600000 -0.700000 |
||||
v 0.800000 0.600000 -0.700000 |
||||
v -0.800000 -2.400000 -0.700000 |
||||
v 0.800000 -2.400000 -0.700000 |
||||
v -0.800000 -2.400000 -0.700000 |
||||
v 0.800000 -2.400000 -0.700000 |
||||
v -0.800000 0.600000 -0.300000 |
||||
v 0.800000 0.600000 -0.300000 |
||||
v -0.800000 -2.400000 -0.300000 |
||||
v 0.800000 -2.400000 -0.300000 |
||||
v 0.800000 -2.400000 -0.300000 |
||||
v 0.800000 0.600000 -0.300000 |
||||
v 0.800000 -2.400000 -0.700000 |
||||
v 0.800000 0.600000 -0.700000 |
||||
v -0.800000 -2.400000 -0.700000 |
||||
v -0.800000 0.600000 -0.700000 |
||||
v -0.800000 -2.400000 -0.300000 |
||||
v -0.800000 0.600000 -0.300000 |
||||
v 0.780000 0.100000 -0.300000 |
||||
v 0.780000 0.400000 -0.300000 |
||||
v 0.780000 0.300000 0.000000 |
||||
v 0.780000 -0.100000 0.000000 |
||||
v 0.780000 -0.200000 -0.300000 |
||||
v 0.780000 -1.900000 -0.300000 |
||||
v 0.780000 -1.600000 -0.300000 |
||||
v 0.780000 -1.700000 0.000000 |
||||
v 0.780000 -2.100000 0.000000 |
||||
v 0.780000 -2.200000 -0.300000 |
||||
v -0.780000 -1.900000 -0.300000 |
||||
v -0.780000 -2.200000 -0.300000 |
||||
v -0.780000 -2.100000 0.000000 |
||||
v -0.780000 -1.700000 0.000000 |
||||
v -0.780000 -1.600000 -0.300000 |
||||
v -0.780000 0.100000 -0.300000 |
||||
v -0.780000 -0.200000 -0.300000 |
||||
v -0.780000 -0.100000 0.000000 |
||||
v -0.780000 0.300000 0.000000 |
||||
v -0.780000 0.400000 -0.300000 |
||||
v 0.780000 -0.600000 -0.300000 |
||||
v 0.780000 -0.300000 -0.300000 |
||||
v 0.780000 -0.400000 0.000000 |
||||
v 0.780000 -0.800000 0.000000 |
||||
v 0.780000 -0.900000 -0.300000 |
||||
v -0.780000 -0.600000 -0.300000 |
||||
v -0.780000 -0.900000 -0.300000 |
||||
v -0.780000 -0.800000 0.000000 |
||||
v -0.780000 -0.400000 0.000000 |
||||
v -0.780000 -0.300000 -0.300000 |
||||
vt 0.564792 0.689981 |
||||
vt 0.564792 0.953949 |
||||
vt 0.338554 0.953949 |
||||
vt 0.338554 0.689981 |
||||
vt 0.334296 0.692438 |
||||
vt 0.334296 0.954445 |
||||
vt 0.203294 0.986197 |
||||
vt 0.203294 0.656186 |
||||
vt 0.695616 0.984433 |
||||
vt 0.572654 0.959219 |
||||
vt 0.695616 0.657719 |
||||
vt 0.572795 0.683358 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.471796 0.690927 |
||||
vt 0.487691 0.573764 |
||||
vt 0.563274 0.690927 |
||||
vt 0.735343 0.574985 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.743883 0.446331 |
||||
vt 0.779872 0.385852 |
||||
vt 0.817351 0.446331 |
||||
vt 0.853830 0.385852 |
||||
vt 0.890820 0.446331 |
||||
vt 0.122341 0.504785 |
||||
vt 0.003867 0.504785 |
||||
vt 0.122341 0.378413 |
||||
vt 0.003867 0.378413 |
||||
s off |
||||
f 1/1 3/2 4/3 |
||||
f 2/4 1/1 4/3 |
||||
f 2/5 4/6 5/7 |
||||
f 5/7 6/8 2/5 |
||||
f 9/9 3/10 10/11 |
||||
f 3/10 1/12 10/11 |
||||
f 8/13 7/14 13/15 |
||||
f 13/15 14/16 8/13 |
||||
f 15/17 11/18 16/19 |
||||
f 12/20 16/19 11/18 |
||||
f 2/21 6/22 1/23 |
||||
f 10/24 1/23 6/22 |
||||
f 4/21 3/23 5/22 |
||||
f 9/24 5/22 3/23 |
||||
f 17/25 19/26 20/27 |
||||
f 18/28 17/25 20/27 |
||||
f 21/26 23/25 24/28 |
||||
f 22/27 21/26 24/28 |
||||
f 26/29 27/30 25/31 |
||||
f 27/30 28/32 25/31 |
||||
f 28/32 29/33 25/31 |
||||
f 31/34 32/35 30/36 |
||||
f 32/35 33/37 30/36 |
||||
f 33/37 34/38 30/36 |
||||
f 36/38 37/37 35/36 |
||||
f 37/37 38/35 35/36 |
||||
f 38/35 39/34 35/36 |
||||
f 41/33 42/32 40/31 |
||||
f 42/32 43/30 40/31 |
||||
f 43/30 44/29 40/31 |
||||
f 5/39 7/40 6/41 |
||||
f 7/40 8/42 6/41 |
||||
f 46/29 47/30 45/31 |
||||
f 47/30 48/32 45/31 |
||||
f 48/32 49/33 45/31 |
||||
f 51/33 52/32 50/31 |
||||
f 52/32 53/30 50/31 |
||||
f 53/30 54/29 50/31 |
@ -0,0 +1,106 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v -0.800000 2.900000 -0.700000 |
||||
v 0.800000 2.900000 -0.700000 |
||||
v -0.800000 1.200000 -0.700000 |
||||
v 0.800000 1.200000 -0.700000 |
||||
v -0.800000 2.900000 -0.300000 |
||||
v 0.800000 2.900000 -0.300000 |
||||
v -0.800000 1.200000 -0.300000 |
||||
v 0.800000 1.200000 -0.300000 |
||||
v 0.800000 1.200000 -0.300000 |
||||
v 0.800000 2.900000 -0.300000 |
||||
v 0.800000 1.200000 -0.700000 |
||||
v 0.800000 2.900000 -0.700000 |
||||
v -0.800000 1.200000 -0.700000 |
||||
v -0.800000 2.900000 -0.700000 |
||||
v -0.800000 1.200000 -0.300000 |
||||
v -0.800000 2.900000 -0.300000 |
||||
v 0.780000 2.400000 -0.300000 |
||||
v 0.780000 2.700000 -0.300000 |
||||
v 0.780000 2.600000 0.000000 |
||||
v 0.780000 2.200000 0.000000 |
||||
v 0.780000 2.100000 -0.300000 |
||||
v -0.780000 2.400000 -0.300000 |
||||
v -0.780000 2.100000 -0.300000 |
||||
v -0.780000 2.200000 0.000000 |
||||
v -0.780000 2.600000 0.000000 |
||||
v -0.780000 2.700000 -0.300000 |
||||
v 0.780000 1.700000 -0.300000 |
||||
v 0.780000 2.000000 -0.300000 |
||||
v 0.780000 1.900000 0.000000 |
||||
v 0.780000 1.500000 0.000000 |
||||
v 0.780000 1.400000 -0.300000 |
||||
v -0.780000 1.700000 -0.300000 |
||||
v -0.780000 1.400000 -0.300000 |
||||
v -0.780000 1.500000 0.000000 |
||||
v -0.780000 1.900000 0.000000 |
||||
v -0.780000 2.000000 -0.300000 |
||||
v 0.800000 -0.600000 -2.000000 |
||||
v 0.800000 2.900000 -2.000000 |
||||
v -0.800000 -0.600000 -2.000000 |
||||
v -0.800000 2.900000 -2.000000 |
||||
v 0.800000 -0.600000 -0.800000 |
||||
v 0.800000 2.900000 -0.800000 |
||||
v -0.800000 -0.600000 -0.800000 |
||||
v -0.800000 2.900000 -0.800000 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.880027 0.325855 |
||||
vt 0.591008 0.325855 |
||||
vt 0.880027 0.000323 |
||||
vt 0.589446 0.324644 |
||||
vt 0.001453 0.324644 |
||||
vt 0.589446 0.001209 |
||||
vt 0.584620 0.002788 |
||||
vt 0.584620 0.324497 |
||||
vt 0.001010 0.324497 |
||||
vt 0.001010 0.002788 |
||||
vt 0.591008 0.000323 |
||||
vt 0.001453 0.001209 |
||||
s off |
||||
f 2/1 1/2 5/3 |
||||
f 5/3 6/4 2/1 |
||||
f 7/5 3/6 8/7 |
||||
f 4/8 8/7 3/6 |
||||
f 9/9 11/10 12/11 |
||||
f 10/12 9/9 12/11 |
||||
f 13/10 15/9 16/12 |
||||
f 14/11 13/10 16/12 |
||||
f 18/13 19/14 17/15 |
||||
f 19/14 20/16 17/15 |
||||
f 20/16 21/17 17/15 |
||||
f 23/17 24/16 22/15 |
||||
f 24/16 25/14 22/15 |
||||
f 25/14 26/13 22/15 |
||||
f 39/18 37/19 43/20 |
||||
f 37/21 38/22 41/23 |
||||
f 28/13 29/14 27/15 |
||||
f 29/14 30/16 27/15 |
||||
f 30/16 31/17 27/15 |
||||
f 33/17 34/16 32/15 |
||||
f 34/16 35/14 32/15 |
||||
f 35/14 36/13 32/15 |
||||
f 37/24 39/25 40/26 |
||||
f 38/27 37/24 40/26 |
||||
f 37/19 41/28 43/20 |
||||
f 40/18 44/20 42/28 |
||||
f 39/21 43/23 44/29 |
||||
f 38/22 42/29 41/23 |
||||
f 38/19 40/18 42/28 |
||||
f 40/22 39/21 44/29 |
@ -0,0 +1,127 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v 0.600000 -0.200000 -1.100000 |
||||
v 0.600000 0.200000 -1.100000 |
||||
v -0.600000 -0.200000 -1.100000 |
||||
v -0.600000 0.200000 -1.100000 |
||||
v -0.800000 0.300000 -0.700000 |
||||
v 0.800000 0.300000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -1.000000 -0.700000 |
||||
v 0.800000 -1.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.780000 1.200000 -0.300000 |
||||
v 0.780000 1.500000 -0.300000 |
||||
v 0.780000 1.400000 0.000000 |
||||
v 0.780000 1.000000 0.000000 |
||||
v 0.780000 0.900000 -0.300000 |
||||
v 0.780000 -1.100000 -0.300000 |
||||
v 0.780000 -0.800000 -0.300000 |
||||
v 0.780000 -0.900000 0.000000 |
||||
v 0.780000 -1.300000 0.000000 |
||||
v 0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.100000 -0.300000 |
||||
v -0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.300000 0.000000 |
||||
v -0.780000 -0.900000 0.000000 |
||||
v -0.780000 -0.800000 -0.300000 |
||||
v -0.780000 1.200000 -0.300000 |
||||
v -0.780000 0.900000 -0.300000 |
||||
v -0.780000 1.000000 0.000000 |
||||
v -0.780000 1.400000 0.000000 |
||||
v -0.780000 1.500000 -0.300000 |
||||
vt 0.564792 0.689981 |
||||
vt 0.564792 0.953949 |
||||
vt 0.338554 0.953949 |
||||
vt 0.338554 0.689981 |
||||
vt 0.334296 0.692438 |
||||
vt 0.334296 0.954445 |
||||
vt 0.203294 0.986197 |
||||
vt 0.203294 0.656186 |
||||
vt 0.695616 0.984433 |
||||
vt 0.572654 0.959219 |
||||
vt 0.695616 0.657719 |
||||
vt 0.572795 0.683358 |
||||
vt 0.941945 0.999442 |
||||
vt 0.694306 0.999442 |
||||
vt 0.941945 0.647349 |
||||
vt 0.694306 0.647349 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.471796 0.690927 |
||||
vt 0.487691 0.573764 |
||||
vt 0.563274 0.690927 |
||||
vt 0.735343 0.574985 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.743883 0.446331 |
||||
vt 0.779872 0.385852 |
||||
vt 0.817351 0.446331 |
||||
vt 0.853830 0.385852 |
||||
vt 0.890820 0.446331 |
||||
vt 0.122341 0.504785 |
||||
vt 0.003867 0.504785 |
||||
vt 0.122341 0.378413 |
||||
vt 0.003867 0.378413 |
||||
s off |
||||
f 1/1 3/2 4/3 |
||||
f 2/4 1/1 4/3 |
||||
f 2/5 4/6 5/7 |
||||
f 5/7 6/8 2/5 |
||||
f 9/9 3/10 10/11 |
||||
f 3/10 1/12 10/11 |
||||
f 11/13 9/14 12/15 |
||||
f 10/16 12/15 9/14 |
||||
f 8/17 7/18 13/19 |
||||
f 13/19 14/20 8/17 |
||||
f 15/21 11/22 16/23 |
||||
f 12/24 16/23 11/22 |
||||
f 2/25 6/26 1/27 |
||||
f 10/28 1/27 6/26 |
||||
f 4/25 3/27 5/26 |
||||
f 9/28 5/26 3/27 |
||||
f 17/29 19/30 20/31 |
||||
f 18/32 17/29 20/31 |
||||
f 21/30 23/29 24/32 |
||||
f 22/31 21/30 24/32 |
||||
f 26/33 27/34 25/35 |
||||
f 27/34 28/36 25/35 |
||||
f 28/36 29/37 25/35 |
||||
f 31/38 32/39 30/40 |
||||
f 32/39 33/41 30/40 |
||||
f 33/41 34/42 30/40 |
||||
f 36/42 37/41 35/40 |
||||
f 37/41 38/39 35/40 |
||||
f 38/39 39/38 35/40 |
||||
f 41/37 42/36 40/35 |
||||
f 42/36 43/34 40/35 |
||||
f 43/34 44/33 40/35 |
||||
f 5/43 7/44 6/45 |
||||
f 7/44 8/46 6/45 |
@ -0,0 +1,121 @@ |
||||
# Blender v2.69 (sub 0) OBJ File: 'Car002.blend' |
||||
# www.blender.org |
||||
v 0.600000 -0.200000 -1.100000 |
||||
v 0.600000 1.600000 -1.100000 |
||||
v -0.600000 -0.200000 -1.100000 |
||||
v -0.600000 1.600000 -1.100000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -1.000000 -0.700000 |
||||
v 0.800000 -1.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.300000 |
||||
v 0.800000 2.000000 -0.300000 |
||||
v 0.800000 -2.000000 -0.700000 |
||||
v 0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.700000 |
||||
v -0.800000 2.000000 -0.700000 |
||||
v -0.800000 -2.000000 -0.300000 |
||||
v -0.800000 2.000000 -0.300000 |
||||
v 0.780000 1.200000 -0.300000 |
||||
v 0.780000 1.500000 -0.300000 |
||||
v 0.780000 1.400000 0.000000 |
||||
v 0.780000 1.000000 0.000000 |
||||
v 0.780000 0.900000 -0.300000 |
||||
v 0.780000 -1.100000 -0.300000 |
||||
v 0.780000 -0.800000 -0.300000 |
||||
v 0.780000 -0.900000 0.000000 |
||||
v 0.780000 -1.300000 0.000000 |
||||
v 0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.100000 -0.300000 |
||||
v -0.780000 -1.400000 -0.300000 |
||||
v -0.780000 -1.300000 0.000000 |
||||
v -0.780000 -0.900000 0.000000 |
||||
v -0.780000 -0.800000 -0.300000 |
||||
v -0.780000 1.200000 -0.300000 |
||||
v -0.780000 0.900000 -0.300000 |
||||
v -0.780000 1.000000 0.000000 |
||||
v -0.780000 1.400000 0.000000 |
||||
v -0.780000 1.500000 -0.300000 |
||||
vt 0.564792 0.689981 |
||||
vt 0.564792 0.953949 |
||||
vt 0.338554 0.953949 |
||||
vt 0.338554 0.689981 |
||||
vt 0.334296 0.692438 |
||||
vt 0.334296 0.954445 |
||||
vt 0.203294 0.986197 |
||||
vt 0.203294 0.656186 |
||||
vt 0.695616 0.984433 |
||||
vt 0.572654 0.959219 |
||||
vt 0.695616 0.657719 |
||||
vt 0.572795 0.683358 |
||||
vt 0.941945 0.999442 |
||||
vt 0.694306 0.999442 |
||||
vt 0.941945 0.647349 |
||||
vt 0.694306 0.647349 |
||||
vt 0.070499 0.643570 |
||||
vt 0.070499 0.998147 |
||||
vt 0.003817 0.998147 |
||||
vt 0.003817 0.643570 |
||||
vt 0.997239 0.998410 |
||||
vt 0.940308 0.998410 |
||||
vt 0.997239 0.647262 |
||||
vt 0.940308 0.647262 |
||||
vt 0.331416 0.690927 |
||||
vt 0.238667 0.577426 |
||||
vt 0.563274 0.690927 |
||||
vt 0.735343 0.574985 |
||||
vt 0.970266 0.522520 |
||||
vt 0.962942 0.572543 |
||||
vt 0.072079 0.572543 |
||||
vt 0.079403 0.522520 |
||||
vt 0.744362 0.446044 |
||||
vt 0.780351 0.385565 |
||||
vt 0.817830 0.446044 |
||||
vt 0.854309 0.385565 |
||||
vt 0.891299 0.446044 |
||||
vt 0.743883 0.446331 |
||||
vt 0.779872 0.385852 |
||||
vt 0.817351 0.446331 |
||||
vt 0.853830 0.385852 |
||||
vt 0.890820 0.446331 |
||||
s off |
||||
f 1/1 3/2 4/3 |
||||
f 2/4 1/1 4/3 |
||||
f 2/5 4/6 5/7 |
||||
f 5/7 6/8 2/5 |
||||
f 9/9 3/10 10/11 |
||||
f 3/10 1/12 10/11 |
||||
f 11/13 9/14 12/15 |
||||
f 10/16 12/15 9/14 |
||||
f 8/17 7/18 13/19 |
||||
f 13/19 14/20 8/17 |
||||
f 15/21 11/22 16/23 |
||||
f 12/24 16/23 11/22 |
||||
f 2/25 6/26 1/27 |
||||
f 10/28 1/27 6/26 |
||||
f 4/25 3/27 5/26 |
||||
f 9/28 5/26 3/27 |
||||
f 17/29 19/30 20/31 |
||||
f 18/32 17/29 20/31 |
||||
f 21/30 23/29 24/32 |
||||
f 22/31 21/30 24/32 |
||||
f 26/33 27/34 25/35 |
||||
f 27/34 28/36 25/35 |
||||
f 28/36 29/37 25/35 |
||||
f 31/38 32/39 30/40 |
||||
f 32/39 33/41 30/40 |
||||
f 33/41 34/42 30/40 |
||||
f 36/42 37/41 35/40 |
||||
f 37/41 38/39 35/40 |
||||
f 38/39 39/38 35/40 |
||||
f 41/37 42/36 40/35 |
||||
f 42/36 43/34 40/35 |
||||
f 43/34 44/33 40/35 |
After Width: | Height: | Size: 51 KiB |
@ -0,0 +1,206 @@ |
||||
#include "cAutomata.h" |
||||
|
||||
|
||||
cAuto_Node::cAuto_Node() |
||||
{ |
||||
pos = { 0,0 }; |
||||
} |
||||
|
||||
cAuto_Node::cAuto_Node(const olc::vf2d &worldpos) |
||||
{ |
||||
pos = worldpos; |
||||
} |
||||
|
||||
olc::vf2d cAuto_Track::GetPostion(float t, cAuto_Node *pStart) |
||||
{ |
||||
// pStart indicates the node the automata first encounted this track
|
||||
if (node[0] == pStart) |
||||
{ |
||||
return node[0]->pos + (node[1]->pos - node[0]->pos) * (t / fTrackLength); |
||||
} |
||||
else |
||||
{ |
||||
return node[1]->pos + (node[0]->pos - node[1]->pos) * (t / fTrackLength); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
cAuto_Body::cAuto_Body() |
||||
{ |
||||
} |
||||
|
||||
|
||||
cAuto_Body::~cAuto_Body() |
||||
{ |
||||
} |
||||
|
||||
|
||||
void cAuto_Body::UpdateAuto(float fElapsedTime) |
||||
{ |
||||
// Work out which node is the target destination
|
||||
cAuto_Node *pExitNode = pCurrentTrack->node[0]; |
||||
if (pExitNode == pTrackOriginNode) |
||||
pExitNode = pCurrentTrack->node[1]; |
||||
|
||||
bool bAutomataCanMove = true; |
||||
|
||||
float fDistanceToAutoInFront = 1.0f; |
||||
|
||||
// First check if the vehicle overlaps with the one in front of it
|
||||
|
||||
// Get an iterator for this automata
|
||||
auto itThisAutomata = std::find(pCurrentTrack->listAutos.begin(), pCurrentTrack->listAutos.end(), this); |
||||
|
||||
// If this automata is at the front of this track segment
|
||||
if (*itThisAutomata == pCurrentTrack->listAutos.front()) |
||||
{ |
||||
// Then check all the following track segments. Take the position of
|
||||
// each vehicle at the back of the track segments auto list
|
||||
for (auto &track : pExitNode->listTracks) |
||||
{ |
||||
if (track != pCurrentTrack && !track->listAutos.empty()) |
||||
{ |
||||
// Get Auto at back
|
||||
float fDistanceFromTrackStartToAutoRear = track->listAutos.back()->fAutoPos - track->listAutos.back()->fAutoLength; |
||||
|
||||
if ((*itThisAutomata)->fAutoPos < (pCurrentTrack->fTrackLength + fDistanceFromTrackStartToAutoRear - fAutoLength)) |
||||
{ |
||||
// Move Automata along track, as there is space
|
||||
//bAutomataCanMove = true;
|
||||
fDistanceToAutoInFront = (pCurrentTrack->fTrackLength + fDistanceFromTrackStartToAutoRear - 0.1f) - (*itThisAutomata)->fAutoPos; |
||||
} |
||||
else |
||||
{ |
||||
// No space, so do not move automata
|
||||
bAutomataCanMove = false; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Track in front was empty, node is clear to pass through so
|
||||
//bAutomataCanMove = true;
|
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
else |
||||
{ |
||||
// Get the automata in front
|
||||
auto itAutomataInFront = itThisAutomata; |
||||
itAutomataInFront--; |
||||
|
||||
// If the distance between the front of the automata in front and the fornt of this automata
|
||||
// is greater than the length of the automata in front, then there is space for this automata
|
||||
// to enter
|
||||
if (fabs((*itAutomataInFront)->fAutoPos - (*itThisAutomata)->fAutoPos) > ((*itAutomataInFront)->fAutoLength + 0.1f)) |
||||
{ |
||||
// Move Automata along track
|
||||
//bAutomataCanMove = true;
|
||||
fDistanceToAutoInFront = ((*itAutomataInFront)->fAutoPos - (*itAutomataInFront)->fAutoLength - 0.1f) - (*itThisAutomata)->fAutoPos; |
||||
} |
||||
else |
||||
{ |
||||
// No space, so do not move automata
|
||||
bAutomataCanMove = false; |
||||
} |
||||
} |
||||
|
||||
if (bAutomataCanMove) |
||||
{ |
||||
if (fDistanceToAutoInFront > pCurrentTrack->fTrackLength) fDistanceToAutoInFront = pCurrentTrack->fTrackLength; |
||||
fAutoPos += fElapsedTime * std::max(fDistanceToAutoInFront, 1.0f) * (fAutoLength < 0.1f ? 0.3f : 0.5f); |
||||
} |
||||
|
||||
|
||||
if (fAutoPos >= pCurrentTrack->fTrackLength) |
||||
{ |
||||
// Automata has reached end of current track
|
||||
|
||||
// Check if it can transition beyond node
|
||||
if (!pExitNode->bBlock) |
||||
{ |
||||
// It can, so reset position along track back to start
|
||||
fAutoPos -= pCurrentTrack->fTrackLength; |
||||
|
||||
// Choose a track from the node not equal to this one, that has an unblocked exit node
|
||||
|
||||
// For now choose at random
|
||||
cAuto_Track *pNewTrack = nullptr; |
||||
|
||||
if (pExitNode->listTracks.size() == 2) |
||||
{ |
||||
// Automata is travelling along straight joined sections, one of the
|
||||
// tracks is the track its just come in on, the other is the exit, so
|
||||
// choose the exit.
|
||||
auto it = pExitNode->listTracks.begin(); |
||||
pNewTrack = (*it); |
||||
if (pCurrentTrack == pNewTrack) |
||||
{ |
||||
++it; |
||||
pNewTrack = (*it); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Automata has reached a junction with several exits
|
||||
while (pNewTrack == nullptr) |
||||
{ |
||||
int i = rand() % pExitNode->listTracks.size(); |
||||
int j = 0; |
||||
for (auto it = pExitNode->listTracks.begin(); it != pExitNode->listTracks.end(); ++it) |
||||
{ |
||||
cAuto_Track* track = (*it); |
||||
|
||||
// Work out which node is the target destination
|
||||
cAuto_Node *pNewExitNode = track->node[0]; |
||||
if (pNewExitNode == pExitNode) |
||||
pNewExitNode = track->node[1]; |
||||
|
||||
if (j == i && track != pCurrentTrack && !pNewExitNode->bBlock /*((*it)->cell != pCurrentTrack->cell)*/) |
||||
{ |
||||
pNewTrack = track; |
||||
break; |
||||
} |
||||
|
||||
j++; |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
// Change to new track, the origin node of the next
|
||||
// track is the same as the exit node to the current track
|
||||
pTrackOriginNode = pExitNode; |
||||
|
||||
// Remove the automata from the front of the queue
|
||||
// on the current track
|
||||
pCurrentTrack->listAutos.pop_front(); |
||||
|
||||
// Switch the automatas track link to the new track
|
||||
pCurrentTrack = pNewTrack; |
||||
|
||||
// Push the automata onto the back of the new track queue
|
||||
pCurrentTrack->listAutos.push_back(this); |
||||
|
||||
} |
||||
else |
||||
{ |
||||
// It cant pass the node, so clamp automata at this location
|
||||
fAutoPos = pCurrentTrack->fTrackLength; |
||||
} |
||||
|
||||
} |
||||
else |
||||
{ |
||||
// Automata is travelling
|
||||
vAutoPos = pCurrentTrack->GetPostion(fAutoPos, pTrackOriginNode); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,107 @@ |
||||
/*
|
||||
Top Down City Based Car Crime Game - Part #2 |
||||
"Colin, I hope you're shooting 600+ wherever you are buddy. RIP." - javidx9 |
||||
|
||||
License (OLC-3) |
||||
~~~~~~~~~~~~~~~ |
||||
|
||||
Copyright 2018-2019 OneLoneCoder.com |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions |
||||
are met: |
||||
|
||||
1. Redistributions or derivations of source code must retain the above |
||||
copyright notice, this list of conditions and the following disclaimer. |
||||
|
||||
2. Redistributions or derivative works in binary form must reproduce |
||||
the above copyright notice. This list of conditions and the following |
||||
disclaimer must be reproduced in the documentation and/or other |
||||
materials provided with the distribution. |
||||
|
||||
3. Neither the name of the copyright holder nor the names of its |
||||
contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"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 COPYRIGHT |
||||
HOLDER OR CONTRIBUTORS 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. |
||||
|
||||
Instructions: |
||||
~~~~~~~~~~~~~ |
||||
Scroll with middle mouse wheel, TAB toggle edit mode, R to place road |
||||
P to place pavement, Q to place building, Arrow keys to drive car |
||||
|
||||
Relevant Video: https://youtu.be/fIV6P1W-wuo
|
||||
|
||||
Links |
||||
~~~~~ |
||||
YouTube: https://www.youtube.com/javidx9
|
||||
https://www.youtube.com/javidx9extra
|
||||
Discord: https://discord.gg/WhwHUMV
|
||||
Twitter: https://www.twitter.com/javidx9
|
||||
Twitch: https://www.twitch.tv/javidx9
|
||||
GitHub: https://www.github.com/onelonecoder
|
||||
Patreon: https://www.patreon.com/javidx9
|
||||
Homepage: https://www.onelonecoder.com
|
||||
|
||||
Author |
||||
~~~~~~ |
||||
David Barr, aka javidx9, ©OneLoneCoder 2019 |
||||
*/ |
||||
|
||||
|
||||
#pragma once |
||||
|
||||
#include "olcPixelGameEngine.h" |
||||
|
||||
class cAuto_Track; |
||||
class cAuto_Node; |
||||
class cAuto_Body; |
||||
class cCell; |
||||
|
||||
class cAuto_Node |
||||
{ |
||||
public: |
||||
cAuto_Node(); |
||||
cAuto_Node(const olc::vf2d &worldpos); |
||||
olc::vf2d pos; |
||||
bool bBlock = false; |
||||
std::list<cAuto_Track*> listTracks; |
||||
}; |
||||
|
||||
class cAuto_Track |
||||
{ |
||||
public: |
||||
cAuto_Node* node[2]; // Two end nodes
|
||||
cCell* cell; // Pointer to host cell
|
||||
olc::vf2d GetPostion(float t, cAuto_Node *pstart); |
||||
std::list<cAuto_Body*> listAutos; |
||||
float fTrackLength = 1.0f; |
||||
}; |
||||
|
||||
class cAuto_Body |
||||
{ |
||||
public: |
||||
cAuto_Body(); |
||||
~cAuto_Body(); |
||||
|
||||
public: |
||||
void UpdateAuto(float fElapsedTime); |
||||
|
||||
public: |
||||
olc::vf2d vAutoPos = { 0.0f, 0.0f }; |
||||
float fAutoPos = 0.0f; // Location of automata along track
|
||||
float fAutoLength = 0.0f; // Physical length of automata
|
||||
cAuto_Track *pCurrentTrack = nullptr; |
||||
cAuto_Node *pTrackOriginNode = nullptr; |
||||
|
||||
}; |
@ -0,0 +1,709 @@ |
||||
#include "cCarCrimeCity.h" |
||||
|
||||
cCarCrimeCity::cCarCrimeCity() |
||||
{ |
||||
sAppName = "Car Crime City"; |
||||
} |
||||
|
||||
cCarCrimeCity::~cCarCrimeCity() |
||||
{ |
||||
} |
||||
|
||||
bool cCarCrimeCity::OnUserCreate() |
||||
{ |
||||
// Initialise PGEX 3D
|
||||
olc::GFX3D::ConfigureDisplay(); |
||||
|
||||
// Load fixed system assets, i.e. those need to simply do anything
|
||||
if (!LoadAssets()) return false; |
||||
|
||||
// Create Default city
|
||||
pCity = new cCityMap(cGameSettings::nDefaultMapWidth, cGameSettings::nDefaultMapHeight, mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
|
||||
// If a city map file has been specified, then load it
|
||||
if (!cGameSettings::sDefaultCityFile.empty()) |
||||
{ |
||||
if (!pCity->LoadCity(cGameSettings::sDefaultCityFile)) |
||||
{ |
||||
std::cout << "Failed to load '" << cGameSettings::sDefaultCityFile << "'" << std::endl; |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
bool cCarCrimeCity::LoadAssets() |
||||
{ |
||||
// Game Settings should have loaded all the relevant file information
|
||||
// to start loading asset information. Game assets will be stored in
|
||||
// a map structure. Maps can have slightly longer access times, so each
|
||||
// in game object will have facility to extract required resources once
|
||||
// when it is created, meaning no map search during normal use
|
||||
|
||||
// System Meshes
|
||||
// A simple flat unit quad
|
||||
olc::GFX3D::mesh* meshQuad = new olc::GFX3D::mesh();
|
||||
meshQuad->tris = |
||||
{ |
||||
{ 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
{ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
}; |
||||
mapAssetMeshes["UnitQuad"] = meshQuad; |
||||
|
||||
//// The four outer walls of a cell
|
||||
olc::GFX3D::mesh* meshWallsOut = new olc::GFX3D::mesh(); |
||||
meshWallsOut->tris = |
||||
{ |
||||
// EAST
|
||||
{ 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.2f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
{ 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.2f, 1.0f, 1.0f, 0.0f, 0.2f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
|
||||
// WEST
|
||||
{ 0.0f, 0.0f, 0.2f, 1.0f, 0.0f, 1.0f, 0.2f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
{ 0.0f, 0.0f, 0.2f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
|
||||
// TOP
|
||||
{ 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.2f, 1.0f, 1.0f, 1.0f, 0.2f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
{ 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.2f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
|
||||
// BOTTOM
|
||||
{ 1.0f, 0.0f, 0.2f, 1.0f, 0.0f, 0.0f, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
{ 1.0f, 0.0f, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::WHITE, olc::WHITE, olc::WHITE }, |
||||
}; |
||||
mapAssetMeshes["WallsOut"] = meshWallsOut; |
||||
|
||||
|
||||
// System Textures
|
||||
for (auto &asset : cGameSettings::vecAssetTextures) |
||||
{ |
||||
olc::Sprite *sprAsset = new olc::Sprite(); |
||||
if (sprAsset->LoadFromFile(asset.sFile)) |
||||
{ |
||||
mapAssetTextures[asset.sName] = sprAsset; |
||||
} |
||||
else |
||||
{ |
||||
std::cout << "Failed to load " << asset.sName << std::endl; |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
// Break up roads sprite into individual sprites. Why? Its easier to maintain
|
||||
// the roads sprite as a single image, but easier to use if they are all individual.
|
||||
// Breaking it up manually in the image editing software is time consuming so just
|
||||
// do it here
|
||||
int nRoadTexSize = 256; // In pixels in base texture
|
||||
int nRoadTexOffset = 64; // There exists a 64 pixel offset from top left of source image
|
||||
for (int r = 0; r < 12; r++) |
||||
{ |
||||
olc::Sprite* road = new olc::Sprite(nRoadTexSize, nRoadTexSize); |
||||
SetDrawTarget(road); |
||||
DrawPartialSprite(0, 0, mapAssetTextures["AllRoads"], ((r % 3) * nRoadTexSize) + nRoadTexOffset, ((r / 3) * nRoadTexSize) + nRoadTexOffset, nRoadTexSize, nRoadTexSize); |
||||
switch (r) |
||||
{ |
||||
case 0: mapAssetTextures["Road_V"] = road; break; |
||||
case 1: mapAssetTextures["Road_H"] = road; break; |
||||
case 2: mapAssetTextures["Pavement"] = road; break; |
||||
case 3: mapAssetTextures["Road_C1"] = road; break; |
||||
case 4: mapAssetTextures["Road_T1"] = road; break; |
||||
case 5: mapAssetTextures["Road_C2"] = road; break; |
||||
case 6: mapAssetTextures["Road_T2"] = road; break; |
||||
case 7: mapAssetTextures["Road_X"] = road; break; |
||||
case 8: mapAssetTextures["Road_T3"] = road; break; |
||||
case 9: mapAssetTextures["Road_C3"] = road; break; |
||||
case 10: mapAssetTextures["Road_T4"] = road; break; |
||||
case 11: mapAssetTextures["Road_C4"] = road; break; |
||||
} |
||||
} |
||||
SetDrawTarget(nullptr); |
||||
|
||||
|
||||
// Load Buildings
|
||||
for (auto &asset : cGameSettings::vecAssetBuildings) |
||||
{ |
||||
mapAssetMeshes[asset.sDescription] = new olc::GFX3D::mesh(); |
||||
mapAssetMeshes[asset.sDescription]->LoadOBJFile(asset.sModelOBJ); |
||||
mapAssetTextures[asset.sDescription] = new olc::Sprite(asset.sModelPNG); |
||||
|
||||
olc::GFX3D::mat4x4 matScale = olc::GFX3D::Math::Mat_MakeScale(asset.fScale[0], asset.fScale[1], asset.fScale[2]); |
||||
olc::GFX3D::mat4x4 matTranslate = olc::GFX3D::Math::Mat_MakeTranslation(asset.fTranslate[0], asset.fTranslate[1], asset.fTranslate[2]); |
||||
olc::GFX3D::mat4x4 matRotateX = olc::GFX3D::Math::Mat_MakeRotationX(asset.fRotate[0]); |
||||
olc::GFX3D::mat4x4 matRotateY = olc::GFX3D::Math::Mat_MakeRotationY(asset.fRotate[1]); |
||||
olc::GFX3D::mat4x4 matRotateZ = olc::GFX3D::Math::Mat_MakeRotationZ(asset.fRotate[2]); |
||||
olc::GFX3D::mat4x4 matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTranslate, matScale); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateX); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateY); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateZ); |
||||
mapAssetTransform[asset.sDescription] = matTransform; |
||||
} |
||||
|
||||
// Load Vehicles
|
||||
for (auto &asset : cGameSettings::vecAssetVehicles) |
||||
{ |
||||
mapAssetMeshes[asset.sDescription] = new olc::GFX3D::mesh(); |
||||
mapAssetMeshes[asset.sDescription]->LoadOBJFile(asset.sModelOBJ); |
||||
mapAssetTextures[asset.sDescription] = new olc::Sprite(asset.sModelPNG); |
||||
|
||||
olc::GFX3D::mat4x4 matScale = olc::GFX3D::Math::Mat_MakeScale(asset.fScale[0], asset.fScale[1], asset.fScale[2]); |
||||
olc::GFX3D::mat4x4 matTranslate = olc::GFX3D::Math::Mat_MakeTranslation(asset.fTranslate[0], asset.fTranslate[1], asset.fTranslate[2]); |
||||
olc::GFX3D::mat4x4 matRotateX = olc::GFX3D::Math::Mat_MakeRotationX(asset.fRotate[0]); |
||||
olc::GFX3D::mat4x4 matRotateY = olc::GFX3D::Math::Mat_MakeRotationY(asset.fRotate[1]); |
||||
olc::GFX3D::mat4x4 matRotateZ = olc::GFX3D::Math::Mat_MakeRotationZ(asset.fRotate[2]); |
||||
olc::GFX3D::mat4x4 matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTranslate, matScale); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateX); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateY); |
||||
matTransform = olc::GFX3D::Math::Mat_MultiplyMatrix(matTransform, matRotateZ); |
||||
mapAssetTransform[asset.sDescription] = matTransform; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
void cCarCrimeCity::SpawnPedestrian(int x, int y) |
||||
{ |
||||
cCell* cell = pCity->Cell(x, y); |
||||
|
||||
cAuto_Track *t = ((cCell_Road*)cell)->pSafePedestrianTrack; |
||||
if (t == nullptr) return; |
||||
|
||||
cAuto_Body *a = new cAuto_Body(); |
||||
a->fAutoLength = 0.05f; |
||||
a->pCurrentTrack = t; |
||||
a->pCurrentTrack->listAutos.push_back(a); |
||||
a->pTrackOriginNode = t->node[0]; |
||||
a->UpdateAuto(0.0f); |
||||
listAutomata.push_back(a); |
||||
} |
||||
|
||||
void cCarCrimeCity::SpawnVehicle(int x, int y) |
||||
{ |
||||
cCell* cell = pCity->Cell(x, y); |
||||
|
||||
cAuto_Track *t = ((cCell_Road*)cell)->pSafeCarTrack; |
||||
if (t == nullptr) return; |
||||
|
||||
cAuto_Body *a = new cAuto_Body(); |
||||
a->fAutoLength = 0.2f; |
||||
a->pCurrentTrack = t; |
||||
a->pCurrentTrack->listAutos.push_back(a); |
||||
a->pTrackOriginNode = t->node[0]; |
||||
a->UpdateAuto(0.0f);
|
||||
listAutomata.push_back(a); |
||||
} |
||||
|
||||
void cCarCrimeCity::DoEditMode(float fElapsedTime) |
||||
{ |
||||
// Get cell under mouse cursor
|
||||
cCell* mcell = pCity->Cell(nMouseX, nMouseY); |
||||
bool bTempCellAdded = false; |
||||
|
||||
// Left click and drag adds cells
|
||||
if (mcell != nullptr && GetMouse(0).bHeld) |
||||
setSelectedCells.emplace(nMouseY * pCity->GetWidth() + nMouseX); |
||||
|
||||
// Right click clears selection
|
||||
if (GetMouse(1).bReleased) |
||||
setSelectedCells.clear(); |
||||
|
||||
if (setSelectedCells.empty()) |
||||
{ |
||||
// If nothing can be edited validly then just exit
|
||||
if (mcell == nullptr) |
||||
return; |
||||
|
||||
// else set is empty, so temporarily add current cell to it
|
||||
setSelectedCells.emplace(nMouseY * pCity->GetWidth() + nMouseX); |
||||
bTempCellAdded = true; |
||||
} |
||||
|
||||
// If the map changes, we will need to update
|
||||
// the automata, and adjacency
|
||||
bool bMapChanged = false; |
||||
|
||||
// Press "G" to apply grass
|
||||
if (GetKey(olc::Key::G).bPressed) |
||||
{
|
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
cCell* cell = pCity->Replace(x, y, new cCell_Plane(pCity, x, y, PLANE_GRASS));
|
||||
cell->LinkAssets(mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
} |
||||
|
||||
bMapChanged = true; |
||||
} |
||||
|
||||
// Press "P" to apply Pavement
|
||||
if (GetKey(olc::Key::P).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
cCell* cell = pCity->Replace(x, y, new cCell_Plane(pCity, x, y, PLANE_ASPHALT)); |
||||
cell->LinkAssets(mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
} |
||||
|
||||
bMapChanged = true; |
||||
} |
||||
|
||||
// Press "W" to apply Water
|
||||
if (GetKey(olc::Key::W).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
cCell* cell = pCity->Replace(x, y, new cCell_Water(pCity, x, y)); |
||||
cell->LinkAssets(mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
} |
||||
|
||||
bMapChanged = true; |
||||
} |
||||
|
||||
// Press "R" to apply Roads
|
||||
if (GetKey(olc::Key::Q).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
cCell* cell = pCity->Replace(x, y, new cCell_Building("Apartments_1", pCity, x, y)); |
||||
cell->LinkAssets(mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
} |
||||
|
||||
bMapChanged = true; |
||||
} |
||||
|
||||
|
||||
// Press "R" to apply Roads
|
||||
if (GetKey(olc::Key::R).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
cCell* cell = pCity->Replace(x, y, new cCell_Road(pCity, x, y)); |
||||
cell->LinkAssets(mapAssetTextures, mapAssetMeshes, mapAssetTransform); |
||||
} |
||||
|
||||
bMapChanged = true; |
||||
} |
||||
|
||||
|
||||
|
||||
if (GetKey(olc::Key::C).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
SpawnVehicle(x, y);
|
||||
} |
||||
} |
||||
|
||||
|
||||
if (GetKey(olc::Key::V).bPressed) |
||||
{ |
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
SpawnPedestrian(x, y);
|
||||
}
|
||||
} |
||||
|
||||
if (bMapChanged) |
||||
{ |
||||
// The navigation nodes may have tracks attached to them, so get rid of them
|
||||
// all. Below we will reconstruct all tracks because city has changed
|
||||
pCity->RemoveAllTracks(); |
||||
|
||||
for (auto &a : listAutomata) delete a; |
||||
listAutomata.clear(); |
||||
|
||||
for (int x = 0; x < pCity->GetWidth(); x++) |
||||
{ |
||||
for (int y = 0; y < pCity->GetHeight(); y++) |
||||
{ |
||||
cCell *c = pCity->Cell(x, y); |
||||
|
||||
// Update adjacency information, i.e. those cells whose
|
||||
// state changes based on neighbouring cells
|
||||
c->CalculateAdjacency(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
// To facilitate "edit under cursor" we added a temporary cell
|
||||
// which needs to be removed now
|
||||
if (bTempCellAdded) |
||||
setSelectedCells.clear(); |
||||
} |
||||
|
||||
olc::vf2d cCarCrimeCity::GetMouseOnGround(const olc::vf2d &vMouseScreen) |
||||
{ |
||||
olc::GFX3D::vec3d vLookTarget = olc::GFX3D::Math::Vec_Add(vEye, vLookDir); |
||||
olc::GFX3D::mat4x4 matProj = olc::GFX3D::Math::Mat_MakeProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.1f, 1000.0f); |
||||
olc::GFX3D::mat4x4 matView = olc::GFX3D::Math::Mat_PointAt(vEye, vLookTarget, vUp); |
||||
olc::GFX3D::vec3d vecMouseDir = { |
||||
2.0f * ((vMouseScreen.x / (float)ScreenWidth()) - 0.5f) / matProj.m[0][0], |
||||
2.0f * ((vMouseScreen.y / (float)ScreenHeight()) - 0.5f) / matProj.m[1][1], |
||||
1.0f, |
||||
0.0f }; |
||||
|
||||
olc::GFX3D::vec3d vecMouseOrigin = { 0.0f, 0.0f, 0.0f }; |
||||
vecMouseOrigin = olc::GFX3D::Math::Mat_MultiplyVector(matView, vecMouseOrigin); |
||||
vecMouseDir = olc::GFX3D::Math::Mat_MultiplyVector(matView, vecMouseDir); |
||||
vecMouseDir = olc::GFX3D::Math::Vec_Mul(vecMouseDir, 1000.0f); |
||||
vecMouseDir = olc::GFX3D::Math::Vec_Add(vecMouseOrigin, vecMouseDir); |
||||
|
||||
// Perform line/plane intersection to determine mouse position in world space
|
||||
olc::GFX3D::vec3d plane_p = { 0.0f, 0.0f, 0.0f }; |
||||
olc::GFX3D::vec3d plane_n = { 0.0f, 0.0f, 1.0f }; |
||||
float t = 0.0f; |
||||
olc::GFX3D::vec3d mouse3d = olc::GFX3D::Math::Vec_IntersectPlane(plane_p, plane_n, vecMouseOrigin, vecMouseDir, t); |
||||
return { mouse3d.x, mouse3d.y }; |
||||
} |
||||
|
||||
bool cCarCrimeCity::OnUserUpdate(float fElapsedTime) |
||||
{ |
||||
fGlobalTime += fElapsedTime; |
||||
|
||||
if (GetKey(olc::Key::TAB).bReleased) bEditMode = !bEditMode; |
||||
|
||||
if (bEditMode) // Use mouse to pan and zoom, and place objects
|
||||
{ |
||||
vEye = vCamera; |
||||
olc::vf2d vMouseScreen = { (float)GetMouseX(), (float)GetMouseY() }; |
||||
olc::vf2d vMouseOnGroundBeforeZoom = GetMouseOnGround(vMouseScreen); |
||||
|
||||
vOffset = { 0,0 }; |
||||
|
||||
if (IsFocused()) |
||||
{ |
||||
if (GetMouse(2).bPressed) { vStartPan = vMouseOnGroundBeforeZoom; } |
||||
if (GetMouse(2).bHeld) { vOffset = (vStartPan - vMouseOnGroundBeforeZoom); }; |
||||
|
||||
if (GetMouseWheel() > 0) |
||||
{ |
||||
vCamera.z *= 0.5f; |
||||
} |
||||
|
||||
if (GetMouseWheel() < 0) |
||||
{ |
||||
vCamera.z *= 1.5f; |
||||
} |
||||
} |
||||
|
||||
vEye = vCamera; |
||||
olc::vf2d vMouseOnGroundAfterZoom = GetMouseOnGround(vMouseScreen); |
||||
vOffset += (vMouseOnGroundBeforeZoom - vMouseOnGroundAfterZoom); |
||||
vCamera.x += vOffset.x; |
||||
vCamera.y += vOffset.y; |
||||
vEye = vCamera; |
||||
|
||||
// Get Integer versions of mouse coords in world space
|
||||
nMouseX = (int)vMouseOnGroundAfterZoom.x; |
||||
nMouseY = (int)vMouseOnGroundAfterZoom.y; |
||||
|
||||
DoEditMode(fElapsedTime); |
||||
} |
||||
else |
||||
{ |
||||
// Not in edit mode, so camera follows player
|
||||
if (GetKey(olc::Key::LEFT).bHeld) fAngle += -2.5f * fElapsedTime; |
||||
if (GetKey(olc::Key::RIGHT).bHeld) fAngle += 2.5f * fElapsedTime; |
||||
if (GetKey(olc::Key::UP).bHeld) |
||||
{ |
||||
carvel = { cos(fAngle), sin(fAngle) }; |
||||
carpos += carvel * 2.0f * fElapsedTime; |
||||
} |
||||
|
||||
vCamera.x = carpos.x; |
||||
vCamera.y = carpos.y; |
||||
vEye = vCamera; |
||||
} |
||||
|
||||
/*fAngle = 0.0f;
|
||||
if (GetKey(olc::Key::LEFT).bHeld) fAngle = -0.8f; |
||||
if (GetKey(olc::Key::RIGHT).bHeld) fAngle = 0.8f;*/ |
||||
|
||||
|
||||
//car.UpdateDrive(fElapsedTime, 1.0f, GetKey(olc::Key::UP).bHeld, GetKey(olc::Key::SPACE).bHeld, GetKey(olc::Key::DOWN).bHeld, fAngle);
|
||||
|
||||
|
||||
//if (car.bSkidding && fmod(fGlobalTime, 0.05f) < 0.01f)
|
||||
//{
|
||||
// listDecalSmoke.push_front({ 0.1f, {car.vPosRear.x, car.vPosRear.y, -0.03f} });
|
||||
//}
|
||||
|
||||
|
||||
//// Update Decals
|
||||
//for (auto &d : listDecalSmoke)
|
||||
//{
|
||||
// d.fLifetime += fElapsedTime;
|
||||
//}
|
||||
|
||||
//listDecalSmoke.remove_if([](const sSmokeDecal &d) {return d.fLifetime > 2.0f; });
|
||||
|
||||
//if (!bEditMode)
|
||||
//{
|
||||
// vCamera.x = car.GetOrigin().x;
|
||||
// vCamera.y = car.GetOrigin().y;
|
||||
//}
|
||||
|
||||
|
||||
//float fTargetHeight = -1.0f;
|
||||
//int nCarX = vCamera.x;
|
||||
//int nCarY = vCamera.y;
|
||||
|
||||
std::vector<cGameObjectQuad> vecNeighbours; |
||||
|
||||
//// Check surrounding cells height
|
||||
//for (int x = nCarX - 1; x < nCarX + 2; x++)
|
||||
// for (int y = nCarY - 1; y < nCarY + 2; y++)
|
||||
// {
|
||||
// if (pCity->Cell(x,y) && pCity->Cell(x, y)->bBuilding)
|
||||
// {
|
||||
// cGameObjectQuad ob(1.0f, 1.0f);
|
||||
// ob.pos = { (float)x + 0.5f, (float)y + 0.5f, 0.0f, 1.0f };
|
||||
// ob.TransformModelToWorld();
|
||||
// vecNeighbours.push_back(ob);
|
||||
// fTargetHeight = -2.0f;
|
||||
// }
|
||||
// }
|
||||
|
||||
//goCar->pos.x = car.GetOrigin().x;
|
||||
//goCar->pos.y = car.GetOrigin().y;
|
||||
//goCar->fAngle = car.GetRotation();
|
||||
//goCar->TransformModelToWorld();
|
||||
|
||||
//for (auto &ob : vecNeighbours)
|
||||
//{
|
||||
// if (goCar->StaticCollisionWith(ob, true))
|
||||
// {
|
||||
// goCar->TransformModelToWorld();
|
||||
// car.vPosRear.x += goCar->pos.x - car.GetOrigin().x;
|
||||
// car.vPosRear.y += goCar->pos.y - car.GetOrigin().y;
|
||||
// car.vPosFront.x += goCar->pos.x - car.GetOrigin().x;
|
||||
// car.vPosFront.y += goCar->pos.y - car.GetOrigin().y;
|
||||
// car.fSpeed = 0.0f;
|
||||
// }
|
||||
//}
|
||||
|
||||
//if(!bEditMode)
|
||||
// vCamera.z += (fTargetHeight - vCamera.z) * 10.0f * fElapsedTime;
|
||||
|
||||
|
||||
//car.UpdateTow(fElapsedTime, { mouse3d.x, mouse3d.y });
|
||||
|
||||
|
||||
|
||||
//for (int v = 1; v<vecTraffic.size(); v++)
|
||||
//{
|
||||
// //vecTraffic[v].UpdateTow(fElapsedTime * 10.0f, vecTraffic[v - 1].vPosRear);
|
||||
//}
|
||||
|
||||
// Calculate Visible ground plane dimensions
|
||||
viewWorldTopLeft = GetMouseOnGround(olc::vf2d( 0.0f, 0.0f )); |
||||
viewWorldBottomRight = GetMouseOnGround(olc::vf2d((float)ScreenWidth(), (float)ScreenHeight())); |
||||
|
||||
// Calculate visible world extents
|
||||
int nStartX = std::max(0, (int)viewWorldTopLeft.x - 1); |
||||
int nEndX = std::min(pCity->GetWidth(), (int)viewWorldBottomRight.x + 1); |
||||
int nStartY = std::max(0, (int)viewWorldTopLeft.y - 1); |
||||
int nEndY = std::min(pCity->GetHeight(), (int)viewWorldBottomRight.y + 1); |
||||
|
||||
// Only update automata for cells near player
|
||||
int nAutomStartX = std::max(0, (int)viewWorldTopLeft.x - 3); |
||||
int nAutomEndX = std::min(pCity->GetWidth(), (int)viewWorldBottomRight.x + 3); |
||||
int nAutomStartY = std::max(0, (int)viewWorldTopLeft.y - 3); |
||||
int nAutomEndY = std::min(pCity->GetHeight(), (int)viewWorldBottomRight.y + 3); |
||||
|
||||
int nLocalStartX = std::max(0, (int)vCamera.x - 3); |
||||
int nLocalEndX = std::min(pCity->GetWidth(), (int)vCamera.x + 3); |
||||
int nLocalStartY = std::max(0, (int)vCamera.y - 3); |
||||
int nLocalEndY = std::min(pCity->GetHeight(), (int)vCamera.y + 3); |
||||
|
||||
|
||||
// Update Cells
|
||||
for (int x = nStartX; x < nEndX; x++) |
||||
{ |
||||
for (int y = nStartY; y < nEndY; y++) |
||||
{ |
||||
pCity->Cell(x, y)->Update(fElapsedTime); |
||||
} |
||||
} |
||||
|
||||
// Update Automata
|
||||
for (auto &a : listAutomata) |
||||
{ |
||||
a->UpdateAuto(fElapsedTime); |
||||
|
||||
// If automata is too far from camera, remove it
|
||||
if ((a->vAutoPos - olc::vf2d(vCamera.x, vCamera.y)).mag() > 5.0f) |
||||
{ |
||||
// Despawn automata
|
||||
|
||||
// 1) Disconnect it from track
|
||||
a->pCurrentTrack->listAutos.remove(a); |
||||
|
||||
// 2) Erase it from memory
|
||||
delete a; a = nullptr;
|
||||
} |
||||
} |
||||
|
||||
// Remove dead automata, their pointer has been set to nullptr in the list
|
||||
listAutomata.remove(nullptr); |
||||
|
||||
// Maintain a certain level of automata in vicinty of player
|
||||
if (listAutomata.size() < 20) |
||||
{ |
||||
bool bSpawnOK = false; |
||||
int nSpawnAttempt = 20; |
||||
while (!bSpawnOK && nSpawnAttempt > 0) |
||||
{ |
||||
// Find random cell on edge of vicinty, which is out of view of the player
|
||||
float fRandomAngle = ((float)rand() / (float)RAND_MAX) * 2.0f * 3.14159f; |
||||
int nRandomCellX = vCamera.x + cos(fRandomAngle) * 3.0f; |
||||
int nRandomCellY = vCamera.y + sin(fRandomAngle) * 3.0f; |
||||
|
||||
nSpawnAttempt--; |
||||
|
||||
if (pCity->Cell(nRandomCellX, nRandomCellY) && pCity->Cell(nRandomCellX, nRandomCellY)->nCellType == CELL_ROAD) |
||||
{ |
||||
bSpawnOK = true; |
||||
|
||||
// Add random automata
|
||||
if (rand() % 100 < 50) |
||||
{ |
||||
// Spawn Pedestrian
|
||||
SpawnPedestrian(nRandomCellX, nRandomCellY); |
||||
} |
||||
else |
||||
{ |
||||
// Spawn Vehicle
|
||||
SpawnVehicle(nRandomCellX, nRandomCellY); |
||||
// TODO: Get % chance of vehicle spawn from lua script
|
||||
} |
||||
} |
||||
}
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
// Render Scene
|
||||
Clear(olc::BLUE); |
||||
olc::GFX3D::ClearDepth(); |
||||
|
||||
// Create rendering pipeline
|
||||
olc::GFX3D::PipeLine pipe; |
||||
pipe.SetProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.1f, 1000.0f, 0.0f, 0.0f, (float)ScreenWidth(), (float)ScreenHeight()); |
||||
olc::GFX3D::vec3d vLookTarget = olc::GFX3D::Math::Vec_Add(vEye, vLookDir); |
||||
pipe.SetCamera(vEye, vLookTarget, vUp); |
||||
|
||||
|
||||
// Add global illumination vector (sunlight)
|
||||
olc::GFX3D::vec3d lightdir = { 1.0f, 1.0f, -1.0f }; |
||||
pipe.SetLightSource(0, olc::GFX3D::LIGHT_AMBIENT, olc::Pixel(100,100,100), { 0,0,0 }, lightdir); |
||||
pipe.SetLightSource(1, olc::GFX3D::LIGHT_DIRECTIONAL, olc::WHITE, { 0,0,0 }, lightdir); |
||||
|
||||
|
||||
// RENDER CELL CONTENTS
|
||||
|
||||
// Render Base Objects (those without alpha components)
|
||||
for (int x = nStartX; x < nEndX; x++) |
||||
{ |
||||
//omp_set_dynamic(0);
|
||||
//omp_set_num_threads(4);
|
||||
//#pragma omp parallel for
|
||||
for (int y = nStartY; y < nEndY; y++) |
||||
{ |
||||
pCity->Cell(x, y)->DrawBase(this, pipe); |
||||
} |
||||
//#pragma omp barrier
|
||||
} |
||||
|
||||
// Render Upper Objects (those with alpha components)
|
||||
for (int x = nStartX; x < nEndX; x++) |
||||
{ |
||||
for (int y = nStartY; y < nEndY; y++) |
||||
{ |
||||
pCity->Cell(x, y)->DrawAlpha(this, pipe); |
||||
} |
||||
} |
||||
|
||||
if (bEditMode) |
||||
{ |
||||
// Render additional per cell debug information
|
||||
for (int x = nStartX; x < nEndX; x++) |
||||
{ |
||||
for (int y = nStartY; y < nEndY; y++) |
||||
{ |
||||
pCity->Cell(x, y)->DrawDebug(this, pipe); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (bEditMode) |
||||
{ |
||||
// Draw Selections
|
||||
for (auto &c : setSelectedCells) |
||||
{ |
||||
int x = c % pCity->GetWidth(); |
||||
int y = c / pCity->GetWidth(); |
||||
olc::GFX3D::mat4x4 matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)x, (float)y, 0.01f); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.Render(mapAssetMeshes["UnitQuad"]->tris, olc::GFX3D::RENDER_WIRE); |
||||
} |
||||
} |
||||
|
||||
// RENDER AUTOMATA
|
||||
|
||||
std::string test[] = { "Sedan", "SUV", "TruckCab", "TruckTrailer", "UTE", "Wagon" }; |
||||
int i = 0; |
||||
for (auto &a : listAutomata) |
||||
{ |
||||
olc::GFX3D::vec3d v = { a->vAutoPos.x, a->vAutoPos.y, 0.0f }; |
||||
|
||||
/*olc::GFX3D::mat4x4 matWorld = olc::GFX3D::Math::Mat_MakeTranslation(a->vAutoPos.x, a->vAutoPos.y, 0.01f);
|
||||
matWorld = olc::GFX3D::Math::Mat_MultiplyMatrix(mapAssetTransform[test[i]], matWorld); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.SetTexture(mapAssetTextures[test[i]]); |
||||
pipe.Render(mapAssetMeshes[test[i]]->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_LIGHTS); |
||||
i++; |
||||
i = i % 6;*/ |
||||
|
||||
pipe.RenderCircleXZ(v, a->fAutoLength < 0.1f ? 0.05f : 0.07f, a->fAutoLength < 0.1f ? olc::MAGENTA : olc::YELLOW); |
||||
} |
||||
|
||||
|
||||
// Draw Player Vehicle
|
||||
{ |
||||
olc::GFX3D::mat4x4 matRotateZ = olc::GFX3D::Math::Mat_MakeRotationZ(fAngle); |
||||
olc::GFX3D::mat4x4 matTranslate = olc::GFX3D::Math::Mat_MakeTranslation(carpos.x, carpos.y, 0.01f); |
||||
olc::GFX3D::mat4x4 matWorld = olc::GFX3D::Math::Mat_MultiplyMatrix(mapAssetTransform["Sedan"], matRotateZ);
|
||||
matWorld = olc::GFX3D::Math::Mat_MultiplyMatrix(matWorld, matTranslate); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.SetTexture(mapAssetTextures["Sedan"]); |
||||
pipe.Render(mapAssetMeshes[test[i]]->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_LIGHTS); |
||||
} |
||||
|
||||
DrawString(10, 10, "Automata: " + std::to_string(listAutomata.size()), olc::WHITE); |
||||
|
||||
|
||||
if (GetKey(olc::Key::ESCAPE).bPressed) |
||||
return false; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
bool cCarCrimeCity::OnUserDestroy() |
||||
{ |
||||
return true; |
||||
} |
@ -0,0 +1,289 @@ |
||||
/*
|
||||
Top Down City Based Car Crime Game - Part #2 |
||||
"Colin, I hope you're shooting 600+ wherever you are buddy. RIP." - javidx9 |
||||
|
||||
License (OLC-3) |
||||
~~~~~~~~~~~~~~~ |
||||
|
||||
Copyright 2018-2019 OneLoneCoder.com |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions |
||||
are met: |
||||
|
||||
1. Redistributions or derivations of source code must retain the above |
||||
copyright notice, this list of conditions and the following disclaimer. |
||||
|
||||
2. Redistributions or derivative works in binary form must reproduce |
||||
the above copyright notice. This list of conditions and the following |
||||
disclaimer must be reproduced in the documentation and/or other |
||||
materials provided with the distribution. |
||||
|
||||
3. Neither the name of the copyright holder nor the names of its |
||||
contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"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 COPYRIGHT |
||||
HOLDER OR CONTRIBUTORS 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. |
||||
|
||||
Instructions: |
||||
~~~~~~~~~~~~~ |
||||
Scroll with middle mouse wheel, TAB toggle edit mode, R to place road |
||||
P to place pavement, Q to place building, Arrow keys to drive car |
||||
|
||||
Relevant Video: https://youtu.be/fIV6P1W-wuo
|
||||
|
||||
Links |
||||
~~~~~ |
||||
YouTube: https://www.youtube.com/javidx9
|
||||
https://www.youtube.com/javidx9extra
|
||||
Discord: https://discord.gg/WhwHUMV
|
||||
Twitter: https://www.twitter.com/javidx9
|
||||
Twitch: https://www.twitch.tv/javidx9
|
||||
GitHub: https://www.github.com/onelonecoder
|
||||
Patreon: https://www.patreon.com/javidx9
|
||||
Homepage: https://www.onelonecoder.com
|
||||
|
||||
Author |
||||
~~~~~~ |
||||
David Barr, aka javidx9, ©OneLoneCoder 2019 |
||||
*/ |
||||
|
||||
|
||||
#pragma once |
||||
|
||||
#include "olcPixelGameEngine.h" |
||||
#include "olcPGEX_Graphics3D.h" |
||||
|
||||
#include "cGameSettings.h" |
||||
#include "cCityMap.h" |
||||
|
||||
#include <vector> |
||||
#include <unordered_set> |
||||
|
||||
struct sSmokeDecal |
||||
{ |
||||
float fLifetime = 0.1f; |
||||
olc::GFX3D::vec3d pos; |
||||
}; |
||||
|
||||
class cCarCrimeCity : public olc::PixelGameEngine |
||||
{ |
||||
public: |
||||
cCarCrimeCity(); |
||||
~cCarCrimeCity(); |
||||
|
||||
private: |
||||
bool OnUserCreate() override; |
||||
bool OnUserUpdate(float fElapsedTime) override; |
||||
bool OnUserDestroy() override; |
||||
|
||||
private: |
||||
|
||||
class cGameObjectQuad |
||||
{ |
||||
public: |
||||
cGameObjectQuad(float w, float h) |
||||
{ |
||||
fWidth = w; |
||||
fHeight = h; |
||||
fAngle = 0.0f; |
||||
|
||||
// Construct Model Quad Geometry
|
||||
vecPointsModel = { {-fWidth / 2.0f, -fHeight / 2.0f, -0.01f, 1.0f}, |
||||
{-fWidth / 2.0f, +fHeight / 2.0f, -0.01f, 1.0f}, |
||||
{+fWidth / 2.0f, +fHeight / 2.0f, -0.01f, 1.0f}, |
||||
{+fWidth / 2.0f, -fHeight / 2.0f, -0.01f, 1.0f} }; |
||||
|
||||
vecPointsWorld.resize(vecPointsModel.size()); |
||||
TransformModelToWorld(); |
||||
} |
||||
|
||||
void TransformModelToWorld() |
||||
{ |
||||
for (size_t i = 0; i < vecPointsModel.size(); ++i) |
||||
{ |
||||
vecPointsWorld[i] = { |
||||
(vecPointsModel[i].x * cosf(fAngle)) - (vecPointsModel[i].y * sinf(fAngle)) + pos.x, |
||||
(vecPointsModel[i].x * sinf(fAngle)) + (vecPointsModel[i].y * cosf(fAngle)) + pos.y, |
||||
vecPointsModel[i].z, |
||||
vecPointsModel[i].w |
||||
}; |
||||
} |
||||
} |
||||
|
||||
std::vector<olc::GFX3D::triangle> GetTriangles() |
||||
{ |
||||
// Return triangles based upon this quad
|
||||
return |
||||
{ |
||||
{vecPointsWorld[0], vecPointsWorld[1], vecPointsWorld[2], 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::RED}, |
||||
{vecPointsWorld[0], vecPointsWorld[2], vecPointsWorld[3], 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, olc::RED}, |
||||
}; |
||||
} |
||||
|
||||
// Use rectangle edge intersections.
|
||||
bool StaticCollisionWith(cGameObjectQuad &r2, bool bResolveStatic = false) |
||||
{ |
||||
struct vec2d { float x; float y; }; |
||||
|
||||
bool bCollision = false; |
||||
|
||||
// Check diagonals of R1 against edges of R2
|
||||
for (size_t p = 0; p < vecPointsWorld.size(); p++) |
||||
{ |
||||
vec2d line_r1s = { pos.x, pos.y }; |
||||
vec2d line_r1e = { vecPointsWorld[p].x, vecPointsWorld[p].y }; |
||||
|
||||
vec2d displacement = { 0,0 }; |
||||
|
||||
for (size_t q = 0; q < r2.vecPointsWorld.size(); q++) |
||||
{ |
||||
vec2d line_r2s = { r2.vecPointsWorld[q].x, r2.vecPointsWorld[q].y }; |
||||
vec2d line_r2e = { r2.vecPointsWorld[(q + 1) % r2.vecPointsWorld.size()].x, r2.vecPointsWorld[(q + 1) % r2.vecPointsWorld.size()].y }; |
||||
|
||||
// Standard "off the shelf" line segment intersection
|
||||
float h = (line_r2e.x - line_r2s.x) * (line_r1s.y - line_r1e.y) - (line_r1s.x - line_r1e.x) * (line_r2e.y - line_r2s.y); |
||||
float t1 = ((line_r2s.y - line_r2e.y) * (line_r1s.x - line_r2s.x) + (line_r2e.x - line_r2s.x) * (line_r1s.y - line_r2s.y)) / h; |
||||
float t2 = ((line_r1s.y - line_r1e.y) * (line_r1s.x - line_r2s.x) + (line_r1e.x - line_r1s.x) * (line_r1s.y - line_r2s.y)) / h; |
||||
|
||||
if (t1 >= 0.0f && t1 <= 1.0f && t2 >= 0.0f && t2 <= 1.0f) |
||||
{ |
||||
if (bResolveStatic) |
||||
{ |
||||
displacement.x += (1.0f - t1) * (line_r1e.x - line_r1s.x); |
||||
displacement.y += (1.0f - t1) * (line_r1e.y - line_r1s.y); |
||||
bCollision = true; |
||||
} |
||||
else |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
pos.x -= displacement.x; |
||||
pos.y -= displacement.y; |
||||
} |
||||
|
||||
// Check diagonals of R2 against edges of R1
|
||||
for (size_t p = 0; p < r2.vecPointsWorld.size(); p++) |
||||
{ |
||||
vec2d line_r1s = { r2.pos.x, r2.pos.y }; |
||||
vec2d line_r1e = { r2.vecPointsWorld[p].x, r2.vecPointsWorld[p].y }; |
||||
|
||||
vec2d displacement = { 0,0 }; |
||||
|
||||
for (size_t q = 0; q < vecPointsWorld.size(); q++) |
||||
{ |
||||
vec2d line_r2s = { vecPointsWorld[q].x, vecPointsWorld[q].y }; |
||||
vec2d line_r2e = { vecPointsWorld[(q + 1) % vecPointsWorld.size()].x, vecPointsWorld[(q + 1) % vecPointsWorld.size()].y }; |
||||
|
||||
// Standard "off the shelf" line segment intersection
|
||||
float h = (line_r2e.x - line_r2s.x) * (line_r1s.y - line_r1e.y) - (line_r1s.x - line_r1e.x) * (line_r2e.y - line_r2s.y); |
||||
float t1 = ((line_r2s.y - line_r2e.y) * (line_r1s.x - line_r2s.x) + (line_r2e.x - line_r2s.x) * (line_r1s.y - line_r2s.y)) / h; |
||||
float t2 = ((line_r1s.y - line_r1e.y) * (line_r1s.x - line_r2s.x) + (line_r1e.x - line_r1s.x) * (line_r1s.y - line_r2s.y)) / h; |
||||
|
||||
if (t1 >= 0.0f && t1 <= 1.0f && t2 >= 0.0f && t2 <= 1.0f) |
||||
{ |
||||
if (bResolveStatic) |
||||
{ |
||||
displacement.x += (1.0f - t1) * (line_r1e.x - line_r1s.x); |
||||
displacement.y += (1.0f - t1) * (line_r1e.y - line_r1s.y); |
||||
bCollision = true; |
||||
} |
||||
else |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
|
||||
pos.x += displacement.x; |
||||
pos.y += displacement.y; |
||||
} |
||||
|
||||
return bCollision; |
||||
} |
||||
|
||||
std::vector<olc::GFX3D::triangle> meshTris; |
||||
std::vector<olc::GFX3D::vec3d> vecPointsModel; |
||||
std::vector<olc::GFX3D::vec3d> vecPointsWorld; |
||||
olc::GFX3D::vec3d pos; |
||||
|
||||
float fWidth; |
||||
float fHeight; |
||||
float fOriginX; |
||||
float fOriginY; |
||||
float fAngle; |
||||
}; |
||||
|
||||
bool LoadAssets(); |
||||
|
||||
std::map<std::string, olc::Sprite*> mapAssetTextures; |
||||
std::map<std::string, olc::GFX3D::mesh*> mapAssetMeshes; |
||||
std::map<std::string, olc::GFX3D::mat4x4> mapAssetTransform; |
||||
|
||||
// Camera variables
|
||||
olc::GFX3D::vec3d vCamera = { 0.0f, 0.0f, -3.0f }; |
||||
olc::GFX3D::vec3d vUp = { 0.0f, 1.0f, 0.0f }; |
||||
olc::GFX3D::vec3d vEye = { 0.0f, 0.0f, -3.0f }; |
||||
olc::GFX3D::vec3d vLookDir = { 0.0f, 0.0f, 1.0f }; |
||||
|
||||
// Ray Casting Parameters
|
||||
olc::vf2d viewWorldTopLeft; |
||||
olc::vf2d viewWorldBottomRight; |
||||
|
||||
// Cloud movement variables
|
||||
float fCloudOffsetX = 0.0f; |
||||
float fCloudOffsetY = 0.0f; |
||||
|
||||
// Mouse Control
|
||||
olc::vf2d vOffset = { 0.0f, 0.0f }; |
||||
olc::vf2d vStartPan = { 0.0f, 0.0f }; |
||||
olc::vf2d vMouseOnGround = { 0.0f, 0.0f }; |
||||
float fScale = 1.0f; |
||||
|
||||
olc::vf2d GetMouseOnGround(const olc::vf2d &vMouseScreen); |
||||
|
||||
//cVehicle car;
|
||||
olc::vf2d carvel; |
||||
olc::vf2d carpos; |
||||
float fSpeed = 0.0f; |
||||
float fAngle = 0.0f; |
||||
|
||||
std::list<cAuto_Body*> listAutomata; // Holds all automata, note its a pointer because we use polymorphism
|
||||
|
||||
void SpawnPedestrian(int x, int y); |
||||
void SpawnVehicle(int x, int y); |
||||
|
||||
//cGameObjectQuad *goCar = nullptr;
|
||||
//cGameObjectQuad *goObstacle = nullptr;
|
||||
|
||||
//std::vector<cGameObjectQuad> vecObstacles;
|
||||
|
||||
cCityMap *pCity = nullptr; |
||||
|
||||
float fGlobalTime = 0.0f; |
||||
|
||||
// Editing Utilities
|
||||
bool bEditMode = true; |
||||
int nMouseX = 0; |
||||
int nMouseY = 0; |
||||
|
||||
struct sCellLoc { int x, y; }; |
||||
std::unordered_set<int> setSelectedCells; |
||||
|
||||
//std::list<sSmokeDecal> listDecalSmoke;
|
||||
|
||||
//int nTrafficState = 0;
|
||||
|
||||
void DoEditMode(float fElapsedTime); |
||||
}; |
||||
|
@ -0,0 +1,121 @@ |
||||
#include "cCell.h" |
||||
|
||||
#include "cCityMap.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include <map> |
||||
|
||||
cCell::cCell() |
||||
{ |
||||
} |
||||
|
||||
|
||||
cCell::~cCell() |
||||
{ |
||||
// Cells own a list of automata navigation tracks
|
||||
// but this will be destroyed when the cell is deleted
|
||||
} |
||||
|
||||
cCell::cCell(cCityMap* map, int x, int y) |
||||
{ |
||||
pMap = map; |
||||
nWorldX = x; |
||||
nWorldY = y; |
||||
nCellType = CELL_BLANK; |
||||
|
||||
// Connect internal nodes
|
||||
for (int i = 0; i < 49; i++) |
||||
pNaviNodes[i] = pMap->GetAutoNodeBase(x, y) + i; |
||||
|
||||
// Link cell into maps node pool
|
||||
if (y > 0) |
||||
{ |
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[i] = pMap->GetAutoNodeBase(x, y - 1) + 42 + i; |
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[i] = nullptr; |
||||
} |
||||
|
||||
if (x > 0) |
||||
{ |
||||
// Link West side
|
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[i * 7] = pMap->GetAutoNodeBase(x - 1, y) + 6 + i * 7; |
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[i * 7] = nullptr; |
||||
} |
||||
|
||||
// South Side
|
||||
if (y < pMap->GetHeight() - 1) |
||||
{ |
||||
|
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[42 + i] = nullptr; |
||||
} |
||||
|
||||
// East Side
|
||||
if (x < pMap->GetWidth() - 1) |
||||
{ |
||||
} |
||||
else |
||||
{ |
||||
for (int i = 0; i < 7; i++) |
||||
pNaviNodes[6 + i * 7] = nullptr; |
||||
} |
||||
|
||||
// Unused Nodes
|
||||
pNaviNodes[9] = nullptr; |
||||
pNaviNodes[11] = nullptr; |
||||
pNaviNodes[15] = nullptr; |
||||
pNaviNodes[19] = nullptr; |
||||
pNaviNodes[29] = nullptr; |
||||
pNaviNodes[33] = nullptr; |
||||
pNaviNodes[37] = nullptr; |
||||
pNaviNodes[39] = nullptr; |
||||
pNaviNodes[0] = nullptr; |
||||
pNaviNodes[6] = nullptr; |
||||
pNaviNodes[42] = nullptr; |
||||
pNaviNodes[48] = nullptr; |
||||
|
||||
} |
||||
|
||||
|
||||
bool cCell::LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell::Update(float fElapsedTime) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell::DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell::DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell::DrawDebug(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe) |
||||
{ |
||||
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
void cCell::CalculateAdjacency() |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,60 @@ |
||||
#pragma once |
||||
|
||||
#include <map> |
||||
|
||||
#include "olcPixelGameEngine.h" |
||||
#include "olcPGEX_Graphics3D.h" |
||||
|
||||
#include "cAutomata.h" |
||||
|
||||
|
||||
class cCityMap; |
||||
|
||||
enum CellType |
||||
{ |
||||
CELL_BLANK, |
||||
CELL_GRASS, |
||||
CELL_CONCRETE, |
||||
CELL_WATER, |
||||
CELL_BUILDING, |
||||
CELL_ROAD, |
||||
CELL_PAVEMENT, |
||||
}; |
||||
|
||||
class cCell |
||||
{ |
||||
public: |
||||
cCell(); |
||||
cCell(cCityMap* map, int x, int y); |
||||
~cCell(); |
||||
|
||||
protected: |
||||
cCityMap* pMap = nullptr; |
||||
|
||||
public: |
||||
int nWorldX = 0; |
||||
int nWorldY = 0; |
||||
bool bSolid = false; |
||||
CellType nCellType = CELL_BLANK; |
||||
|
||||
// This cell may actuall be occupied by a multi-cell body
|
||||
// so this pointer points to the host cell that contains
|
||||
// that body
|
||||
cCell* pHostCell = nullptr; |
||||
|
||||
// Each cell links to 20 automata transport nodes, 5 on each side
|
||||
cAuto_Node* pNaviNodes[49]; |
||||
|
||||
// Each cell can have a number of automata transport tracks, it owns them
|
||||
// These connect nodes together as determined by the cell
|
||||
std::list<cAuto_Track> listTracks; |
||||
|
||||
public: |
||||
virtual void CalculateAdjacency(); |
||||
virtual bool LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
virtual bool Update(float fElapsedTime); |
||||
virtual bool DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawDebug(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
}; |
||||
|
@ -0,0 +1,53 @@ |
||||
#include "cCell_Building.h" |
||||
|
||||
|
||||
|
||||
cCell_Building::cCell_Building(const std::string &name, cCityMap* map, int x, int y) : cCell(map, x, y) |
||||
{ |
||||
sName = name; |
||||
} |
||||
|
||||
|
||||
cCell_Building::~cCell_Building() |
||||
{ |
||||
} |
||||
|
||||
void cCell_Building::CalculateAdjacency() |
||||
{ |
||||
} |
||||
|
||||
bool cCell_Building::LinkAssets(std::map<std::string, olc::Sprite*>& mapTextures, std::map<std::string, olc::GFX3D::mesh*>& mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
texture = mapTextures[sName]; |
||||
mesh = mapMesh[sName]; |
||||
transform = mapTransforms[sName]; |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Building::Update(float fElapsedTime) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Building::DrawBase(olc::PixelGameEngine * pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
olc::GFX3D::mat4x4 matTranslate = olc::GFX3D::Math::Mat_MakeTranslation((float)nWorldX, (float)nWorldY, 0.0f); |
||||
olc::GFX3D::mat4x4 matWorld = olc::GFX3D::Math::Mat_MultiplyMatrix(transform, matTranslate); |
||||
pipe.SetTransform(matWorld); |
||||
if (texture != nullptr) |
||||
{ |
||||
pipe.SetTexture(texture); |
||||
pipe.Render(mesh->tris,olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_LIGHTS); |
||||
} |
||||
else |
||||
{ |
||||
pipe.Render(mesh->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_FLAT | olc::GFX3D::RENDER_LIGHTS); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Building::DrawAlpha(olc::PixelGameEngine * pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
|
||||
return false; |
||||
} |
@ -0,0 +1,25 @@ |
||||
#pragma once |
||||
#include "cCell.h" |
||||
#include "olcPGEX_Graphics3D.h" |
||||
|
||||
|
||||
class cCell_Building : public cCell |
||||
{ |
||||
public: |
||||
cCell_Building(const std::string &name, cCityMap* map, int x, int y); |
||||
~cCell_Building(); |
||||
|
||||
private: |
||||
std::string sName; |
||||
olc::Sprite* texture = nullptr; |
||||
olc::GFX3D::mesh* mesh = nullptr; |
||||
olc::GFX3D::mat4x4 transform; |
||||
|
||||
public: |
||||
virtual void CalculateAdjacency(); |
||||
virtual bool LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
virtual bool Update(float fElapsedTime); |
||||
virtual bool DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
}; |
||||
|
@ -0,0 +1,49 @@ |
||||
#include "cCell_Plane.h" |
||||
|
||||
|
||||
|
||||
cCell_Plane::cCell_Plane(cCityMap* map, int x, int y, CELL_PLANE type) : cCell(map, x, y) |
||||
{ |
||||
bSolid = false; |
||||
nType = type; |
||||
if (nType == PLANE_GRASS) nCellType = CELL_GRASS; |
||||
if (nType == PLANE_ASPHALT) nCellType = CELL_PAVEMENT; |
||||
} |
||||
|
||||
|
||||
cCell_Plane::~cCell_Plane() |
||||
{ |
||||
} |
||||
|
||||
bool cCell_Plane::LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
sprGrass = mapTextures["Grass"]; |
||||
sprPavement = mapTextures["Pavement"]; |
||||
meshUnitQuad = mapMesh["UnitQuad"]; |
||||
return true; |
||||
} |
||||
|
||||
bool cCell_Plane::Update(float fElapsedTime) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Plane::DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe) |
||||
{ |
||||
olc::GFX3D::mat4x4 matWorld; |
||||
matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)nWorldX, (float)nWorldY, 0.0f); |
||||
pipe.SetTransform(matWorld); |
||||
|
||||
if(nType == PLANE_GRASS) |
||||
pipe.SetTexture(sprGrass); |
||||
else |
||||
pipe.SetTexture(sprPavement); |
||||
|
||||
pipe.Render(meshUnitQuad->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED); |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Plane::DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe) |
||||
{ |
||||
return false; |
||||
} |
@ -0,0 +1,34 @@ |
||||
#pragma once |
||||
#include "cCell.h" |
||||
#include "olcPixelGameEngine.h" |
||||
#include "olcPGEX_Graphics3D.h" |
||||
#include <map> |
||||
|
||||
|
||||
enum CELL_PLANE |
||||
{ |
||||
PLANE_GRASS, |
||||
PLANE_ASPHALT |
||||
}; |
||||
|
||||
class cCell_Plane : public cCell |
||||
{ |
||||
public: |
||||
cCell_Plane(cCityMap* map, int x, int y, CELL_PLANE type); |
||||
~cCell_Plane(); |
||||
|
||||
protected: |
||||
CELL_PLANE nType = PLANE_GRASS; |
||||
|
||||
private: |
||||
olc::GFX3D::mesh* meshUnitQuad = nullptr; |
||||
olc::Sprite* sprGrass = nullptr; |
||||
olc::Sprite* sprPavement = nullptr; |
||||
|
||||
public: |
||||
virtual bool LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
virtual bool Update(float fElapsedTime); |
||||
virtual bool DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
}; |
||||
|
@ -0,0 +1,812 @@ |
||||
#include "cCell_Road.h" |
||||
#include "cCityMap.h" |
||||
|
||||
|
||||
cCell_Road::cCell_Road(cCityMap* map, int x, int y) : cCell(map, x, y) |
||||
{ |
||||
bSolid = false; |
||||
nCellType = CELL_ROAD; |
||||
} |
||||
|
||||
cCell_Road::~cCell_Road() |
||||
{ |
||||
} |
||||
|
||||
void cCell_Road::CalculateAdjacency() |
||||
{ |
||||
|
||||
// Calculate suitable road junction type
|
||||
auto r = [&](int i, int j) |
||||
{ |
||||
return (pMap->Cell(nWorldX + i, nWorldY + j) != nullptr && pMap->Cell(nWorldX + i, nWorldY + j)->nCellType == CELL_ROAD); |
||||
}; |
||||
|
||||
if (r(0, -1) && r(0, +1) && !r(-1, 0) && !r(+1, 0)) nRoadType = ROAD_V; |
||||
if (!r(0, -1) && !r(0, +1) && r(-1, 0) && r(+1, 0)) nRoadType =ROAD_H; |
||||
if (!r(0, -1) && r(0, +1) && !r(-1, 0) && r(+1, 0)) nRoadType = ROAD_C1; |
||||
if (!r(0, -1) && r(0, +1) && r(-1, 0) && r(+1, 0)) nRoadType =ROAD_T1; |
||||
if (!r(0, -1) && r(0, +1) && r(-1, 0) && !r(+1, 0)) nRoadType = ROAD_C2; |
||||
if (r(0, -1) && r(0, +1) && !r(-1, 0) && r(+1, 0)) nRoadType = ROAD_T2; |
||||
if (r(0, -1) && r(0, +1) && r(-1, 0) && r(+1, 0)) nRoadType = ROAD_X; |
||||
if (r(0, -1) && r(0, +1) && r(-1, 0) && !r(+1, 0)) nRoadType = ROAD_T3; |
||||
if (r(0, -1) && !r(0, +1) && !r(-1, 0) && r(+1, 0)) nRoadType = ROAD_C3; |
||||
if (r(0, -1) && !r(0, +1) && r(-1, 0) && r(+1, 0)) nRoadType = ROAD_T4; |
||||
if (r(0, -1) && !r(0, +1) && r(-1, 0) && !r(+1, 0)) nRoadType = ROAD_C4; |
||||
|
||||
// Add navigation tracks based on type
|
||||
|
||||
auto AddTrack = [&](int n1, int n2) -> cAuto_Track* |
||||
{ |
||||
if (pNaviNodes[n1] == nullptr || pNaviNodes[n2] == nullptr) |
||||
{ |
||||
// Can't add track
|
||||
return nullptr; |
||||
} |
||||
else |
||||
{ |
||||
// Nodes exist so add track
|
||||
cAuto_Track t; |
||||
t.node[0] = pNaviNodes[n1]; |
||||
t.node[1] = pNaviNodes[n2]; |
||||
t.cell = this; |
||||
t.fTrackLength = (pNaviNodes[n1]->pos - pNaviNodes[n2]->pos).mag(); |
||||
listTracks.push_back(t); |
||||
|
||||
// Add pointers to track to start and end nodes
|
||||
pNaviNodes[n1]->listTracks.push_back(&listTracks.back()); |
||||
pNaviNodes[n2]->listTracks.push_back(&listTracks.back()); |
||||
|
||||
return &listTracks.back(); |
||||
} |
||||
}; |
||||
|
||||
// Ensure list of tracks for this cell is clear
|
||||
listTracks.clear(); |
||||
|
||||
// Add tracks depending on junction type
|
||||
pSafePedestrianTrack = nullptr; |
||||
pSafeCarTrack = nullptr; |
||||
pSafeChaseTrack = nullptr; |
||||
|
||||
// Add Pedestrian Tracks
|
||||
switch (nRoadType) |
||||
{ |
||||
case ROAD_H: pSafePedestrianTrack = AddTrack(7, 13); AddTrack(41, 35); break; |
||||
case ROAD_V: pSafePedestrianTrack = AddTrack(1, 43); AddTrack(5, 47); break; |
||||
|
||||
case ROAD_C1: pSafePedestrianTrack = AddTrack(43, 8); AddTrack(8, 13); AddTrack(47, 40); AddTrack(40, 41); break; |
||||
case ROAD_C2: AddTrack(7, 12); AddTrack(12, 47); pSafePedestrianTrack = AddTrack(35, 36); AddTrack(36, 43); break; |
||||
case ROAD_C3: AddTrack(1, 36); pSafePedestrianTrack = AddTrack(36, 41); AddTrack(5, 12); AddTrack(12, 13); break; |
||||
case ROAD_C4: AddTrack(35, 40); AddTrack(40, 5); pSafePedestrianTrack = AddTrack(7, 8); AddTrack(8, 1); break; |
||||
|
||||
case ROAD_T1: pSafePedestrianTrack = AddTrack(7, 8); AddTrack(8, 12); AddTrack(12, 13); AddTrack(35, 36); AddTrack(36, 38); AddTrack(38, 40); AddTrack(40, 41); AddTrack(8, 22); AddTrack(22, 36); AddTrack(36, 43); AddTrack(12, 26); AddTrack(26, 40); AddTrack(40, 47); break; |
||||
case ROAD_T2: pSafePedestrianTrack = AddTrack(1, 8); AddTrack(8, 36); AddTrack(36, 43); AddTrack(5, 12); AddTrack(12, 26); AddTrack(26, 40); AddTrack(40, 47); AddTrack(8, 10); AddTrack(10, 12); AddTrack(12, 13); AddTrack(36, 38), AddTrack(38, 40); AddTrack(40, 41); break; |
||||
case ROAD_T3: pSafePedestrianTrack = AddTrack(5, 12); AddTrack(12, 40); AddTrack(40, 47); AddTrack(1, 8); AddTrack(8, 22); AddTrack(22, 36); AddTrack(36, 43); AddTrack(12, 10); AddTrack(10, 8); AddTrack(8, 7); AddTrack(40, 38); AddTrack(38, 36); AddTrack(36, 35); break; |
||||
case ROAD_T4: pSafePedestrianTrack = AddTrack(35, 36); AddTrack(36, 40); AddTrack(40, 41); AddTrack(7, 8); AddTrack(8, 10); AddTrack(10, 12); AddTrack(12, 13); AddTrack(36, 22); AddTrack(22, 8); AddTrack(8, 1); AddTrack(40, 26); AddTrack(26, 12); AddTrack(12, 5); break; |
||||
|
||||
case ROAD_X: AddTrack(35, 36); AddTrack(36, 38); AddTrack(38, 40); AddTrack(40, 41); AddTrack(7, 8); AddTrack(8, 10); AddTrack(10, 12); AddTrack(12, 13); AddTrack(36, 22); AddTrack(22, 8); AddTrack(8, 1); AddTrack(40, 26); AddTrack(26, 12); AddTrack(12, 5); pSafePedestrianTrack = AddTrack(36, 43); AddTrack(40, 47); break; |
||||
} |
||||
|
||||
|
||||
// Add Chase Tracks
|
||||
switch (nRoadType) |
||||
{ |
||||
case ROAD_H: AddTrack(21, 27); break; |
||||
case ROAD_V: AddTrack(3, 45); break; |
||||
|
||||
case ROAD_C1: AddTrack(45, 24); AddTrack(24, 27); break; |
||||
case ROAD_C2: AddTrack(21, 24); AddTrack(24, 45); break; |
||||
case ROAD_C3: AddTrack(3, 24); AddTrack(24, 27); break; |
||||
case ROAD_C4: AddTrack(21, 24); AddTrack(24, 3); break; |
||||
|
||||
case ROAD_T1: AddTrack(21, 24); AddTrack(24, 27); AddTrack(24, 45); break; |
||||
case ROAD_T2: AddTrack(3, 24); AddTrack(24, 45); AddTrack(24, 27); break; |
||||
case ROAD_T3: AddTrack(3, 24); AddTrack(24, 45); AddTrack(24, 21); break; |
||||
case ROAD_T4: AddTrack(21, 24); AddTrack(24, 27); AddTrack(24, 3); break; |
||||
|
||||
case ROAD_X: AddTrack(3, 24); AddTrack(27, 24); AddTrack(45, 24); AddTrack(21, 24); break; |
||||
} |
||||
|
||||
|
||||
//// Road traffic tracks
|
||||
switch (nRoadType) |
||||
{ |
||||
case ROAD_H: pSafeCarTrack = AddTrack(14, 20); AddTrack(28, 34); break; |
||||
case ROAD_V: AddTrack(2, 44); pSafeCarTrack = AddTrack(4, 46); break; |
||||
|
||||
case ROAD_C1: pSafeCarTrack = AddTrack(44, 16); AddTrack(16, 20); AddTrack(46, 32); AddTrack(32, 34); break; |
||||
case ROAD_C2: pSafeCarTrack = AddTrack(14, 18); AddTrack(18, 46); AddTrack(28, 30); AddTrack(30, 44); break; |
||||
case ROAD_C3: AddTrack(2, 30); AddTrack(30, 34); pSafeCarTrack = AddTrack(4, 18); AddTrack(18, 20); break; |
||||
case ROAD_C4: AddTrack(2, 16); AddTrack(16, 14); pSafeCarTrack = AddTrack(4, 32); AddTrack(32, 28); break; |
||||
|
||||
|
||||
case ROAD_T1: AddTrack(14, 16); AddTrack(16, 18); AddTrack(18, 20); AddTrack(28, 30); AddTrack(30, 32); AddTrack(32, 34); |
||||
AddTrack(16, 30); AddTrack(30, 44); AddTrack(18, 32); AddTrack(32, 46); break; |
||||
|
||||
case ROAD_T4: AddTrack(14, 16); AddTrack(16, 18); AddTrack(18, 20); AddTrack(28, 30); AddTrack(30, 32); AddTrack(32, 34); |
||||
AddTrack(16, 30); AddTrack(16, 2); AddTrack(18, 32); AddTrack(18, 4); break; |
||||
|
||||
case ROAD_T2: AddTrack(2, 16); AddTrack(16, 30); AddTrack(30, 44); AddTrack(4, 18); AddTrack(18, 32); AddTrack(32, 46); |
||||
AddTrack(16, 18); AddTrack(18, 20); AddTrack(30, 32); AddTrack(32, 34); break; |
||||
|
||||
case ROAD_T3: AddTrack(2, 16); AddTrack(16, 30); AddTrack(30, 44); AddTrack(4, 18); AddTrack(18, 32); AddTrack(32, 46); |
||||
AddTrack(14, 16); AddTrack(16, 18); AddTrack(28, 30); AddTrack(30, 32); break; |
||||
|
||||
case ROAD_X:
|
||||
AddTrack(2, 16); AddTrack(16, 30); AddTrack(30, 44); AddTrack(4, 18); AddTrack(18, 32); AddTrack(32, 46); |
||||
AddTrack(14, 16); AddTrack(16, 18); AddTrack(18, 20); AddTrack(28, 30); AddTrack(30, 32); AddTrack(32, 34); break; |
||||
} |
||||
|
||||
|
||||
// Stop Patterns, here we go, loads of data... :(
|
||||
|
||||
// .PO.OP.
|
||||
// PP.P.PP
|
||||
// O.O.O.O
|
||||
// .P...P.
|
||||
// O.O.O.O
|
||||
// PP.P.PP
|
||||
// .PO.OP.
|
||||
|
||||
// .PO.OP.
|
||||
// PP.P.PP
|
||||
// O.X.X.O
|
||||
// .P...P.
|
||||
// O.X.X.O
|
||||
// PP.P.PP
|
||||
// .PO.OP.
|
||||
|
||||
// .PO.OP.
|
||||
// PP.X.PP
|
||||
// O.X.X.O
|
||||
// .X...X.
|
||||
// O.X.X.O
|
||||
// PP.X.PP
|
||||
// .PO.OP.
|
||||
|
||||
auto stopmap = [&](const std::string &s) |
||||
{ |
||||
StopPattern p; |
||||
for (size_t i = 0; i < s.size(); i++) |
||||
p.bStop[i] = (s[i] == 'X');
|
||||
return p; |
||||
}; |
||||
|
||||
switch (nRoadType) |
||||
{ |
||||
case ROAD_H: |
||||
case ROAD_V: |
||||
case ROAD_C1: |
||||
case ROAD_C2: |
||||
case ROAD_C3: |
||||
case ROAD_C4: |
||||
// Allow all
|
||||
/*vStopPattern.push_back(
|
||||
stopmap( |
||||
".PO.OP." |
||||
"PP.P.PP" |
||||
"O.O.O.O" |
||||
".P...P." |
||||
"O.O.O.O" |
||||
"PP.P.PP" |
||||
".PO.OP."));*/ |
||||
break; |
||||
|
||||
case ROAD_X: |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"O.O.O.O" |
||||
".X...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.OP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow EAST Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...X." |
||||
"O.O.O.O" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain East Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PO.XP.")); |
||||
// Drain SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
|
||||
break; |
||||
|
||||
case ROAD_T1: |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"O.O.O.O" |
||||
".X...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow EAST Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"O.O.O.O" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain East Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PO.XP.")); |
||||
// Drain SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
break; |
||||
|
||||
case ROAD_T2: |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".P...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.OP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".P...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".P...X." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow EAST Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".P...X." |
||||
"X.O.O.O" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain East Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".P...X." |
||||
"X.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".P...X." |
||||
"X.O.X.X" |
||||
"PP.X.PP" |
||||
".PO.XP.")); |
||||
// Drain SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".P...X." |
||||
"X.O.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
break; |
||||
case ROAD_T3: |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP."
|
||||
"PP.P.PP"
|
||||
"X.X.X.X"
|
||||
".P...P."
|
||||
"X.X.X.X"
|
||||
"PP.P.PP"
|
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...P." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"O.O.O.X" |
||||
".X...P." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.X" |
||||
".X...P." |
||||
"X.X.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.OP." |
||||
"PP.X.PP" |
||||
"X.X.O.X" |
||||
".X...P." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
// Drain North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.O.X" |
||||
".X...P." |
||||
"O.O.O.X" |
||||
"PP.X.PP" |
||||
".PX.OP.")); |
||||
|
||||
// Allow SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...P." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PO.XP.")); |
||||
// Drain SOUTH Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...P." |
||||
"O.O.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
break; |
||||
|
||||
case ROAD_T4: |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Allow West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"O.O.O.O" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain West Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.O.O" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Allow North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.OP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain North Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.O.O" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Allow Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.P.PP" |
||||
"X.X.X.X" |
||||
".P...P." |
||||
"X.X.X.X" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain Pedestrians
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PX.XP." |
||||
"PP.X.PP" |
||||
"X.X.X.X" |
||||
".X...X." |
||||
"X.X.X.X" |
||||
"PP.X.PP" |
||||
".PX.XP.")); |
||||
// Allow EAST Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...X." |
||||
"O.O.O.O" |
||||
"PP.P.PP" |
||||
".PX.XP.")); |
||||
// Drain East Traffic
|
||||
vStopPattern.push_back( |
||||
stopmap( |
||||
".PO.XP." |
||||
"PP.X.PP" |
||||
"X.O.X.X" |
||||
".X...X." |
||||
"O.O.O.X" |
||||
"PP.P.PP" |
||||
".PX.XP."));
|
||||
break; |
||||
|
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
bool cCell_Road::LinkAssets(std::map<std::string, olc::Sprite*>& mapTextures, std::map<std::string, olc::GFX3D::mesh*>& mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
meshUnitQuad = mapMesh["UnitQuad"]; |
||||
sprRoadTex[ROAD_V] = mapTextures["Road_V"]; |
||||
sprRoadTex[ROAD_H] = mapTextures["Road_H"]; |
||||
sprRoadTex[ROAD_C1] = mapTextures["Road_C1"]; |
||||
sprRoadTex[ROAD_T1] = mapTextures["Road_T1"]; |
||||
sprRoadTex[ROAD_C2] = mapTextures["Road_C2"]; |
||||
sprRoadTex[ROAD_T2] = mapTextures["Road_T2"]; |
||||
sprRoadTex[ROAD_X] = mapTextures["Road_X"]; |
||||
sprRoadTex[ROAD_T3] = mapTextures["Road_T3"]; |
||||
sprRoadTex[ROAD_C3] = mapTextures["Road_C3"]; |
||||
sprRoadTex[ROAD_T4] = mapTextures["Road_T4"]; |
||||
sprRoadTex[ROAD_C4] = mapTextures["Road_C4"]; |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Road::Update(float fElapsedTime) |
||||
{ |
||||
if (vStopPattern.empty()) |
||||
return false; |
||||
|
||||
fStopPatternTimer += fElapsedTime; |
||||
if (fStopPatternTimer >= 5.0f) |
||||
{ |
||||
fStopPatternTimer -= 5.0f; |
||||
nCurrentStopPattern++; |
||||
nCurrentStopPattern %= vStopPattern.size(); |
||||
for (int i = 0; i < 49; i++) |
||||
if(pNaviNodes[i] != nullptr) |
||||
pNaviNodes[i]->bBlock = vStopPattern[nCurrentStopPattern].bStop[i]; |
||||
} |
||||
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Road::DrawBase(olc::PixelGameEngine* pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
olc::GFX3D::mat4x4 matWorld; |
||||
matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)nWorldX, (float)nWorldY, 0.0f); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.SetTexture(sprRoadTex[nRoadType]); |
||||
pipe.Render(meshUnitQuad->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED); |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Road::DrawAlpha(olc::PixelGameEngine* pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Road::DrawDebug(olc::PixelGameEngine* pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
|
||||
|
||||
|
||||
// Draw Automata navigation tracks
|
||||
for (auto &track : listTracks) |
||||
{ |
||||
olc::GFX3D::vec3d p1 = { track.node[0]->pos.x, track.node[0]->pos.y, 0.0f }; |
||||
olc::GFX3D::vec3d p2 = { track.node[1]->pos.x, track.node[1]->pos.y, 0.0f }; |
||||
pipe.RenderLine(p1, p2, olc::CYAN); |
||||
} |
||||
|
||||
|
||||
for (int i = 0; i < 49; i++) |
||||
{ |
||||
if (pNaviNodes[i] != nullptr) |
||||
{ |
||||
olc::GFX3D::vec3d p1 = { pNaviNodes[i]->pos.x, pNaviNodes[i]->pos.y, 0.01f }; |
||||
pipe.RenderCircleXZ(p1, 0.03f, pNaviNodes[i]->bBlock ? olc::RED : olc::GREEN); |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
@ -0,0 +1,54 @@ |
||||
#pragma once |
||||
#include "cCell.h" |
||||
|
||||
enum RoadType |
||||
{ |
||||
ROAD_H, |
||||
ROAD_V, |
||||
ROAD_C1, |
||||
ROAD_C2, |
||||
ROAD_C3, |
||||
ROAD_C4, |
||||
ROAD_T1, |
||||
ROAD_T2, |
||||
ROAD_T3, |
||||
ROAD_T4, |
||||
ROAD_X, |
||||
}; |
||||
|
||||
|
||||
class cCell_Road : public cCell |
||||
{ |
||||
public: |
||||
cCell_Road(cCityMap* map, int x, int y); |
||||
~cCell_Road(); |
||||
|
||||
private: |
||||
struct StopPattern |
||||
{ |
||||
bool bStop[49]; |
||||
}; |
||||
|
||||
private: |
||||
bool bNeighboursAreRoads[4]; |
||||
|
||||
olc::GFX3D::mesh *meshUnitQuad = nullptr; |
||||
olc::Sprite* sprRoadTex[11]; |
||||
|
||||
std::vector<StopPattern> vStopPattern; |
||||
int nCurrentStopPattern = 0; |
||||
float fStopPatternTimer = 0.0f; |
||||
public: |
||||
RoadType nRoadType = ROAD_X; |
||||
cAuto_Track* pSafeCarTrack = nullptr; |
||||
cAuto_Track* pSafePedestrianTrack = nullptr; |
||||
cAuto_Track* pSafeChaseTrack = nullptr; |
||||
|
||||
virtual void CalculateAdjacency(); |
||||
virtual bool LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
virtual bool Update(float fElapsedTime); |
||||
virtual bool DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawDebug(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
}; |
||||
|
@ -0,0 +1,91 @@ |
||||
#include "cCell_Water.h" |
||||
#include "cCityMap.h" |
||||
|
||||
|
||||
cCell_Water::cCell_Water(cCityMap* map, int x, int y) : cCell(map, x, y) |
||||
{ |
||||
nCellType = CELL_WATER; |
||||
bNeighboursAreWater[0] = false; |
||||
bNeighboursAreWater[1] = false; |
||||
bNeighboursAreWater[2] = false; |
||||
bNeighboursAreWater[3] = false; |
||||
} |
||||
|
||||
|
||||
cCell_Water::~cCell_Water() |
||||
{ |
||||
} |
||||
|
||||
bool cCell_Water::LinkAssets(std::map<std::string, olc::Sprite*>& mapTextures, std::map<std::string, olc::GFX3D::mesh*>& mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
meshUnitQuad = mapMesh["UnitQuad"]; |
||||
meshWalls = mapMesh["WallsOut"]; |
||||
sprWater = mapTextures["Water"]; |
||||
sprSides = mapTextures["WaterSide"]; |
||||
sprClouds = mapTextures["Clouds"];
|
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Water::Update(float fElapsedTime) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Water::DrawBase(olc::PixelGameEngine * pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
olc::GFX3D::mat4x4 matWorld; |
||||
matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)nWorldX, (float)nWorldY, 0.0f); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.SetTexture(sprSides); |
||||
if (!bNeighboursAreWater[1]) pipe.Render(meshWalls->tris, olc::GFX3D::RENDER_LIGHTS | olc::GFX3D::RENDER_CULL_CCW | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_DEPTH, 0, 2); |
||||
if (!bNeighboursAreWater[3]) pipe.Render(meshWalls->tris, olc::GFX3D::RENDER_LIGHTS | olc::GFX3D::RENDER_CULL_CCW | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_DEPTH, 2, 2); |
||||
if (!bNeighboursAreWater[2]) pipe.Render(meshWalls->tris, olc::GFX3D::RENDER_LIGHTS | olc::GFX3D::RENDER_CULL_CCW | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_DEPTH, 4, 2); |
||||
if (!bNeighboursAreWater[0]) pipe.Render(meshWalls->tris, olc::GFX3D::RENDER_LIGHTS | olc::GFX3D::RENDER_CULL_CCW | olc::GFX3D::RENDER_TEXTURED | olc::GFX3D::RENDER_DEPTH, 6, 2); |
||||
return false; |
||||
} |
||||
|
||||
bool cCell_Water::DrawAlpha(olc::PixelGameEngine * pge, olc::GFX3D::PipeLine & pipe) |
||||
{ |
||||
auto renderWater = [&](const int x, const int y, const olc::Pixel& pSource, const olc::Pixel& pDest) |
||||
{ |
||||
float a = (float)(pSource.a / 255.0f) * 0.6f; |
||||
float c = 1.0f - a; |
||||
float r = a * (float)pSource.r + c * (float)pDest.r; |
||||
float g = a * (float)pSource.g + c * (float)pDest.g; |
||||
float b = a * (float)pSource.b + c * (float)pDest.b; |
||||
|
||||
a = 0.4f; |
||||
c = 1.0f - a; |
||||
olc::Pixel sky = sprClouds->GetPixel(x, y); |
||||
float sr = a * (float)sky.r + c * r; |
||||
float sg = a * (float)sky.g + c * g; |
||||
float sb = a * (float)sky.b + c * b; |
||||
|
||||
return olc::Pixel((uint8_t)sr, (uint8_t)sg, (uint8_t)sb); |
||||
}; |
||||
|
||||
pge->SetPixelMode(renderWater); |
||||
olc::GFX3D::mat4x4 matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)nWorldX, (float)nWorldY, 0.07f); |
||||
pipe.SetTransform(matWorld); |
||||
pipe.SetTexture(sprWater); |
||||
pipe.Render(meshUnitQuad->tris, olc::GFX3D::RENDER_CULL_CW | olc::GFX3D::RENDER_DEPTH | olc::GFX3D::RENDER_TEXTURED); |
||||
pge->SetPixelMode(olc::Pixel::NORMAL); |
||||
return false; |
||||
} |
||||
|
||||
|
||||
void cCell_Water::CalculateAdjacency() |
||||
{ |
||||
auto r = [&](int i, int j) |
||||
{ |
||||
if (pMap->Cell(nWorldX + i, nWorldY + j) != nullptr) |
||||
return pMap->Cell(nWorldX + i, nWorldY + j)->nCellType == CELL_WATER; |
||||
else |
||||
return false; |
||||
}; |
||||
|
||||
bNeighboursAreWater[0] = r(0, -1); |
||||
bNeighboursAreWater[1] = r(+1, 0); |
||||
bNeighboursAreWater[2] = r(0, +1); |
||||
bNeighboursAreWater[3] = r(-1, 0);
|
||||
} |
@ -0,0 +1,25 @@ |
||||
#pragma once |
||||
#include "cCell.h" |
||||
class cCell_Water : public cCell |
||||
{ |
||||
public: |
||||
cCell_Water(cCityMap* map, int x, int y); |
||||
~cCell_Water(); |
||||
|
||||
private: |
||||
olc::GFX3D::mesh* meshUnitQuad = nullptr; |
||||
olc::GFX3D::mesh* meshWalls = nullptr; |
||||
olc::Sprite* sprWater = nullptr; |
||||
olc::Sprite* sprSides = nullptr; |
||||
olc::Sprite* sprClouds = nullptr; |
||||
|
||||
bool bNeighboursAreWater[4]; |
||||
|
||||
public: |
||||
virtual void CalculateAdjacency(); |
||||
virtual bool LinkAssets(std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
virtual bool Update(float fElapsedTime); |
||||
virtual bool DrawBase(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
virtual bool DrawAlpha(olc::PixelGameEngine *pge, olc::GFX3D::PipeLine &pipe); |
||||
}; |
||||
|
@ -0,0 +1,202 @@ |
||||
#include "cCityMap.h" |
||||
|
||||
#include <fstream> |
||||
|
||||
|
||||
|
||||
cCityMap::cCityMap(int w, int h, std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
CreateCity(w, h, mapTextures, mapMesh, mapTransforms); |
||||
} |
||||
|
||||
cCityMap::~cCityMap() |
||||
{ |
||||
ReleaseCity(); |
||||
} |
||||
|
||||
int cCityMap::GetWidth() |
||||
{ |
||||
return nWidth; |
||||
} |
||||
|
||||
int cCityMap::GetHeight() |
||||
{ |
||||
return nHeight; |
||||
} |
||||
|
||||
cCell* cCityMap::Cell(int x, int y) |
||||
{ |
||||
if (x >= 0 && x < nWidth && y >= 0 && y < nHeight) |
||||
return pCells[y*nWidth + x]; |
||||
else |
||||
return nullptr; |
||||
} |
||||
|
||||
cCell* cCityMap::Replace(int x, int y, cCell* cell) |
||||
{ |
||||
if (cell == nullptr) |
||||
return nullptr; |
||||
|
||||
if (pCells[y * nWidth + x] != nullptr) |
||||
delete pCells[y * nWidth + x]; |
||||
|
||||
pCells[y * nWidth + x] = cell; |
||||
return cell; |
||||
} |
||||
|
||||
void cCityMap::CreateCity(int w, int h, std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms) |
||||
{ |
||||
ReleaseCity(); |
||||
nWidth = w; |
||||
nHeight = h; |
||||
pCells = new cCell*[nHeight * nWidth]; |
||||
|
||||
// Create Navigation Node Pool, assumes 5 nodes on east and south
|
||||
// side of each cell. The City owns these nodes, and cells in the
|
||||
// city borrow them and link to them as required
|
||||
pNodes = new cAuto_Node[nHeight * nWidth * 49]; |
||||
|
||||
// The cell has 49 nodes, though some are simply unused. This is less memory
|
||||
// efficient certainly, but makes code more intuitive and easier to write
|
||||
|
||||
for (int x = 0; x < nWidth; x++) |
||||
{ |
||||
for (int y = 0; y < nHeight; y++) |
||||
{ |
||||
// Nodes sit between cells, therefore each create nodes along
|
||||
// the east and southern sides of the cell. This assumes that
|
||||
// navigation along the top and left boundaries of the map
|
||||
// will not occur. And it shouldnt, as its water
|
||||
|
||||
int idx = (y * nWidth + x) * 49; |
||||
|
||||
for (int dx = 0; dx < 7; dx++) |
||||
{ |
||||
float off_x = 0.0f; |
||||
switch (dx) |
||||
{ |
||||
case 0: off_x = 0.000f; break;
|
||||
case 1: off_x = 0.083f; break; |
||||
case 2: off_x = 0.333f; break; |
||||
case 3: off_x = 0.500f; break; |
||||
case 4: off_x = 0.667f; break; |
||||
case 5: off_x = 0.917f; break; |
||||
case 6: off_x = 1.000f; break; |
||||
} |
||||
|
||||
|
||||
for (int dy = 0; dy < 7; dy++) |
||||
{ |
||||
float off_y = 0.0f; |
||||
switch (dy) |
||||
{ |
||||
case 0: off_y = 0.000f; break; |
||||
case 1: off_y = 0.083f; break; |
||||
case 2: off_y = 0.333f; break; |
||||
case 3: off_y = 0.500f; break; |
||||
case 4: off_y = 0.667f; break; |
||||
case 5: off_y = 0.917f; break; |
||||
case 6: off_y = 1.000f; break; |
||||
} |
||||
|
||||
pNodes[idx + dy * 7 + dx].pos = { (float)x + off_x, (float)y + off_y }; |
||||
pNodes[idx + dy * 7 + dx].bBlock = false; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
// Now create default Cell
|
||||
for (int x = 0; x < nWidth; x++) |
||||
{ |
||||
for (int y = 0; y < nHeight; y++) |
||||
{ |
||||
// Default city, everything is grass
|
||||
pCells[y * nWidth + x] = new cCell_Plane(this, x, y, PLANE_GRASS); |
||||
|
||||
// Give the cell the opportunity to locally reference the resources it needs
|
||||
pCells[y * nWidth + x]->LinkAssets(mapTextures, mapMesh, mapTransforms); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
cAuto_Node* cCityMap::GetAutoNodeBase(int x, int y) |
||||
{ |
||||
return pNodes + (y * nWidth + x) * 49; |
||||
} |
||||
|
||||
void cCityMap::RemoveAllTracks() |
||||
{ |
||||
for (int i = 0; i < nWidth * nHeight * 49; i++) |
||||
{ |
||||
pNodes[i].listTracks.clear(); |
||||
} |
||||
} |
||||
|
||||
void cCityMap::ReleaseCity() |
||||
{ |
||||
for (int x = 0; x < nWidth; x++) |
||||
{ |
||||
for (int y = 0; y < nHeight; y++) |
||||
{ |
||||
// Erase any tracks attached to nodes
|
||||
for(int i=0; i<49; i++) |
||||
Cell(x, y)->pNaviNodes[i]->listTracks.clear(); |
||||
|
||||
// Release individual cell objects
|
||||
delete pCells[y * nWidth + x]; |
||||
} |
||||
} |
||||
|
||||
// Release array of cell pointers
|
||||
if (pCells != nullptr) delete pCells; |
||||
|
||||
// Release array of automata navigation nodes
|
||||
if (pNodes != nullptr) delete pNodes; |
||||
|
||||
nWidth = 0; |
||||
nHeight = 0; |
||||
} |
||||
|
||||
|
||||
bool cCityMap::SaveCity(std::string sFilename) |
||||
{ |
||||
/*std::ofstream file(sFilename, std::ios::out | std::ios::binary);
|
||||
if (!file.is_open()) return false; |
||||
|
||||
file.write((char*)&m_nWidth, sizeof(int)); |
||||
file.write((char*)&m_nHeight, sizeof(int)); |
||||
|
||||
for (int x = 0; x < m_nWidth; x++) |
||||
{ |
||||
for (int y = 0; y < m_nHeight; y++) |
||||
{ |
||||
file.write((char*)Cell(x, y), sizeof(cCityCell)); |
||||
} |
||||
}*/ |
||||
|
||||
return true; |
||||
} |
||||
|
||||
bool cCityMap::LoadCity(std::string sFilename) |
||||
{ |
||||
/*std::ifstream file(sFilename, std::ios::in | std::ios::binary);
|
||||
if (!file.is_open()) return false; |
||||
|
||||
int w, h; |
||||
file.read((char*)&w, sizeof(int)); |
||||
file.read((char*)&h, sizeof(int)); |
||||
CreateCity(w, h); |
||||
|
||||
for (int x = 0; x < m_nWidth; x++) |
||||
{ |
||||
for (int y = 0; y < m_nHeight; y++) |
||||
{ |
||||
file.read((char*)Cell(x, y), sizeof(cCityCell)); |
||||
} |
||||
}*/ |
||||
|
||||
return true; |
||||
} |
@ -0,0 +1,63 @@ |
||||
#pragma once |
||||
|
||||
#include <string> |
||||
#include <map> |
||||
|
||||
#include "olcPixelGameEngine.h" |
||||
#include "olcPGEX_Graphics3D.h" |
||||
#include "cCell.h" |
||||
#include "cCell_Plane.h" |
||||
#include "cCell_Water.h" |
||||
#include "cCell_Road.h" |
||||
#include "cCell_Building.h" |
||||
|
||||
/*
|
||||
This class holds the definition of a map. The map data is actually |
||||
stored within this clap, as well as accessors to access the individual |
||||
map cells |
||||
*/ |
||||
class cCityMap |
||||
{ |
||||
public: |
||||
// Construct a "blank" city w units wide by h units high
|
||||
cCityMap(int w, int h, std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
|
||||
// Cleans up city, like Batman
|
||||
~cCityMap(); |
||||
|
||||
public: |
||||
// Save the current city to a file, this will overwrite an existing
|
||||
// city file without warning. Returns true if successful
|
||||
bool SaveCity(std::string sFilename); |
||||
|
||||
// Load a city from file and replace current city with it, retuns
|
||||
// true if successful
|
||||
bool LoadCity(std::string sFilename); |
||||
|
||||
public: |
||||
// Return width of city in cells
|
||||
int GetWidth(); |
||||
// Return height of city in cells
|
||||
int GetHeight(); |
||||
// Return a specific cell reference if inside city limits, or nullptr
|
||||
cCell* Cell(int x, int y); |
||||
// Replace a specific cell
|
||||
cCell* Replace(int x, int y, cCell* cell); |
||||
|
||||
cAuto_Node* GetAutoNodeBase(int x, int y); |
||||
|
||||
void RemoveAllTracks(); |
||||
|
||||
private: |
||||
int nWidth = 0; |
||||
int nHeight = 0; |
||||
cCell **pCells = nullptr; |
||||
cAuto_Node *pNodes = nullptr; |
||||
|
||||
private: |
||||
// Creates a "default" city of specified size
|
||||
void CreateCity(int w, int h, std::map<std::string, olc::Sprite*> &mapTextures, std::map<std::string, olc::GFX3D::mesh*> &mapMesh, std::map<std::string, olc::GFX3D::mat4x4> &mapTransforms); |
||||
// Destroy city
|
||||
void ReleaseCity(); |
||||
}; |
||||
|
@ -0,0 +1,156 @@ |
||||
#include "cGameSettings.h" |
||||
|
||||
|
||||
|
||||
cGameSettings::cGameSettings() |
||||
{ |
||||
} |
||||
|
||||
cGameSettings::~cGameSettings() |
||||
{ |
||||
} |
||||
|
||||
bool cGameSettings::LoadConfigFile(std::string sFile) |
||||
{ |
||||
lua_State *L = luaL_newstate(); |
||||
luaL_openlibs(L); |
||||
|
||||
// Load game settings file
|
||||
int r = luaL_loadfile(L, sFile.c_str()); |
||||
if (r != LUA_OK) |
||||
{ |
||||
std::string errormsg = lua_tostring(L, -1); |
||||
std::cout << errormsg << std::endl; |
||||
return false; |
||||
} |
||||
|
||||
// Execute it
|
||||
int i = lua_pcall(L, 0, LUA_MULTRET, 0); |
||||
if (i != LUA_OK) |
||||
{ |
||||
std::string errormsg = lua_tostring(L, -1); |
||||
std::cout << errormsg << std::endl; |
||||
return false; |
||||
}
|
||||
|
||||
lua_getglobal(L, "PixelWidth"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nPixelWidth = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "PixelHeight"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nPixelHeight = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "ScreenWidth"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nScreenWidth = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "ScreenHeight"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nScreenHeight = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "DefaultMapWidth"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nDefaultMapWidth = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "DefaultMapHeight"); |
||||
if (lua_isinteger(L, -1)) cGameSettings::nDefaultMapHeight = (int)lua_tointeger(L, -1); |
||||
|
||||
lua_getglobal(L, "DefaultCityFile"); |
||||
if (lua_isstring(L, -1)) cGameSettings::sDefaultCityFile = lua_tostring(L, -1); |
||||
|
||||
lua_getglobal(L, "FullScreen"); |
||||
if (lua_isboolean(L, -1)) cGameSettings::bFullScreen = lua_toboolean(L, -1); |
||||
|
||||
|
||||
//// Load System Texture files
|
||||
|
||||
// Load Texture Assets
|
||||
lua_getglobal(L, "Textures"); // -1 Table "Teams"
|
||||
if (lua_istable(L, -1)) |
||||
{ |
||||
lua_pushnil(L); // -2 Key Nil : -1 Table "Teams"
|
||||
|
||||
while (lua_next(L, -2) != 0) // -1 Table : -2 Key "TeamName" : -3 Table "Teams"
|
||||
{ |
||||
sAssetTexture texture; |
||||
int stage = 0; |
||||
if (lua_istable(L, -1)) |
||||
{ |
||||
lua_gettable(L, -1); // -1 Table : -2 Table Value : -3 Key "TeamName" : -4 Table "Teams"
|
||||
lua_pushnil(L); // -1 Key Nil : -2 Table : -3 Table Value : -4 Key "TeamName" : -5 Table "Teams"
|
||||
while (lua_next(L, -2) != 0) // -1 Value "BotFile" : -2 Key Nil : -3 Table : -4 Table Value : -5 Key "TeamName" : -6 Table "Teams"
|
||||
{ |
||||
if (stage == 0) texture.sName = lua_tostring(L, -1); |
||||
if (stage == 1) texture.sFile = lua_tostring(L, -1);
|
||||
lua_pop(L, 1); // -1 Key Nil : -2 Table : -3 Table Value : -4 Key "TeamName" : -5 Table "Teams"
|
||||
stage++; |
||||
} |
||||
} |
||||
lua_pop(L, 1); // -1 Table : -2 Table Value : -3 Key "TeamName" : -4 Table "Teams"
|
||||
vecAssetTextures.push_back(texture); |
||||
} |
||||
} |
||||
|
||||
auto GroupLoadAssets = [L](const std::string &group, std::vector<sAssetModel> &vec) |
||||
{ |
||||
lua_getglobal(L, group.c_str());
|
||||
if (lua_istable(L, -1)) |
||||
{ |
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2) != 0)
|
||||
{ |
||||
sAssetModel model; |
||||
int stage = 0; |
||||
if (lua_istable(L, -1)) |
||||
{ |
||||
lua_gettable(L, -1);
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2) != 0) |
||||
{ |
||||
if (stage == 0) model.sCreator = lua_tostring(L, -1); |
||||
if (stage == 1) model.sDescription = lua_tostring(L, -1); |
||||
if (stage == 2) model.sModelOBJ = lua_tostring(L, -1); |
||||
if (stage == 3) model.sModelPNG = lua_tostring(L, -1); |
||||
|
||||
if (stage == 4) model.fRotate[0] = (float)lua_tonumber(L, -1); |
||||
if (stage == 5) model.fRotate[1] = (float)lua_tonumber(L, -1); |
||||
if (stage == 6) model.fRotate[2] = (float)lua_tonumber(L, -1); |
||||
|
||||
if (stage == 7) model.fScale[0] = (float)lua_tonumber(L, -1); |
||||
if (stage == 8) model.fScale[1] = (float)lua_tonumber(L, -1); |
||||
if (stage == 9) model.fScale[2] = (float)lua_tonumber(L, -1); |
||||
|
||||
if (stage == 10) model.fTranslate[0] = (float)lua_tonumber(L, -1); |
||||
if (stage == 11) model.fTranslate[1] = (float)lua_tonumber(L, -1); |
||||
if (stage == 12) model.fTranslate[2] = (float)lua_tonumber(L, -1); |
||||
lua_pop(L, 1);
|
||||
stage++; |
||||
} |
||||
} |
||||
lua_pop(L, 1); |
||||
vec.push_back(model); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
// Load Building Assets
|
||||
GroupLoadAssets("Buildings", vecAssetBuildings); |
||||
|
||||
// Load Vehicle Assets
|
||||
GroupLoadAssets("Vehicles", vecAssetVehicles); |
||||
|
||||
|
||||
lua_close(L); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
int cGameSettings::nScreenWidth = 768; |
||||
int cGameSettings::nScreenHeight = 480; |
||||
int cGameSettings::nPixelWidth = 2; |
||||
int cGameSettings::nPixelHeight = 2; |
||||
bool cGameSettings::bFullScreen = false; |
||||
|
||||
int cGameSettings::nDefaultMapWidth = 64; |
||||
int cGameSettings::nDefaultMapHeight = 32; |
||||
std::string cGameSettings::sDefaultCityFile = "";
|
||||
|
||||
std::vector<sAssetTexture> cGameSettings::vecAssetTextures; |
||||
std::vector<sAssetModel> cGameSettings::vecAssetBuildings; |
||||
std::vector<sAssetModel> cGameSettings::vecAssetVehicles; |
@ -0,0 +1,65 @@ |
||||
#pragma once |
||||
|
||||
#include <iostream> |
||||
#include <string> |
||||
#include <vector> |
||||
|
||||
extern "C" |
||||
{ |
||||
#include "lua533/include/lua.h" |
||||
#include "lua533/include/lauxlib.h" |
||||
#include "lua533/include/lualib.h" |
||||
} |
||||
|
||||
#ifdef _WIN32 |
||||
#pragma comment(lib, "lua533/liblua53.a") |
||||
#endif |
||||
|
||||
/*
|
||||
This is a singleton that stores all the games configuration settings. |
||||
These settings are loaded on game start up and are to be considered |
||||
read-only. |
||||
*/ |
||||
|
||||
struct sAssetModel |
||||
{ |
||||
std::string sCreator; |
||||
std::string sDescription; |
||||
std::string sModelOBJ; |
||||
std::string sModelPNG; |
||||
float fRotate[3]; |
||||
float fScale[3]; |
||||
float fTranslate[3]; |
||||
}; |
||||
|
||||
struct sAssetTexture |
||||
{ |
||||
std::string sName; |
||||
std::string sFile;
|
||||
}; |
||||
|
||||
class cGameSettings |
||||
{ |
||||
public: |
||||
cGameSettings(); |
||||
~cGameSettings(); |
||||
|
||||
public: |
||||
bool LoadConfigFile(std::string sFile); |
||||
|
||||
public: |
||||
static int nScreenWidth; |
||||
static int nScreenHeight; |
||||
static int nPixelWidth; |
||||
static int nPixelHeight; |
||||
static bool bFullScreen; |
||||
|
||||
static int nDefaultMapWidth; |
||||
static int nDefaultMapHeight; |
||||
static std::string sDefaultCityFile; |
||||
|
||||
static std::vector<sAssetTexture> vecAssetTextures; |
||||
static std::vector<sAssetModel> vecAssetBuildings; |
||||
static std::vector<sAssetModel> vecAssetVehicles; |
||||
}; |
||||
|
@ -0,0 +1,367 @@ |
||||
/*
|
||||
Top Down City Based Car Crime Game - Part #2 |
||||
"Colin, I hope you're shooting 600+ wherever you are buddy. RIP." - javidx9 |
||||
|
||||
License (OLC-3) |
||||
~~~~~~~~~~~~~~~ |
||||
|
||||
Copyright 2018-2019 OneLoneCoder.com |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions |
||||
are met: |
||||
|
||||
1. Redistributions or derivations of source code must retain the above |
||||
copyright notice, this list of conditions and the following disclaimer. |
||||
|
||||
2. Redistributions or derivative works in binary form must reproduce |
||||
the above copyright notice. This list of conditions and the following |
||||
disclaimer must be reproduced in the documentation and/or other |
||||
materials provided with the distribution. |
||||
|
||||
3. Neither the name of the copyright holder nor the names of its |
||||
contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"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 COPYRIGHT |
||||
HOLDER OR CONTRIBUTORS 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. |
||||
|
||||
Instructions: |
||||
~~~~~~~~~~~~~ |
||||
Scroll with middle mouse wheel, TAB toggle edit mode, R to place road |
||||
P to place pavement, Q to place building, Arrow keys to drive car |
||||
|
||||
Relevant Video: https://youtu.be/fIV6P1W-wuo
|
||||
|
||||
Links |
||||
~~~~~ |
||||
YouTube: https://www.youtube.com/javidx9
|
||||
https://www.youtube.com/javidx9extra
|
||||
Discord: https://discord.gg/WhwHUMV
|
||||
Twitter: https://www.twitter.com/javidx9
|
||||
Twitch: https://www.twitch.tv/javidx9
|
||||
GitHub: https://www.github.com/onelonecoder
|
||||
Patreon: https://www.patreon.com/javidx9
|
||||
Homepage: https://www.onelonecoder.com
|
||||
|
||||
Author |
||||
~~~~~~ |
||||
David Barr, aka javidx9, ©OneLoneCoder 2019 |
||||
*/ |
||||
|
||||
|
||||
#include "cGameSettings.h" |
||||
#include "cCarCrimeCity.h" |
||||
|
||||
|
||||
int main() |
||||
{ |
||||
// Load the settings singleton
|
||||
cGameSettings config; |
||||
if (!config.LoadConfigFile("assets/config.lua")) |
||||
{ |
||||
std::cout << "Failed to load '/assets/config.lua'" << std::endl; |
||||
std::cout << " -> Using default configuration" << std::endl; |
||||
} |
||||
|
||||
// Start the PixelGameEngine
|
||||
cCarCrimeCity game; |
||||
if (game.Construct(config.nScreenWidth, config.nScreenHeight, config.nPixelWidth, config.nPixelHeight, config.bFullScreen)) |
||||
game.Start(); |
||||
|
||||
// Exit!
|
||||
return 0; |
||||
} |
||||
|
||||
//#define OLC_PGE_APPLICATION
|
||||
//#include "olcPixelGameEngine.h"
|
||||
//
|
||||
//#define OLC_PGEX_GRAPHICS3D
|
||||
//#include "olcPGEX_Graphics3D.h"
|
||||
//
|
||||
//
|
||||
//
|
||||
//enum CELLTYPE
|
||||
//{
|
||||
// CELL_BLANK = 0,
|
||||
// CELL_GRASS = 1,
|
||||
// CELL_CONCRETE = 2,
|
||||
// CELL_WATER = 3,
|
||||
// CELL_BUILDING = 4,
|
||||
// CELL_ROAD_H = 5,
|
||||
// CELL_ROAD_V = 6,
|
||||
// CELL_ROAD_C1 = 7,
|
||||
// CELL_ROAD_C2 = 8,
|
||||
// CELL_ROAD_C3 = 9,
|
||||
// CELL_ROAD_C4 = 10,
|
||||
// CELL_ROAD_T1 = 11,
|
||||
// CELL_ROAD_T2 = 12,
|
||||
// CELL_ROAD_T3 = 13,
|
||||
// CELL_ROAD_T4 = 14,
|
||||
// CELL_ROAD_X = 15,
|
||||
//};
|
||||
//
|
||||
//struct cCityCell
|
||||
//{
|
||||
// int nType = 5;// CELL_GRASS;
|
||||
//};
|
||||
//
|
||||
//class cCityMap
|
||||
//{
|
||||
//public:
|
||||
// // Construct a "blank" city w units wide by h units high
|
||||
// cCityMap(int w, int h);
|
||||
//
|
||||
// // Cleans up city, like Batman
|
||||
// ~cCityMap();
|
||||
//
|
||||
//
|
||||
//public:
|
||||
// // Return width of city in cells
|
||||
// int GetWidth();
|
||||
// // Return height of city in cells
|
||||
// int GetHeight();
|
||||
// // Return a specific cell reference if inside city limits, or nullptr
|
||||
// cCityCell* Cell(int x, int y);
|
||||
//
|
||||
//private:
|
||||
// int m_nWidth = 0;
|
||||
// int m_nHeight = 0;
|
||||
// cCityCell *m_pCells = nullptr;
|
||||
//
|
||||
//private:
|
||||
// // Creates a "default" city of specified size
|
||||
// void CreateCity(int w, int h);
|
||||
// // Destroy city
|
||||
// void ReleaseCity();
|
||||
//};
|
||||
//
|
||||
//cCityMap::cCityMap(int w, int h)
|
||||
//{
|
||||
// CreateCity(w, h);
|
||||
//}
|
||||
//
|
||||
//cCityMap::~cCityMap()
|
||||
//{
|
||||
// //ReleaseCity();
|
||||
//}
|
||||
//
|
||||
//int cCityMap::GetWidth()
|
||||
//{
|
||||
// return m_nWidth;
|
||||
//}
|
||||
//
|
||||
//int cCityMap::GetHeight()
|
||||
//{
|
||||
// return m_nHeight;
|
||||
//}
|
||||
//
|
||||
//cCityCell* cCityMap::Cell(int x, int y)
|
||||
//{
|
||||
// if (x >= 0 && x < m_nWidth && y >= 0 && y < m_nHeight)
|
||||
// return &m_pCells[y*m_nWidth + x];
|
||||
// else
|
||||
// return nullptr;
|
||||
//}
|
||||
//
|
||||
//void cCityMap::CreateCity(int w, int h)
|
||||
//{
|
||||
// //ReleaseCity();
|
||||
// m_nWidth = w;
|
||||
// m_nHeight = h;
|
||||
// m_pCells = new cCityCell[m_nHeight * m_nWidth];
|
||||
//
|
||||
// for (int x = 0; x < m_nWidth; x++)
|
||||
// {
|
||||
// for (int y = 0; y < m_nHeight; y++)
|
||||
// {
|
||||
// //m_pCells[y*m_nWidth + x] = new cCityCell();
|
||||
// //Cell(x, y)->bRoad = false;
|
||||
// //Cell(x, y)->nHeight = 0;
|
||||
// //Cell(x, y)->nWorldX = x;
|
||||
// //Cell(x, y)->nWorldY = y;
|
||||
// Cell(x, y)->nType = CELL_GRASS;
|
||||
// //Cell(x, y)->bBuilding = false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void cCityMap::ReleaseCity()
|
||||
//{
|
||||
// if (m_pCells != nullptr) delete m_pCells;
|
||||
// m_nWidth = 0;
|
||||
// m_nHeight = 0;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//class cCarCrimeCity : public olc::PixelGameEngine
|
||||
//{
|
||||
//public:
|
||||
// cCarCrimeCity()
|
||||
// {
|
||||
// sAppName = "Car Crime City";
|
||||
// }
|
||||
//
|
||||
// ~cCarCrimeCity()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// bool OnUserCreate()
|
||||
// {
|
||||
// // Initialise PGEX 3D
|
||||
// olc::GFX3D::ConfigureDisplay();
|
||||
//
|
||||
// // Create Default city
|
||||
// pCity = new cCityMap(64, 32);// cGameSettings::nDefaultMapWidth, cGameSettings::nDefaultMapHeight);
|
||||
//
|
||||
//
|
||||
// // A simple flat unit quad
|
||||
// meshQuad.tris =
|
||||
// {
|
||||
// { 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, olc::RED },
|
||||
// { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, olc::RED},
|
||||
// };
|
||||
//
|
||||
//
|
||||
// sprOld = new olc::Sprite("assets/system/grass1.png");
|
||||
//
|
||||
//
|
||||
//
|
||||
// SetDrawTarget(nullptr);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// bool OnUserUpdate(float fElapsedTime)
|
||||
// {
|
||||
// // User Input
|
||||
// if (GetKey(olc::Key::W).bHeld) vCamera.y -= 2.0f * fElapsedTime;
|
||||
// if (GetKey(olc::Key::S).bHeld) vCamera.y += 2.0f * fElapsedTime;
|
||||
// if (GetKey(olc::Key::A).bHeld) vCamera.x -= 2.0f * fElapsedTime;
|
||||
// if (GetKey(olc::Key::D).bHeld) vCamera.x += 2.0f * fElapsedTime;
|
||||
// if (GetKey(olc::Key::Z).bHeld) vCamera.z += 10.0f * fElapsedTime;
|
||||
// if (GetKey(olc::Key::X).bHeld) vCamera.z -= 10.0f * fElapsedTime;
|
||||
//
|
||||
//
|
||||
// vEye = vCamera;
|
||||
//
|
||||
// // Perform Ray casting to calculate visible world extents and mouse position
|
||||
// olc::GFX3D::vec3d vLookTarget = olc::GFX3D::Math::Vec_Add(vEye, vLookDir);
|
||||
// olc::GFX3D::mat4x4 matProj = olc::GFX3D::Math::Mat_MakeProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.5f, 1000.0f);
|
||||
// olc::GFX3D::mat4x4 matView = olc::GFX3D::Math::Mat_PointAt(vEye, vLookTarget, vUp);
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Render Scene
|
||||
// Clear(olc::BLUE);
|
||||
// olc::GFX3D::ClearDepth();
|
||||
//
|
||||
// // Create rendering pipeline
|
||||
// olc::GFX3D::PipeLine pipe;
|
||||
// pipe.SetProjection(90.0f, (float)ScreenHeight() / (float)ScreenWidth(), 0.5f, 1000.0f, 0.0f, 0.0f, (float)ScreenWidth(), (float)ScreenHeight());
|
||||
// pipe.SetCamera(vEye, vLookTarget, vUp);
|
||||
//
|
||||
//
|
||||
//
|
||||
// int nStartX = 0;
|
||||
// int nEndX = pCity->GetWidth();
|
||||
// int nStartY = 0;
|
||||
// int nEndY = pCity->GetHeight();
|
||||
//
|
||||
// // Render Ground, Roads, Walls & Buildings
|
||||
// for (int x = nStartX; x < nEndX; x++)
|
||||
// {
|
||||
// if (x == 15)
|
||||
// int k = 7;
|
||||
//
|
||||
// for (int y = nStartY; y < nEndY; y++)
|
||||
// {
|
||||
//
|
||||
//
|
||||
// switch (pCity->Cell(x, y)->nType)
|
||||
// {
|
||||
// case CELL_GRASS:
|
||||
// {
|
||||
// olc::GFX3D::mat4x4 matWorld;
|
||||
// matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)x, (float)y, 0.0f);
|
||||
// pipe.SetTransform(matWorld);
|
||||
// pipe.SetTexture(sprOld);
|
||||
// //pipe.SetTexture(vecSpriteSystem[0]);
|
||||
// //pipe.Render(vecMeshSystem[0].tris);
|
||||
// pipe.Render(meshQuad.tris);
|
||||
// //pipe.Render(vecMeshSystem[0].tris, olc::GFX3D::RENDER_FLAT);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// default:
|
||||
// {
|
||||
// olc::GFX3D::mat4x4 matWorld;
|
||||
// matWorld = olc::GFX3D::Math::Mat_MakeTranslation((float)x, (float)y, 0.0f);
|
||||
// pipe.SetTransform(matWorld);
|
||||
// pipe.Render(meshQuad.tris, olc::GFX3D::RENDER_WIRE);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool OnUserDestroy()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//private:
|
||||
// olc::GFX3D::vec3d vCamera = { 0.0f, 0.0f, -10.0f };
|
||||
// olc::GFX3D::vec3d vUp = { 0.0f, 1.0f, 0.0f };
|
||||
// olc::GFX3D::vec3d vEye = { 0.0f, 0.0f, -10.0f };
|
||||
// olc::GFX3D::vec3d vLookDir = { 0.0f, 0.0f, 1.0f };
|
||||
//
|
||||
//
|
||||
//
|
||||
// olc::Sprite *sprOld = nullptr;
|
||||
// olc::GFX3D::mesh meshQuad;
|
||||
//
|
||||
// cCityMap *pCity = nullptr;
|
||||
//
|
||||
//
|
||||
//
|
||||
//};
|
||||
//
|
||||
//int main()
|
||||
//{
|
||||
// // Load the settings singleton
|
||||
// /*cGameSettings config;
|
||||
// if (!config.LoadConfigFile("assets/config.lua"))
|
||||
// {
|
||||
// std::cout << "Failed to load '/assets/config.lua'" << std::endl;
|
||||
// std::cout << " -> Using default configuration" << std::endl;
|
||||
// }*/
|
||||
//
|
||||
// // Start the PixelGameEngine
|
||||
// cCarCrimeCity game;
|
||||
// if (game.Construct(256, 240, 4, 4))// config.nScreenWidth, config.nScreenHeight, config.nPixelWidth, config.nPixelHeight))
|
||||
// game.Start();
|
||||
//
|
||||
// // Exit!
|
||||
// return 0;
|
||||
//}
|
@ -0,0 +1,5 @@ |
||||
#define OLC_PGE_APPLICATION |
||||
#include "olcPixelGameEngine.h" |
||||
|
||||
#define OLC_PGEX_GRAPHICS3D |
||||
#include "olcPGEX_Graphics3D.h" |