33 #define NUMVERTEXNORMALS 162
47 #define SHADEDOT_QUANT 16
72 for (
i=0 ;
i < nverts;
i++,
v++, ov++, lerp+=4 )
76 lerp[0] = move[0] + ov->v[0]*backv[0] +
v->v[0]*frontv[0] + normal[0] *
POWERSUIT_SCALE;
77 lerp[1] = move[1] + ov->v[1]*backv[1] +
v->v[1]*frontv[1] + normal[1] *
POWERSUIT_SCALE;
78 lerp[2] = move[2] + ov->v[2]*backv[2] +
v->v[2]*frontv[2] + normal[2] *
POWERSUIT_SCALE;
83 for (
i=0 ;
i < nverts;
i++,
v++, ov++, lerp+=4)
85 lerp[0] = move[0] + ov->v[0]*backv[0] +
v->v[0]*frontv[0];
86 lerp[1] = move[1] + ov->v[1]*backv[1] +
v->v[1]*frontv[1];
87 lerp[2] = move[2] + ov->v[2]*backv[2] +
v->v[2]*frontv[2];
110 vec3_t move, delta, vectors[3];
122 ov = oldframe->
verts;
131 frontlerp = 1.0 - backlerp;
143 for (
i=0 ;
i<3 ;
i++)
145 move[
i] = backlerp*move[
i] + frontlerp*frame->
translate[
i];
148 for (
i=0 ;
i<3 ;
i++)
150 frontv[
i] = frontlerp*frame->
scale[
i];
151 backv[
i] = backlerp*oldframe->
scale[
i];
169 int vertCounts[2] = { 0, 0 };
171 int pipeCounters[2] = { 0, 0 };
172 VkDeviceSize maxTriangleFanIdxCnt = 0;
179 drawInfo[0][0].firstVertex = 0;
180 drawInfo[1][0].firstVertex = 0;
196 pipelineIdx = TRIANGLE_FAN;
200 pipelineIdx = TRIANGLE_STRIP;
203 drawInfo[pipelineIdx][pipeCounters[pipelineIdx]].vertexCount =
count;
204 maxTriangleFanIdxCnt =
max(maxTriangleFanIdxCnt, ((
count - 2) * 3));
208 meshUbo.textured = 0;
211 int vertIdx = vertCounts[pipelineIdx];
213 vertList[pipelineIdx][vertIdx].texCoord[0] = 0.f;
214 vertList[pipelineIdx][vertIdx].texCoord[1] = 0.f;
215 index_xyz =
order[2];
218 vertList[pipelineIdx][vertIdx].color[0] =
shadelight[0];
219 vertList[pipelineIdx][vertIdx].color[1] =
shadelight[1];
220 vertList[pipelineIdx][vertIdx].color[2] =
shadelight[2];
221 vertList[pipelineIdx][vertIdx].color[3] =
alpha;
223 vertList[pipelineIdx][vertIdx].vertex[0] =
s_lerped[index_xyz][0];
224 vertList[pipelineIdx][vertIdx].vertex[1] =
s_lerped[index_xyz][1];
225 vertList[pipelineIdx][vertIdx].vertex[2] =
s_lerped[index_xyz][2];
226 vertCounts[pipelineIdx]++;
231 meshUbo.textured = 1;
234 int vertIdx = vertCounts[pipelineIdx];
236 vertList[pipelineIdx][vertIdx].texCoord[0] = ((
float *)
order)[0];
237 vertList[pipelineIdx][vertIdx].texCoord[1] = ((
float *)
order)[1];
238 index_xyz =
order[2];
244 vertList[pipelineIdx][vertIdx].color[0] = l *
shadelight[0];
245 vertList[pipelineIdx][vertIdx].color[1] = l *
shadelight[1];
246 vertList[pipelineIdx][vertIdx].color[2] = l *
shadelight[2];
247 vertList[pipelineIdx][vertIdx].color[3] =
alpha;
249 vertList[pipelineIdx][vertIdx].vertex[0] =
s_lerped[index_xyz][0];
250 vertList[pipelineIdx][vertIdx].vertex[1] =
s_lerped[index_xyz][1];
251 vertList[pipelineIdx][vertIdx].vertex[2] =
s_lerped[index_xyz][2];
252 vertCounts[pipelineIdx]++;
256 pipeCounters[pipelineIdx]++;
257 drawInfo[pipelineIdx][pipeCounters[pipelineIdx]].firstVertex = vertCounts[pipelineIdx];
261 VkDescriptorSet uboDescriptorSet;
263 memcpy(meshUbo.model, modelMatrix,
sizeof(
float) * 16);
264 memcpy(uboData, &meshUbo,
sizeof(meshUbo));
271 for (
int p = 0; p < 2; p++)
273 VkDeviceSize vaoSize =
sizeof(modelvert) * vertCounts[p];
275 VkDeviceSize vboOffset;
277 memcpy(vertData, vertList[p], vaoSize);
280 VkDescriptorSet descriptorSets[] = {
skin->vk_texture.descriptorSet, uboDescriptorSet };
281 vkCmdBindDescriptorSets(
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines[translucentIdx][p + leftHandOffset].layout, 0, 2, descriptorSets, 1, &uboOffset);
284 if (p == TRIANGLE_STRIP)
286 for (
i = 0;
i < pipeCounters[p];
i++)
295 for (
i = 0;
i < pipeCounters[p];
i++)
297 vkCmdDrawIndexed(
vk_activeCmdbuffer, (drawInfo[p][
i].vertexCount - 2) * 3, 1, 0, drawInfo[p][
i].firstVertex, 0);
331 verts = frame->
verts;
340 VkDescriptorSet uboDescriptorSet;
342 memcpy(uboData, modelMatrix,
sizeof(
float) * 16);
355 pipelineIdx = TRIANGLE_FAN;
359 pipelineIdx = TRIANGLE_STRIP;
371 shadowverts[
i][0] = point[0];
372 shadowverts[
i][1] = point[1];
373 shadowverts[
i][2] = point[2];
381 VkDeviceSize vaoSize =
sizeof(
vec3_t) *
i;
383 VkDeviceSize vboOffset;
385 memcpy(vertData, shadowverts, vaoSize);
388 vkCmdBindDescriptorSets(
vk_activeCmdbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines[pipelineIdx].layout, 0, 1, &uboDescriptorSet, 1, &uboOffset);
391 if (pipelineIdx == TRIANGLE_STRIP)
414 vec3_t thismins, oldmins, thismaxs, oldmaxs;
444 if ( pframe == poldframe )
446 for (
i = 0;
i < 3;
i++ )
449 maxs[
i] = mins[
i] + pframe->
scale[
i]*255;
454 for (
i = 0;
i < 3;
i++ )
457 thismaxs[
i] = thismins[
i] + pframe->
scale[
i]*255;
460 oldmaxs[
i] = oldmins[
i] + poldframe->
scale[
i]*255;
462 if ( thismins[
i] < oldmins[
i] )
463 mins[
i] = thismins[
i];
465 mins[
i] = oldmins[
i];
467 if ( thismaxs[
i] > oldmaxs[
i] )
468 maxs[
i] = thismaxs[
i];
470 maxs[
i] = oldmaxs[
i];
477 for (
i = 0;
i < 8;
i++ )
503 angles[
YAW] = -angles[
YAW];
504 AngleVectors( angles, vectors[0], vectors[1], vectors[2] );
506 for (
i = 0;
i < 8;
i++ )
520 int p, f, aggregatemask = ~0;
522 for ( p = 0; p < 8; p++ )
526 for ( f = 0; f < 4; f++ )
530 if ( ( dp -
frustum[f].dist ) < 0 )
536 aggregatemask &=
mask;
557 int leftHandOffset = 0;
562 float prev_viewproj[16];
607 for (
i=0 ;
i<3 ;
i++)
639 for (
i=0 ;
i<3 ;
i++)
656 for (
i=0 ;
i<3 ;
i++)