Ejemplo n.º 1
0
 public void  Set(BxBezier3Line3F src)
 {
     for (byte i = 0; i < 4; i++)
     {
         fDt[i].Set(src[i]);
     }
 }
Ejemplo n.º 2
0
        // -------------------------------------------------------

        private void  GetPosDiff(BxCmSeparatePatch_Object patch, uint surfaceNo, out BxBezier3Line3F hPosBez0, out BxBezier6Line3F hPosBez1, out BxBezier6Line3F hPosBez2, out BxBezier3Line3F hPosBez3,
                                 out BxBezier3Line3F vPosBez0, out BxBezier6Line3F vPosBez1, out BxBezier6Line3F vPosBez2, out BxBezier3Line3F vPosBez3, out BxBezier2Line3F hDiffBez0, out BxBezier5Line3F hDiffBez1,
                                 out BxBezier5Line3F hDiffBez2, out BxBezier2Line3F hDiffBez3, out BxBezier2Line3F vDiffBez0, out BxBezier5Line3F vDiffBez1, out BxBezier5Line3F vDiffBez2, out BxBezier2Line3F vDiffBez3)
        {
            GetPosBezierH(patch, surfaceNo, out hPosBez0, out hPosBez1, out hPosBez2, out hPosBez3);
            GetPosBezierV(patch, surfaceNo, out vPosBez0, out vPosBez1, out vPosBez2, out vPosBez3);
            GetDiffBezierH(patch, surfaceNo, out hDiffBez0, out hDiffBez1, out hDiffBez2, out hDiffBez3);
            GetDiffBezierV(patch, surfaceNo, out vDiffBez0, out vDiffBez1, out vDiffBez2, out vDiffBez3);
        }
Ejemplo n.º 3
0
        public BxBezier3Line3F(BxBezier3Line3F a)
        {
            fDt = new BxVec3F[4];

            for (byte i = 0; i < 4; i++)
            {
                fDt[i] = new BxVec3F(a[i]);
            }
        }
Ejemplo n.º 4
0
        private void  FromBezier3(BxBezier3Line3F src, uint surfaceOfs, byte ofsBase, float[] dst)
        {
            uint texelOfs = ( uint )((surfaceOfs * 80 * KNumFloatInVector4) + (ofsBase * KNumFloatInVector4));

            for (byte i = 0; i < 4; i++)
            {
                dst[texelOfs + i * KNumFloatInVector4 + 0] = src[i].X;
                dst[texelOfs + i * KNumFloatInVector4 + 1] = src[i].Y;
                dst[texelOfs + i * KNumFloatInVector4 + 2] = src[i].Z;
            }
        }
Ejemplo n.º 5
0
        // ------

        private void  SetVertexBufferOne(
            BxBezier3Line3F hPosBez0, BxBezier6Line3F hPosBez1, BxBezier6Line3F hPosBez2, BxBezier3Line3F hPosBez3, BxBezier3Line3F vPosBez0, BxBezier6Line3F vPosBez1,
            BxBezier6Line3F vPosBez2, BxBezier3Line3F vPosBez3, BxBezier2Line3F hDiffBez0, BxBezier5Line3F hDiffBez1, BxBezier5Line3F hDiffBez2, BxBezier2Line3F hDiffBez3,
            BxBezier2Line3F vDiffBez0, BxBezier5Line3F vDiffBez1, BxBezier5Line3F vDiffBez2, BxBezier2Line3F vDiffBez3, int tessDenom, uint surfaceNo, VertexInfo[] vertexAry)
        {
            SetVertexBuffer0(hPosBez0, hPosBez1, hDiffBez0, surfaceNo, vertexAry);
            SetVertexBuffer1(hPosBez2, hPosBez3, hDiffBez3, surfaceNo, vertexAry);
            SetVertexBuffer2(hDiffBez1, hDiffBez2, tessDenom, surfaceNo, vertexAry);
            SetVertexBuffer3(vPosBez0, vPosBez1, vDiffBez0, surfaceNo, vertexAry);
            SetVertexBuffer4(vPosBez2, vPosBez3, vDiffBez3, surfaceNo, vertexAry);
            SetVertexBuffer5(vDiffBez1, vDiffBez2, surfaceNo, vertexAry);
        }
