33 #define SUBDIVIDE_SIZE 64
41 mins[0] = mins[1] = mins[2] = 9999;
42 maxs[0] = maxs[1] = maxs[2] = -9999;
44 for (
i=0 ;
i<numverts ;
i++)
45 for (
j=0 ;
j<3 ;
j++,
v++)
60 vec3_t front[64], back[64];
67 float total_s, total_t;
76 m = (mins[
i] + maxs[
i]) * 0.5;
85 for (
j=0 ;
j<numverts ;
j++,
v+= 3)
95 for (
j=0 ;
j<numverts ;
j++,
v+= 3)
107 if (dist[
j] == 0 || dist[
j+1] == 0)
109 if ( (dist[
j] > 0) != (dist[
j+1] > 0) )
112 frac = dist[
j] / (dist[
j] - dist[
j+1]);
113 for (k=0 ; k<3 ; k++)
114 front[f][k] = back[b][k] =
v[k] + frac*(
v[3+k] -
v[k]);
133 for (
i=0 ;
i<numverts ;
i++, verts+= 3)
148 poly->
verts[0][3] = total_s/numverts;
149 poly->
verts[0][4] = total_t/numverts;
220 polyUbo.color[0] = color[0];
221 polyUbo.color[1] = color[1];
222 polyUbo.color[2] = color[2];
223 polyUbo.color[3] = color[3];
235 memcpy(polyUbo.model, modelMatrix,
sizeof(
float) * 16);
245 VkDescriptorSet uboDescriptorSet;
247 memcpy(uboData, &polyUbo,
sizeof(polyUbo));
250 VkDeviceSize vboOffset;
251 VkDescriptorSet descriptorSets[] = {
texture->vk_texture.descriptorSet, uboDescriptorSet };
260 verts[
i].vertex[0] =
v[0];
261 verts[
i].vertex[1] =
v[1];
262 verts[
i].vertex[2] =
v[2];
263 verts[
i].texCoord[0] =
v[3] / 64.f;
264 verts[
i].texCoord[1] =
v[4] / 64.f;
268 memcpy(vertData, verts,
sizeof(polyvert) * p->
numverts);
337 for (
i=0, vp=vecs ;
i<nump ;
i++, vp+=3)
344 if (av[0] > av[1] && av[0] > av[2])
351 else if (av[1] > av[2] && av[1] > av[0])
367 for (
i=0 ;
i<nump ;
i++, vecs+=3)
378 s = -vecs[-
j -1] /
dv;
383 t = -vecs[-
j -1] /
dv;
398 #define ON_EPSILON 0.1 // point on plane side epsilon
399 #define MAX_CLIP_VERTS 64
420 front = back =
false;
422 for (
i=0,
v = vecs ;
i<nump ;
i++,
v+=3)
450 newc[0] = newc[1] = 0;
452 for (
i=0,
v = vecs ;
i<nump ;
i++,
v+=3)
475 d = dists[
i] / (dists[
i] - dists[
i+1]);
476 for (
j=0 ;
j<3 ;
j++)
478 e =
v[
j] + d*(
v[
j+3] -
v[
j]);
479 newv[0][newc[0]][
j] = e;
480 newv[1][newc[1]][
j] = e;
523 for (
i=0 ;
i<6 ;
i++)
540 for (
j = 0;
j<3;
j++)
564 vertexData[0] =
v[0];
565 vertexData[1] =
v[1];
566 vertexData[2] =
v[2];
583 for (
i = 0;
i<6;
i++)
602 VkDescriptorSet uboDescriptorSet;
604 memcpy(uboData, model,
sizeof(model));
606 for (
i = 0;
i<6;
i++)
626 skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
627 skyVerts[1].data[0], skyVerts[1].data[1], skyVerts[1].data[2], skyVerts[1].data[3], skyVerts[1].data[4],
628 skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
629 skyVerts[0].data[0], skyVerts[0].data[1], skyVerts[0].data[2], skyVerts[0].data[3], skyVerts[0].data[4],
630 skyVerts[2].data[0], skyVerts[2].data[1], skyVerts[2].data[2], skyVerts[2].data[3], skyVerts[2].data[4],
631 skyVerts[3].data[0], skyVerts[3].data[1], skyVerts[3].data[2], skyVerts[3].data[3], skyVerts[3].data[4]
635 VkDeviceSize vboOffset;
637 memcpy(vertData, verts,
sizeof(verts));
653 char *
suf[6] = {
"rt",
"bk",
"lf",
"ft",
"up",
"dn"};
663 for (
i = 0;
i<6;
i++)