Lines Matching refs:psMesh
99 static unsigned short FindOrCreateVertex(PVRTShadowVolShadowMesh * const psMesh, const PVRTVECTOR3 … in FindOrCreateVertex() argument
105 for(wCurr = 0; wCurr < psMesh->nV; wCurr++) { in FindOrCreateVertex()
106 if(memcmp(&psMesh->pV[wCurr], pV, sizeof(*pV)) == 0) { in FindOrCreateVertex()
115 psMesh->pV[psMesh->nV] = *pV; in FindOrCreateVertex()
117 return (unsigned short) psMesh->nV++; in FindOrCreateVertex()
133 static unsigned int FindOrCreateEdge(PVRTShadowVolShadowMesh * const psMesh, const PVRTVECTOR3 * co… in FindOrCreateEdge() argument
137 wV0 = FindOrCreateVertex(psMesh, pv0); in FindOrCreateEdge()
138 wV1 = FindOrCreateVertex(psMesh, pv1); in FindOrCreateEdge()
144 for(nCurr = 0; nCurr < psMesh->nE; nCurr++) { in FindOrCreateEdge()
146 (psMesh->pE[nCurr].wV0 == wV0 && psMesh->pE[nCurr].wV1 == wV1) || in FindOrCreateEdge()
147 (psMesh->pE[nCurr].wV0 == wV1 && psMesh->pE[nCurr].wV1 == wV0)) in FindOrCreateEdge()
157 psMesh->pE[psMesh->nE].wV0 = wV0; in FindOrCreateEdge()
158 psMesh->pE[psMesh->nE].wV1 = wV1; in FindOrCreateEdge()
159 psMesh->pE[psMesh->nE].nVis = 0; in FindOrCreateEdge()
161 return psMesh->nE++; in FindOrCreateEdge()
206 PVRTShadowVolShadowMesh * const psMesh, in FindOrCreateTriangle() argument
215 wE0 = FindOrCreateEdge(psMesh, pv0, pv1); in FindOrCreateTriangle()
216 wE1 = FindOrCreateEdge(psMesh, pv1, pv2); in FindOrCreateTriangle()
217 wE2 = FindOrCreateEdge(psMesh, pv2, pv0); in FindOrCreateTriangle()
228 for(nCurr = 0; nCurr < psMesh->nT; nCurr++) { in FindOrCreateTriangle()
230 (psMesh->pT[nCurr].wE0 == wE0 || psMesh->pT[nCurr].wE0 == wE1 || psMesh->pT[nCurr].wE0 == wE2) && in FindOrCreateTriangle()
231 (psMesh->pT[nCurr].wE1 == wE0 || psMesh->pT[nCurr].wE1 == wE1 || psMesh->pT[nCurr].wE1 == wE2) && in FindOrCreateTriangle()
232 (psMesh->pT[nCurr].wE2 == wE0 || psMesh->pT[nCurr].wE2 == wE1 || psMesh->pT[nCurr].wE2 == wE2)) in FindOrCreateTriangle()
242 psMesh->pT[psMesh->nT].wE0 = wE0; in FindOrCreateTriangle()
243 psMesh->pT[psMesh->nT].wE1 = wE1; in FindOrCreateTriangle()
244 psMesh->pT[psMesh->nT].wE2 = wE2; in FindOrCreateTriangle()
246 psE0 = &psMesh->pE[wE0]; in FindOrCreateTriangle()
247 psE1 = &psMesh->pE[wE1]; in FindOrCreateTriangle()
248 psE2 = &psMesh->pE[wE2]; in FindOrCreateTriangle()
254 psMesh->pT[psMesh->nT].w[0] = psE0->wV1; in FindOrCreateTriangle()
256 psMesh->pT[psMesh->nT].w[0] = psE0->wV0; in FindOrCreateTriangle()
259 psMesh->pT[psMesh->nT].w[1] = psE1->wV1; in FindOrCreateTriangle()
261 psMesh->pT[psMesh->nT].w[1] = psE1->wV0; in FindOrCreateTriangle()
264 psMesh->pT[psMesh->nT].w[2] = psE2->wV1; in FindOrCreateTriangle()
266 psMesh->pT[psMesh->nT].w[2] = psE2->wV0; in FindOrCreateTriangle()
269 CrossProduct(&psMesh->pT[psMesh->nT].vNormal, pv0, pv1, pv2); in FindOrCreateTriangle()
272 psMesh->pT[psMesh->nT].nWinding = 0; in FindOrCreateTriangle()
273 if(memcmp(&psMesh->pV[psE0->wV0], pv0, sizeof(*pv0)) == 0) psMesh->pT[psMesh->nT].nWinding |= 0x01; in FindOrCreateTriangle()
274 if(memcmp(&psMesh->pV[psE1->wV0], pv1, sizeof(*pv1)) == 0) psMesh->pT[psMesh->nT].nWinding |= 0x02; in FindOrCreateTriangle()
275 if(memcmp(&psMesh->pV[psE2->wV0], pv2, sizeof(*pv2)) == 0) psMesh->pT[psMesh->nT].nWinding |= 0x04; in FindOrCreateTriangle()
277 psMesh->nT++; in FindOrCreateTriangle()
290 PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolMeshCreateMesh() argument
301 memset(psMesh, 0, sizeof(*psMesh)); in PVRTShadowVolMeshCreateMesh()
306 psMesh->pV = (PVRTVECTOR3*)malloc(nNumVertex * sizeof(*psMesh->pV)); in PVRTShadowVolMeshCreateMesh()
307 psMesh->pE = (PVRTShadowVolMEdge*)malloc(nNumFaces * sizeof(*psMesh->pE) * 3); in PVRTShadowVolMeshCreateMesh()
308 psMesh->pT = (PVRTShadowVolMTriangle*)malloc(nNumFaces * sizeof(*psMesh->pT)); in PVRTShadowVolMeshCreateMesh()
309 _ASSERT(psMesh->pV); in PVRTShadowVolMeshCreateMesh()
310 _ASSERT(psMesh->pE); in PVRTShadowVolMeshCreateMesh()
311 _ASSERT(psMesh->pT); in PVRTShadowVolMeshCreateMesh()
314 FindOrCreateTriangle(psMesh, in PVRTShadowVolMeshCreateMesh()
320 _ASSERT(psMesh->nV <= nNumVertex); in PVRTShadowVolMeshCreateMesh()
321 _ASSERT(psMesh->nE < nNumFaces * 3); in PVRTShadowVolMeshCreateMesh()
322 _ASSERT(psMesh->nT == nNumFaces); in PVRTShadowVolMeshCreateMesh()
324 _RPT2(_CRT_WARN, "Unique vertices : %d (from %d)\n", psMesh->nV, nNumVertex); in PVRTShadowVolMeshCreateMesh()
325 _RPT2(_CRT_WARN, "Unique edges : %d (from %d)\n", psMesh->nE, nNumFaces * 3); in PVRTShadowVolMeshCreateMesh()
326 _RPT2(_CRT_WARN, "Unique triangles: %d (from %d)\n", psMesh->nT, nNumFaces); in PVRTShadowVolMeshCreateMesh()
331 psMesh->pV = (PVRTVECTOR3*)realloc(psMesh->pV, psMesh->nV * sizeof(*psMesh->pV)); in PVRTShadowVolMeshCreateMesh()
332 psMesh->pE = (PVRTShadowVolMEdge*)realloc(psMesh->pE, psMesh->nE * sizeof(*psMesh->pE)); in PVRTShadowVolMeshCreateMesh()
333 psMesh->pT = (PVRTShadowVolMTriangle*)realloc(psMesh->pT, psMesh->nT * sizeof(*psMesh->pT)); in PVRTShadowVolMeshCreateMesh()
334 _ASSERT(psMesh->pV); in PVRTShadowVolMeshCreateMesh()
335 _ASSERT(psMesh->pE); in PVRTShadowVolMeshCreateMesh()
336 _ASSERT(psMesh->pT); in PVRTShadowVolMeshCreateMesh()
346 for(nEdge = 0; nEdge < psMesh->nE; nEdge++) { in PVRTShadowVolMeshCreateMesh()
349 for(nTri = 0; nTri < psMesh->nT; nTri++) { in PVRTShadowVolMeshCreateMesh()
350 if(psMesh->pT[nTri].wE0 == nEdge) in PVRTShadowVolMeshCreateMesh()
353 if(psMesh->pT[nTri].wE1 == nEdge) in PVRTShadowVolMeshCreateMesh()
356 if(psMesh->pT[nTri].wE2 == nEdge) in PVRTShadowVolMeshCreateMesh()
380 PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolMeshInitMesh() argument
399 _ASSERT(psMesh); in PVRTShadowVolMeshInitMesh()
400 _ASSERT(psMesh->nV); in PVRTShadowVolMeshInitMesh()
401 _ASSERT(psMesh->nE); in PVRTShadowVolMeshInitMesh()
402 _ASSERT(psMesh->nT); in PVRTShadowVolMeshInitMesh()
407 _ASSERT(psMesh->pivb == NULL); in PVRTShadowVolMeshInitMesh()
408 …dowMeshInitMesh() %5d byte VB (%3dv x 2 x size(%d))\n", psMesh->nV * 2 * sizeof(*pvData), psMesh->… in PVRTShadowVolMeshInitMesh()
412 sVBBufferDesc.ByteWidth = psMesh->nV * 2 * 3 * sizeof(*pvData); in PVRTShadowVolMeshInitMesh()
418 hRes = pContext->pDev->CreateBuffer(&sVBBufferDesc, NULL, &psMesh->pivb) != S_OK; in PVRTShadowVolMeshInitMesh()
429 hRes = pDeviceContext->Map(psMesh->pivb, 0, D3D11_MAP_WRITE_DISCARD, NULL, &data); in PVRTShadowVolMeshInitMesh()
444 pContext->pglExt->glGenBuffersARB(1, &psMesh->pivb); in PVRTShadowVolMeshInitMesh()
445 pContext->pglExt->glBindBufferARB(GL_ARRAY_BUFFER_ARB, psMesh->pivb); in PVRTShadowVolMeshInitMesh()
446 …pContext->pglExt->glBufferDataARB(GL_ARRAY_BUFFER_ARB, psMesh->nV * 2 * sizeof(*pvData), NULL, GL_… in PVRTShadowVolMeshInitMesh()
451 psMesh->pivb = malloc(psMesh->nV * 2 * sizeof(*pvData)); in PVRTShadowVolMeshInitMesh()
452 pvData = (SVertexShVol*)psMesh->pivb; in PVRTShadowVolMeshInitMesh()
458 for(nCurr = 0; nCurr < psMesh->nV; ++nCurr) in PVRTShadowVolMeshInitMesh()
460 pvData[nCurr].x = psMesh->pV[nCurr].x; in PVRTShadowVolMeshInitMesh()
461 pvData[nCurr].y = psMesh->pV[nCurr].y; in PVRTShadowVolMeshInitMesh()
462 pvData[nCurr].z = psMesh->pV[nCurr].z; in PVRTShadowVolMeshInitMesh()
467 pvData[nCurr + psMesh->nV].fWeight = 1; in PVRTShadowVolMeshInitMesh()
469 pvData[nCurr + psMesh->nV] = pvData[nCurr]; in PVRTShadowVolMeshInitMesh()
470 pvData[nCurr + psMesh->nV].dwExtrude = 0x04030201; // Order is wzyx in PVRTShadowVolMeshInitMesh()
479 pDeviceContext->Unmap(psMesh->pivb, 0); in PVRTShadowVolMeshInitMesh()
494 const PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolMeshInitVol() argument
504 _ASSERT(psMesh); in PVRTShadowVolMeshInitVol()
505 _ASSERT(psMesh->nV); in PVRTShadowVolMeshInitVol()
506 _ASSERT(psMesh->nE); in PVRTShadowVolMeshInitVol()
507 _ASSERT(psMesh->nT); in PVRTShadowVolMeshInitVol()
509 …_RPT1(_CRT_WARN, "ShadowMeshInitVol() %5lu byte IB\n", psMesh->nT * 2 * 3 * sizeof(unsigned short)… in PVRTShadowVolMeshInitVol()
515 psVol->nIdxCntMax = psMesh->nT * 2 * 3; in PVRTShadowVolMeshInitVol()
519 sIdxBuferDesc.ByteWidth = psMesh->nT * 2 * 3 * sizeof(unsigned short); in PVRTShadowVolMeshInitVol()
538 …pContext->pglExt->glBufferDataARB(GL_ARRAY_BUFFER_ARB, psMesh->nT * 2 * 3 * sizeof(unsigned short)… in PVRTShadowVolMeshInitVol()
542 psVol->piib = (unsigned short*)malloc(psMesh->nT * 2 * 3 * sizeof(unsigned short)); in PVRTShadowVolMeshInitVol()
554 PVRTShadowVolShadowMesh * const psMesh) in PVRTShadowVolMeshDestroyMesh() argument
556 FREE(psMesh->pV); in PVRTShadowVolMeshDestroyMesh()
557 FREE(psMesh->pE); in PVRTShadowVolMeshDestroyMesh()
558 FREE(psMesh->pT); in PVRTShadowVolMeshDestroyMesh()
567 PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolMeshReleaseMesh() argument
574 psContext->pglExt->glDeleteBuffersARB(1, &psMesh->pivb); in PVRTShadowVolMeshReleaseMesh()
578 FREE(psMesh->pivb); in PVRTShadowVolMeshReleaseMesh()
617 const PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolSilhouetteProjectedBuild() argument
622 …PVRTShadowVolSilhouetteProjectedBuild(psVol, dwVisFlags,psMesh, (PVRTVECTOR3*) pvLightModel, bPoin… in PVRTShadowVolSilhouetteProjectedBuild()
638 const PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolSilhouetteProjectedBuild() argument
689 for(nCurr = 0; nCurr < psMesh->nT; ++nCurr) in PVRTShadowVolSilhouetteProjectedBuild()
692 psTri = &psMesh->pT[nCurr]; in PVRTShadowVolSilhouetteProjectedBuild()
693 pE0 = &psMesh->pE[psTri->wE0]; in PVRTShadowVolSilhouetteProjectedBuild()
694 pE1 = &psMesh->pE[psTri->wE1]; in PVRTShadowVolSilhouetteProjectedBuild()
695 pE2 = &psMesh->pE[psTri->wE2]; in PVRTShadowVolSilhouetteProjectedBuild()
698 v.x = psMesh->pV[pE0->wV0].x - pvLightModel->x; in PVRTShadowVolSilhouetteProjectedBuild()
699 v.y = psMesh->pV[pE0->wV0].y - pvLightModel->y; in PVRTShadowVolSilhouetteProjectedBuild()
700 v.z = psMesh->pV[pE0->wV0].z - pvLightModel->z; in PVRTShadowVolSilhouetteProjectedBuild()
730 pwIdx[psVol->nIdxCnt+0] = (unsigned short) psMesh->nV + psTri->w[0]; in PVRTShadowVolSilhouetteProjectedBuild()
731 pwIdx[psVol->nIdxCnt+1] = (unsigned short) psMesh->nV + psTri->w[1]; in PVRTShadowVolSilhouetteProjectedBuild()
732 pwIdx[psVol->nIdxCnt+2] = (unsigned short) psMesh->nV + psTri->w[2]; in PVRTShadowVolSilhouetteProjectedBuild()
741 _ASSERT(pwIdx[nCurr] < psMesh->nV*2); in PVRTShadowVolSilhouetteProjectedBuild()
748 for(nCurr = 0; nCurr < psMesh->nE; nCurr++) { in PVRTShadowVolSilhouetteProjectedBuild()
749 psEdge = &psMesh->pE[nCurr]; in PVRTShadowVolSilhouetteProjectedBuild()
761 pwIdx[psVol->nIdxCnt+2] = psEdge->wV0 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
763 pwIdx[psVol->nIdxCnt+3] = psEdge->wV0 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
765 pwIdx[psVol->nIdxCnt+5] = psEdge->wV1 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
769 pwIdx[psVol->nIdxCnt+2] = psEdge->wV1 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
771 pwIdx[psVol->nIdxCnt+3] = psEdge->wV1 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
773 pwIdx[psVol->nIdxCnt+5] = psEdge->wV0 + (unsigned short) psMesh->nV; in PVRTShadowVolSilhouetteProjectedBuild()
786 _ASSERT(pwIdx[nCurr] < psMesh->nV*2); in PVRTShadowVolSilhouetteProjectedBuild()
1268 const PVRTShadowVolShadowMesh * const psMesh, in PVRTShadowVolSilhouetteProjectedRender() argument
1277 _ASSERT(psMesh->pivb); in PVRTShadowVolSilhouetteProjectedRender()
1289 pContext->pglExt->glBindBufferARB(GL_ARRAY_BUFFER_ARB, psMesh->pivb); in PVRTShadowVolSilhouetteProjectedRender()
1314 …glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(SVertexShVol), &((SVertexShVol*)psMesh->piv… in PVRTShadowVolSilhouetteProjectedRender()
1317 …1, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(SVertexShVol), &((SVertexShVol*)psMesh->pivb)[0].dwExtrud… in PVRTShadowVolSilhouetteProjectedRender()
1334 glVertexPointer(3, GL_FLOAT, sizeof(SVertexShVol), &((SVertexShVol*)psMesh->pivb)[0].x); in PVRTShadowVolSilhouetteProjectedRender()
1335 …exPointerOES(1, GL_UNSIGNED_BYTE, sizeof(SVertexShVol), &((SVertexShVol*)psMesh->pivb)[0].dwExtrud… in PVRTShadowVolSilhouetteProjectedRender()
1336 …pContext->pglesExt->glWeightPointerOES(1, GL_FLOAT, sizeof(SVertexShVol), &((SVertexShVol*)psMesh-… in PVRTShadowVolSilhouetteProjectedRender()