Ejemplo n.º 6
0
        private void  GetPosBezierOuter(BxCmSeparatePatch_Object src, uint surfaceNo, byte hvId, byte hvOfs, byte crossIdx, out BxBezier3Line3F posBez)
        {
            byte vNo0, vNo1;

            HVtoVertexNo(hvId, hvOfs, out vNo0, out vNo1);

            byte wingHvId = ( byte )(1 - hvId);

            posBez = new BxBezier3Line3F();
            posBez[0].Set(src[surfaceNo].Vertex[vNo0].Pos);
            posBez[3].Set(src[surfaceNo].Vertex[vNo1].Pos);
            posBez[1].Set(src[surfaceNo].SurfaceEdge[wingHvId][0].Inner[crossIdx]);
            posBez[2].Set(src[surfaceNo].SurfaceEdge[wingHvId][1].Inner[crossIdx]);
        }
Ejemplo n.º 7
0
        private void  GetPosBezierMain(
            BxCmSeparatePatch_Object src, uint surfaceNo, byte hvId, out BxBezier3Line3F posBez0, out BxBezier6Line3F posBez1, out BxBezier6Line3F posBez2, out BxBezier3Line3F posBez3)
        {
            byte hvOfs, crossIdx;

            hvOfs    = 0;
            crossIdx = 0;
            GetPosBezierOuter(src, surfaceNo, hvId, hvOfs, crossIdx, out posBez0);
            GetPosBezierInner(src, surfaceNo, hvId, hvOfs, out posBez1);

            hvOfs    = 1;
            crossIdx = 6;
            GetPosBezierOuter(src, surfaceNo, hvId, hvOfs, crossIdx, out posBez3);
            GetPosBezierInner(src, surfaceNo, hvId, hvOfs, out posBez2);
        }
Ejemplo n.º 8
0
        private void  GetBezierOuter(BxCmSeparatePatch_Object src, uint surfaceNo, byte hvId, byte hvOfs, byte crossIdx, byte idxPosBez, BxBezier6Line3F[] /*4*/ tmpBez6)
        {
            byte vNo0, vNo1;

            HVtoVertexNo(hvId, hvOfs, out vNo0, out vNo1);

            byte wingHvId = ( byte )(1 - hvId);

            BxBezier3Line3F bez3 = new BxBezier3Line3F();

            bez3[0].Set(src[surfaceNo].Vertex[vNo0].Pos);
            bez3[3].Set(src[surfaceNo].Vertex[vNo1].Pos);
            bez3[1].Set(src[surfaceNo].SurfaceEdge[wingHvId][0].Inner[crossIdx]);
            bez3[2].Set(src[surfaceNo].SurfaceEdge[wingHvId][1].Inner[crossIdx]);

            tmpBez6[idxPosBez] = bez3.UpperTo6();
        }
Ejemplo n.º 9
0
        private void  ExecBezV(BxCmSeparatePatch_Object src, uint surfaceNo, BxCmSeparatePatch_Object dst)
        {
            BxBezier6Line3F[] bezV6 = new BxBezier6Line3F[4];
            BxBezier3Line3F[] bezU3 = new BxBezier3Line3F[7];

            for (byte i = 0; i < 4; i++)
            {
                bezV6[i] = new BxBezier6Line3F();
            }
            for (byte i = 0; i < 7; i++)
            {
                bezU3[i] = new BxBezier3Line3F();
            }

            byte hvId = 1;

            GetBezier(src, surfaceNo, hvId, bezV6);
            TransBezier(bezV6, bezU3);
            Correct(bezU3, surfaceNo, hvId, dst);
        }
Ejemplo n.º 10
0
        private void  GetDiffBezierOuter(BxCmSeparatePatch_Object src, uint surfaceNo, byte hvId, byte hvOfs, byte crossIdx, out BxBezier2Line3F diffBez)
        {
            byte vNo0, vNo1;

            HVtoVertexNo(hvId, hvOfs, out vNo0, out vNo1);

            byte wingHvId = ( byte )(1 - hvId);

            BxBezier3Line3F posBez = new BxBezier3Line3F();

            posBez[0].Set(src[surfaceNo].Vertex[vNo0].Pos);
            posBez[3].Set(src[surfaceNo].Vertex[vNo1].Pos);
            posBez[1].Set(src[surfaceNo].SurfaceEdge[wingHvId][0].Inner[crossIdx]);
            posBez[2].Set(src[surfaceNo].SurfaceEdge[wingHvId][1].Inner[crossIdx]);

            diffBez = posBez.Diff();

            Debug.Assert(diffBez[0].Length >= (BxMathF.KNearZeroF * 10.0));
            Debug.Assert(diffBez[2].Length >= (BxMathF.KNearZeroF * 10.0));
        }
Ejemplo n.º 11
0
        private void  SetVertexBuffer4(BxBezier6Line3F vPosBez2, BxBezier3Line3F vPosBez3, BxBezier2Line3F vDiffBez3, uint surfaceNo, VertexInfo[] vertexAry)
        {
            uint dstIndex = (surfaceNo * 6) + 4;

            ToVector3(vPosBez2[0], ref vertexAry[dstIndex].pnt0);
            ToVector3(vPosBez2[1], ref vertexAry[dstIndex].pnt1);
            ToVector3(vPosBez2[2], ref vertexAry[dstIndex].pnt2);
            ToVector3(vPosBez2[3], ref vertexAry[dstIndex].pnt3);
            ToVector3(vPosBez2[4], ref vertexAry[dstIndex].pnt4);
            ToVector3(vPosBez2[5], ref vertexAry[dstIndex].pnt5);
            ToVector3(vPosBez2[6], ref vertexAry[dstIndex].pnt6);

            ToVector3(vPosBez3[0], ref vertexAry[dstIndex].pnt7);
            ToVector3(vPosBez3[1], ref vertexAry[dstIndex].pnt8);
            ToVector3(vPosBez3[2], ref vertexAry[dstIndex].pnt9);
            ToVector3(vPosBez3[3], ref vertexAry[dstIndex].pnt10);

            ToVector3(vDiffBez3[0], ref vertexAry[dstIndex].pnt11);
            ToVector3(vDiffBez3[1], ref vertexAry[dstIndex].pnt12);
            ToVector3(vDiffBez3[2], ref vertexAry[dstIndex].pnt13);
        }
Ejemplo n.º 12
0
        private void  SetVertexBuffer3(BxBezier3Line3F vPosBez0, BxBezier6Line3F vPosBez1, BxBezier2Line3F vDiffBez0, uint surfaceNo, VertexInfo[] vertexAry)
        {
            uint dstIndex = (surfaceNo * 6) + 3;

            ToVector3(vPosBez0[0], ref vertexAry[dstIndex].pnt0);
            ToVector3(vPosBez0[1], ref vertexAry[dstIndex].pnt1);
            ToVector3(vPosBez0[2], ref vertexAry[dstIndex].pnt2);
            ToVector3(vPosBez0[3], ref vertexAry[dstIndex].pnt3);

            ToVector3(vPosBez1[0], ref vertexAry[dstIndex].pnt4);
            ToVector3(vPosBez1[1], ref vertexAry[dstIndex].pnt5);
            ToVector3(vPosBez1[2], ref vertexAry[dstIndex].pnt6);
            ToVector3(vPosBez1[3], ref vertexAry[dstIndex].pnt7);
            ToVector3(vPosBez1[4], ref vertexAry[dstIndex].pnt8);
            ToVector3(vPosBez1[5], ref vertexAry[dstIndex].pnt9);
            ToVector3(vPosBez1[6], ref vertexAry[dstIndex].pnt10);

            ToVector3(vDiffBez0[0], ref vertexAry[dstIndex].pnt11);
            ToVector3(vDiffBez0[1], ref vertexAry[dstIndex].pnt12);
            ToVector3(vDiffBez0[2], ref vertexAry[dstIndex].pnt13);
        }
Ejemplo n.º 13
0
        // ------

        private void  ConvVtfInfo(BxBezier3Line3F hPosBez0, BxBezier6Line3F hPosBez1, BxBezier6Line3F hPosBez2, BxBezier3Line3F hPosBez3, BxBezier3Line3F vPosBez0, BxBezier6Line3F vPosBez1,
                                  BxBezier6Line3F vPosBez2, BxBezier3Line3F vPosBez3, BxBezier2Line3F hDiffBez0, BxBezier5Line3F hDiffBez1, BxBezier5Line3F hDiffBez2, BxBezier2Line3F hDiffBez3,
                                  BxBezier2Line3F vDiffBez0, BxBezier5Line3F vDiffBez1, BxBezier5Line3F vDiffBez2, BxBezier2Line3F vDiffBez3, uint surfaceOfs, float[] vtfInfo)
        {
            FromBezier3(hPosBez0, surfaceOfs, 0, vtfInfo);
            FromBezier6(hPosBez1, surfaceOfs, 4, vtfInfo);
            FromBezier6(hPosBez2, surfaceOfs, 11, vtfInfo);
            FromBezier3(hPosBez3, surfaceOfs, 18, vtfInfo);

            FromBezier3(vPosBez0, surfaceOfs, 22, vtfInfo);
            FromBezier6(vPosBez1, surfaceOfs, 26, vtfInfo);
            FromBezier6(vPosBez2, surfaceOfs, 33, vtfInfo);
            FromBezier3(vPosBez3, surfaceOfs, 40, vtfInfo);

            FromBezier2(hDiffBez0, surfaceOfs, 44, vtfInfo);
            FromBezier5(hDiffBez1, surfaceOfs, 47, vtfInfo);
            FromBezier5(hDiffBez2, surfaceOfs, 53, vtfInfo);
            FromBezier2(hDiffBez3, surfaceOfs, 59, vtfInfo);

            FromBezier2(vDiffBez0, surfaceOfs, 62, vtfInfo);
            FromBezier5(vDiffBez1, surfaceOfs, 65, vtfInfo);
            FromBezier5(vDiffBez2, surfaceOfs, 71, vtfInfo);
            FromBezier2(vDiffBez3, surfaceOfs, 77, vtfInfo);
        }
Ejemplo n.º 14
0
        private void  CorrectMain(BxBezier3Line3F transBez3, BxVec3F[] /*2*/ dstHandle)
        {
            sbyte lIdxNoHandleZero, rIdxNoHandleZero;

            transBez3.GetIdxNoHandleZero(out lIdxNoHandleZero, out rIdxNoHandleZero);

            sbyte dim = ( sbyte )(rIdxNoHandleZero - lIdxNoHandleZero + 1);

            dstHandle[0] = null;
            dstHandle[1] = null;

            Debug.Assert(1 <= dim && dim <= 3);
            if (dim == 3)
            {
                return;
            }

            float lenBetweenVtx = (transBez3[3] - transBez3[0]).Length;
            float minimumLen    = lenBetweenVtx * BxMathF.KDirectionEpsRatioF;

            if (minimumLen < BxMathF.KDirectionEpsRatioF)
            {
                minimumLen = BxMathF.KDirectionEpsRatioF;
            }

            if (dim == 2)
            {
                if (lIdxNoHandleZero > 0)
                {
                    dstHandle[0] = (transBez3[2] - transBez3[0]).Normalize() * minimumLen;
                }
                else
                {
                    Debug.Assert(rIdxNoHandleZero < 2);
                    dstHandle[1] = (transBez3[1] - transBez3[3]).Normalize() * minimumLen;
                }
            }
            else if (dim == 1)
            {
                if (rIdxNoHandleZero == 2)
                {
                    dstHandle[0] = (transBez3[3] - transBez3[0]).Normalize() * minimumLen;

                    BxVec3F vecR = transBez3[2] - transBez3[3];
                    float   lenR = vecR.Length;
                    dstHandle[1] = vecR * ((lenR - minimumLen) / lenR);
                }
                else if (lIdxNoHandleZero == 0)
                {
                    BxVec3F vecL = transBez3[1] - transBez3[0];
                    float   lenL = vecL.Length;
                    dstHandle[0] = vecL * ((lenL - minimumLen) / lenL);

                    dstHandle[1] = (transBez3[0] - transBez3[3]).Normalize() * minimumLen;
                }
                else
                {
                    BxVec3F handle = (transBez3[3] - transBez3[0]).Normalize() * minimumLen;
                    dstHandle[0] = handle.Copy;
                    dstHandle[1] = -handle;
                }
            }
        }
Ejemplo n.º 15
0
 private void  GetPosBezierV(BxCmSeparatePatch_Object src, uint surfaceNo, out BxBezier3Line3F vPosBez0, out BxBezier6Line3F vPosBez1, out BxBezier6Line3F vPosBez2, out BxBezier3Line3F vPosBez3)
 {
     GetPosBezierMain(src, surfaceNo, 1, out vPosBez0, out vPosBez1, out vPosBez2, out vPosBez3);
 }