use va() for events
parent
36c7a81884
commit
3e1e170e16
|
@ -31,6 +31,7 @@ int main(int argc, char** argv) {
|
||||||
bool must_reload = 0;
|
bool must_reload = 0;
|
||||||
|
|
||||||
while( window_swap()) {
|
while( window_swap()) {
|
||||||
|
if (input_down(KEY_ESC)) break;
|
||||||
// reloading
|
// reloading
|
||||||
if( must_reload ) {
|
if( must_reload ) {
|
||||||
must_reload = 0;
|
must_reload = 0;
|
||||||
|
@ -42,7 +43,7 @@ int main(int argc, char** argv) {
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
sky = skybox(SKY_DIRS[SKY_DIR], 0);
|
sky = skybox(SKY_DIRS[SKY_DIR], 0);
|
||||||
mdl = model(OBJ_MDLS[OBJ_MDL], 0);
|
mdl = model(OBJ_MDLS[OBJ_MDL], 0);
|
||||||
rotation44(mdl.pivot, 0, 1,0,0); // @fixme: -90,1,0,0 -> should we rotate SHMs as well? compensate rotation in shader?
|
// rotation44(mdl.pivot, 0, 1,0,0); // @fixme: -90,1,0,0 -> should we rotate SHMs as well? compensate rotation in shader?
|
||||||
}
|
}
|
||||||
|
|
||||||
// fps camera
|
// fps camera
|
||||||
|
@ -58,20 +59,14 @@ int main(int argc, char** argv) {
|
||||||
// render
|
// render
|
||||||
mat44 mvp; multiply44x2(mvp, cam.proj, cam.view);
|
mat44 mvp; multiply44x2(mvp, cam.proj, cam.view);
|
||||||
{
|
{
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
skybox_render(&sky, cam.proj, cam.view);
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glDepthFunc(GL_LEQUAL);
|
shader_bind(mdl.program);
|
||||||
//glDisable(GL_CULL_FACE);
|
shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh);
|
||||||
|
shader_int("u_textured", false);
|
||||||
|
|
||||||
// mesh
|
|
||||||
glDepthMask(GL_TRUE);
|
|
||||||
glUseProgram(mdl.program);
|
|
||||||
glUniform3fv(glGetUniformLocation(mdl.program, "u_coefficients_sh"), 9, &sky.cubemap.sh[0].x);
|
|
||||||
glUniform1i(glGetUniformLocation(mdl.program, "u_textured"), false);
|
|
||||||
model_render(mdl, cam.proj, cam.view, mdl.pivot, 0);
|
model_render(mdl, cam.proj, cam.view, mdl.pivot, 0);
|
||||||
|
|
||||||
// sky
|
|
||||||
skybox_render(&sky, cam.proj, cam.view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ui_panel("Scene", 0)) {
|
if( ui_panel("Scene", 0)) {
|
||||||
|
|
|
@ -15,10 +15,9 @@ struct world_t {
|
||||||
struct npc_t npc[MAX_NPCS];
|
struct npc_t npc[MAX_NPCS];
|
||||||
} world = {0};
|
} world = {0};
|
||||||
|
|
||||||
char *show_notification(char *msg) {
|
void show_notification(char *msg) {
|
||||||
printf("notif %s\n", msg);
|
printf("notif %s\n", msg);
|
||||||
ui_notify("server", msg);
|
ui_notify("server", msg);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind_netbuffers(int64_t self_id) {
|
void bind_netbuffers(int64_t self_id) {
|
||||||
|
@ -39,7 +38,7 @@ void bind_netbuffers(int64_t self_id) {
|
||||||
|
|
||||||
// register server->client rpc
|
// register server->client rpc
|
||||||
if (self_id > 0) {
|
if (self_id > 0) {
|
||||||
network_rpc("char* show_notification(char*)", show_notification);
|
network_rpc("void show_notification(char*)", show_notification);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1174,6 +1174,9 @@ ffi.cdef([[
|
||||||
//lcpp INF [0000] vec3: macro name but used as C declaration in:API void shader_vec3(const char *uniform, vec3 v);
|
//lcpp INF [0000] vec3: macro name but used as C declaration in:API void shader_vec3(const char *uniform, vec3 v);
|
||||||
//lcpp INF [0000] vec3: macro name but used as C declaration in:STATIC void shader_vec3(const char *uniform, vec3 v);
|
//lcpp INF [0000] vec3: macro name but used as C declaration in:STATIC void shader_vec3(const char *uniform, vec3 v);
|
||||||
//lcpp INF [0000] vec3: macro name but used as C declaration in: void shader_vec3(const char *uniform, vec3 v);
|
//lcpp INF [0000] vec3: macro name but used as C declaration in: void shader_vec3(const char *uniform, vec3 v);
|
||||||
|
//lcpp INF [0000] vec3: macro name but used as C declaration in:API void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
|
//lcpp INF [0000] vec3: macro name but used as C declaration in:STATIC void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
|
//lcpp INF [0000] vec3: macro name but used as C declaration in: void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
//lcpp INF [0000] vec4: macro name but used as C declaration in:API void shader_vec4(const char *uniform, vec4 v);
|
//lcpp INF [0000] vec4: macro name but used as C declaration in:API void shader_vec4(const char *uniform, vec4 v);
|
||||||
//lcpp INF [0000] vec4: macro name but used as C declaration in:STATIC void shader_vec4(const char *uniform, vec4 v);
|
//lcpp INF [0000] vec4: macro name but used as C declaration in:STATIC void shader_vec4(const char *uniform, vec4 v);
|
||||||
//lcpp INF [0000] vec4: macro name but used as C declaration in: void shader_vec4(const char *uniform, vec4 v);
|
//lcpp INF [0000] vec4: macro name but used as C declaration in: void shader_vec4(const char *uniform, vec4 v);
|
||||||
|
@ -2347,6 +2350,7 @@ int texture_width;
|
||||||
void shader_float(const char *uniform, float f);
|
void shader_float(const char *uniform, float f);
|
||||||
void shader_vec2(const char *uniform, vec2 v);
|
void shader_vec2(const char *uniform, vec2 v);
|
||||||
void shader_vec3(const char *uniform, vec3 v);
|
void shader_vec3(const char *uniform, vec3 v);
|
||||||
|
void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
void shader_vec4(const char *uniform, vec4 v);
|
void shader_vec4(const char *uniform, vec4 v);
|
||||||
void shader_mat44(const char *uniform, mat44 m);
|
void shader_mat44(const char *uniform, mat44 m);
|
||||||
void shader_texture(const char *sampler, texture_t texture);
|
void shader_texture(const char *sampler, texture_t texture);
|
||||||
|
|
|
@ -16472,6 +16472,7 @@ API void shader_uint(const char *uniform, unsigned i );
|
||||||
API void shader_float(const char *uniform, float f);
|
API void shader_float(const char *uniform, float f);
|
||||||
API void shader_vec2(const char *uniform, vec2 v);
|
API void shader_vec2(const char *uniform, vec2 v);
|
||||||
API void shader_vec3(const char *uniform, vec3 v);
|
API void shader_vec3(const char *uniform, vec3 v);
|
||||||
|
API void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
API void shader_vec4(const char *uniform, vec4 v);
|
API void shader_vec4(const char *uniform, vec4 v);
|
||||||
API void shader_mat44(const char *uniform, mat44 m);
|
API void shader_mat44(const char *uniform, mat44 m);
|
||||||
API void shader_texture(const char *sampler, texture_t texture);
|
API void shader_texture(const char *sampler, texture_t texture);
|
||||||
|
@ -338905,13 +338906,13 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_CONNECT:;
|
case ENET_EVENT_TYPE_CONNECT:;
|
||||||
msg = stringf( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
msg = va( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
||||||
/* Store any relevant client information here. */
|
/* Store any relevant client information here. */
|
||||||
event.peer->data = STRDUP(ip); /* TEMP */
|
event.peer->data = STRDUP(ip); /* TEMP */
|
||||||
|
|
||||||
/* ensure we have free slot for client */
|
/* ensure we have free slot for client */
|
||||||
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
||||||
msg = stringf("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
msg = va("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
||||||
enet_peer_disconnect_now(event.peer, 1);
|
enet_peer_disconnect_now(event.peer, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -338943,7 +338944,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:;
|
case ENET_EVENT_TYPE_RECEIVE:;
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -339008,12 +339009,12 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -339024,7 +339025,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -339033,7 +339034,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
server_drop_client_peer(event.peer);
|
server_drop_client_peer(event.peer);
|
||||||
|
@ -339041,7 +339042,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
@ -339068,7 +339069,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -339118,12 +339119,12 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -339134,7 +339135,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -339143,7 +339144,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
network_put(NETWORK_RANK, -1);
|
network_put(NETWORK_RANK, -1);
|
||||||
|
@ -339151,7 +339152,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
@ -339483,10 +339484,9 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" vec3 result = vec3(0.0);\n"
|
" vec3 result = vec3(0.0);\n"
|
||||||
" for (int i = 0; i < 9; ++i)\n"
|
" for (int i = 0; i < 9; ++i)\n"
|
||||||
" result += SHLightResult[i];\n"
|
" result += SHLightResult[i];\n"
|
||||||
|
" \n"
|
||||||
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\n"
|
|
||||||
"\n"
|
|
||||||
" // base\n"
|
" // base\n"
|
||||||
" vec4 diffuse;\n"
|
" vec4 diffuse;\n"
|
||||||
" if(u_matcaps) {\n"
|
" if(u_matcaps) {\n"
|
||||||
|
@ -339510,8 +339510,8 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
||||||
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
||||||
#endif
|
#endif
|
||||||
" \n"
|
"}\n"
|
||||||
" }\n";
|
"\n";
|
||||||
|
|
||||||
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
||||||
"uniform sampler2D fsDiffTex;\n"
|
"uniform sampler2D fsDiffTex;\n"
|
||||||
|
@ -340110,6 +340110,7 @@ void shader_int(const char *uniform, int i) { glUniform1i(shader_uniform(uni
|
||||||
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
||||||
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
|
void shader_vec3v(const char *uniform, int count, vec3 *v) { glUniform3fv(shader_uniform(uniform), count, &v[0].x); }
|
||||||
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
||||||
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
||||||
|
|
|
@ -40,10 +40,9 @@ SHLightResult[8] = 0.546274f * u_coefficients_sh[8] * (n.x * n.x - n.y * n.y);
|
||||||
vec3 result = vec3(0.0);
|
vec3 result = vec3(0.0);
|
||||||
for (int i = 0; i < 9; ++i)
|
for (int i = 0; i < 9; ++i)
|
||||||
result += SHLightResult[i];
|
result += SHLightResult[i];
|
||||||
|
|
||||||
if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);
|
if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// base
|
// base
|
||||||
vec4 diffuse;
|
vec4 diffuse;
|
||||||
if(u_matcaps) {
|
if(u_matcaps) {
|
||||||
|
@ -67,5 +66,4 @@ if(u_matcaps) {
|
||||||
rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)
|
rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)
|
||||||
fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue
|
fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
|
@ -442,13 +442,13 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_CONNECT:;
|
case ENET_EVENT_TYPE_CONNECT:;
|
||||||
msg = stringf( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
msg = va( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
||||||
/* Store any relevant client information here. */
|
/* Store any relevant client information here. */
|
||||||
event.peer->data = STRDUP(ip); /* TEMP */
|
event.peer->data = STRDUP(ip); /* TEMP */
|
||||||
|
|
||||||
/* ensure we have free slot for client */
|
/* ensure we have free slot for client */
|
||||||
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
||||||
msg = stringf("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
msg = va("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
||||||
enet_peer_disconnect_now(event.peer, 1);
|
enet_peer_disconnect_now(event.peer, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:;
|
case ENET_EVENT_TYPE_RECEIVE:;
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -545,12 +545,12 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -561,7 +561,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -570,7 +570,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
server_drop_client_peer(event.peer);
|
server_drop_client_peer(event.peer);
|
||||||
|
@ -578,7 +578,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
@ -605,7 +605,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -655,12 +655,12 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -671,7 +671,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -680,7 +680,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
network_put(NETWORK_RANK, -1);
|
network_put(NETWORK_RANK, -1);
|
||||||
|
@ -688,7 +688,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
|
|
@ -213,6 +213,7 @@ void shader_int(const char *uniform, int i) { glUniform1i(shader_uniform(uni
|
||||||
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
||||||
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
|
void shader_vec3v(const char *uniform, int count, vec3 *v) { glUniform3fv(shader_uniform(uniform), count, &v[0].x); }
|
||||||
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
||||||
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
||||||
|
|
|
@ -317,6 +317,7 @@ API void shader_uint(const char *uniform, unsigned i );
|
||||||
API void shader_float(const char *uniform, float f);
|
API void shader_float(const char *uniform, float f);
|
||||||
API void shader_vec2(const char *uniform, vec2 v);
|
API void shader_vec2(const char *uniform, vec2 v);
|
||||||
API void shader_vec3(const char *uniform, vec3 v);
|
API void shader_vec3(const char *uniform, vec3 v);
|
||||||
|
API void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
API void shader_vec4(const char *uniform, vec4 v);
|
API void shader_vec4(const char *uniform, vec4 v);
|
||||||
API void shader_mat44(const char *uniform, mat44 m);
|
API void shader_mat44(const char *uniform, mat44 m);
|
||||||
API void shader_texture(const char *sampler, texture_t texture);
|
API void shader_texture(const char *sampler, texture_t texture);
|
||||||
|
|
|
@ -286,10 +286,9 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" vec3 result = vec3(0.0);\n"
|
" vec3 result = vec3(0.0);\n"
|
||||||
" for (int i = 0; i < 9; ++i)\n"
|
" for (int i = 0; i < 9; ++i)\n"
|
||||||
" result += SHLightResult[i];\n"
|
" result += SHLightResult[i];\n"
|
||||||
|
" \n"
|
||||||
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\n"
|
|
||||||
"\n"
|
|
||||||
" // base\n"
|
" // base\n"
|
||||||
" vec4 diffuse;\n"
|
" vec4 diffuse;\n"
|
||||||
" if(u_matcaps) {\n"
|
" if(u_matcaps) {\n"
|
||||||
|
@ -313,8 +312,8 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
||||||
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
||||||
#endif
|
#endif
|
||||||
" \n"
|
"}\n"
|
||||||
" }\n";
|
"\n";
|
||||||
|
|
||||||
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
||||||
"uniform sampler2D fsDiffTex;\n"
|
"uniform sampler2D fsDiffTex;\n"
|
||||||
|
|
36
engine/v4k.c
36
engine/v4k.c
|
@ -9919,13 +9919,13 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_CONNECT:;
|
case ENET_EVENT_TYPE_CONNECT:;
|
||||||
msg = stringf( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
msg = va( "%d %s", 0, va("A new client connected from ::%s:%u", ip, event.peer->address.port ));
|
||||||
/* Store any relevant client information here. */
|
/* Store any relevant client information here. */
|
||||||
event.peer->data = STRDUP(ip); /* TEMP */
|
event.peer->data = STRDUP(ip); /* TEMP */
|
||||||
|
|
||||||
/* ensure we have free slot for client */
|
/* ensure we have free slot for client */
|
||||||
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
if (map_count(clients) >= network_get(NETWORK_CAPACITY)-1) {
|
||||||
msg = stringf("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
msg = va("%d %s", 1, va("%s", "Server is at maximum capacity, disconnecting the peer (::%s:%u)...", ip, event.peer->address.port));
|
||||||
enet_peer_disconnect_now(event.peer, 1);
|
enet_peer_disconnect_now(event.peer, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -9957,7 +9957,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:;
|
case ENET_EVENT_TYPE_RECEIVE:;
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -10022,12 +10022,12 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -10038,7 +10038,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -10047,7 +10047,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
server_drop_client_peer(event.peer);
|
server_drop_client_peer(event.peer);
|
||||||
|
@ -10055,7 +10055,7 @@ char** server_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
@ -10082,7 +10082,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_RECEIVE:
|
case ENET_EVENT_TYPE_RECEIVE:
|
||||||
/*
|
/*
|
||||||
msg = stringf( "A packet of length %u containing %s was received from %s on channel %u",
|
msg = va( "A packet of length %u containing %s was received from %s on channel %u",
|
||||||
(unsigned)event.packet->dataLength,
|
(unsigned)event.packet->dataLength,
|
||||||
event.packet->data,
|
event.packet->data,
|
||||||
(char *)event.peer->data,
|
(char *)event.peer->data,
|
||||||
|
@ -10132,12 +10132,12 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
memcpy(&resp_msg[4], resp, strlen(resp)+1);
|
||||||
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
ENetPacket *packet = enet_packet_create(resp_msg, strlen(resp) + 5, ENET_PACKET_FLAG_RELIABLE);
|
||||||
enet_peer_send(event.peer, 0, packet);
|
enet_peer_send(event.peer, 0, packet);
|
||||||
msg = stringf("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
msg = va("%d %s", 0, va("req:%s res:%s", cmdline, resp));
|
||||||
FREE(resp_msg);
|
FREE(resp_msg);
|
||||||
} break;
|
} break;
|
||||||
case MSG_RPC_RESP: {
|
case MSG_RPC_RESP: {
|
||||||
event.type = NETWORK_EVENT_RPC_RESP;
|
event.type = NETWORK_EVENT_RPC_RESP;
|
||||||
msg = stringf("%d %s", 0, va("%s", ptr));
|
msg = va("%d %s", 0, va("%s", ptr));
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
// PRINTF("!Receiving unk %d sz %d from peer ::%s:%u\n", mid, sz, ip, event.peer->address.port);
|
||||||
|
@ -10148,7 +10148,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT:
|
case ENET_EVENT_TYPE_DISCONNECT:
|
||||||
msg = stringf( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s disconnected", (char *)event.peer->data));
|
||||||
/* Reset the peer's client information. */
|
/* Reset the peer's client information. */
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
|
@ -10157,7 +10157,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
|
||||||
msg = stringf( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
msg = va( "%d %s", 0, va("%s timeout", (char *)event.peer->data));
|
||||||
FREE(event.peer->data);
|
FREE(event.peer->data);
|
||||||
event.peer->data = NULL;
|
event.peer->data = NULL;
|
||||||
network_put(NETWORK_RANK, -1);
|
network_put(NETWORK_RANK, -1);
|
||||||
|
@ -10165,7 +10165,7 @@ char** client_poll(unsigned timeout_ms) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg) array_push(events, stringf("%d %s", enet_event_to_netsync(event.type), msg));
|
if(msg) array_push(events, va("%d %s", enet_event_to_netsync(event.type), msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push(events, NULL);
|
array_push(events, NULL);
|
||||||
|
@ -10497,10 +10497,9 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" vec3 result = vec3(0.0);\n"
|
" vec3 result = vec3(0.0);\n"
|
||||||
" for (int i = 0; i < 9; ++i)\n"
|
" for (int i = 0; i < 9; ++i)\n"
|
||||||
" result += SHLightResult[i];\n"
|
" result += SHLightResult[i];\n"
|
||||||
|
" \n"
|
||||||
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
" if( (result.x*result.x+result.y*result.y+result.z*result.z) > 0.0 ) lit = vec4(result, 1.0);\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\n"
|
|
||||||
"\n"
|
|
||||||
" // base\n"
|
" // base\n"
|
||||||
" vec4 diffuse;\n"
|
" vec4 diffuse;\n"
|
||||||
" if(u_matcaps) {\n"
|
" if(u_matcaps) {\n"
|
||||||
|
@ -10524,8 +10523,8 @@ const char *const fs_32_4_model = "//" FILELINE "\n"
|
||||||
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
" rim = smoothstep(1.0-0.01, 1.0, rim); // intensity (0.01)\n"
|
||||||
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
" fragcolor += vec4(0.0, 0.0, rim, 1.0);} // blue\n"
|
||||||
#endif
|
#endif
|
||||||
" \n"
|
"}\n"
|
||||||
" }\n";
|
"\n";
|
||||||
|
|
||||||
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
const char *const fs_32_4_model_basic = "//" FILELINE "\n"
|
||||||
"uniform sampler2D fsDiffTex;\n"
|
"uniform sampler2D fsDiffTex;\n"
|
||||||
|
@ -11124,6 +11123,7 @@ void shader_int(const char *uniform, int i) { glUniform1i(shader_uniform(uni
|
||||||
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
void shader_float(const char *uniform, float f) { glUniform1f(shader_uniform(uniform), f); }
|
||||||
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec2(const char *uniform, vec2 v) { glUniform2fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec3(const char *uniform, vec3 v) { glUniform3fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
|
void shader_vec3v(const char *uniform, int count, vec3 *v) { glUniform3fv(shader_uniform(uniform), count, &v[0].x); }
|
||||||
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
void shader_vec4(const char *uniform, vec4 v) { glUniform4fv(shader_uniform(uniform), 1, &v.x); }
|
||||||
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
void shader_mat44(const char *uniform, mat44 m) { glUniformMatrix4fv(shader_uniform(uniform), 1, GL_FALSE/*GL_TRUE*/, m); }
|
||||||
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
void shader_cubemap(const char *sampler, unsigned texture) { glUniform1i(shader_uniform(sampler), 0); glBindTexture(GL_TEXTURE_CUBE_MAP, texture); }
|
||||||
|
|
|
@ -2555,6 +2555,7 @@ API void shader_uint(const char *uniform, unsigned i );
|
||||||
API void shader_float(const char *uniform, float f);
|
API void shader_float(const char *uniform, float f);
|
||||||
API void shader_vec2(const char *uniform, vec2 v);
|
API void shader_vec2(const char *uniform, vec2 v);
|
||||||
API void shader_vec3(const char *uniform, vec3 v);
|
API void shader_vec3(const char *uniform, vec3 v);
|
||||||
|
API void shader_vec3v(const char *uniform, int count, vec3 *v);
|
||||||
API void shader_vec4(const char *uniform, vec4 v);
|
API void shader_vec4(const char *uniform, vec4 v);
|
||||||
API void shader_mat44(const char *uniform, mat44 m);
|
API void shader_mat44(const char *uniform, mat44 m);
|
||||||
API void shader_texture(const char *sampler, texture_t texture);
|
API void shader_texture(const char *sampler, texture_t texture);
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue