Direct3D 메시의 크기 설정

Posted 2007/02/14 12:37 by J2L

private Mesh Scale(Mesh mesh, float factor)
    {
        int[] ranks = new int[1];
        ranks[0] = mesh.NumberVertices;
        device.Lights.Reset();
        Mesh dummy = mesh.Clone(MeshFlags.SystemMemory, CustomVertex.PositionNormalTextured.Format, device);
        System.Array arr = dummy.VertexBuffer.Lock(0, typeof(CustomVertex.PositionNormalTextured), LockFlags.None, ranks);

        for (int x = 0; x < arr.Length; x++)
        {
            CustomVertex.PositionNormalTextured cpt = (CustomVertex.PositionNormalTextured)arr.GetValue(x);
            cpt.Position = Vector3.Scale(cpt.Position, factor);
            arr.SetValue(cpt, x);
        }

        dummy.SetVertexBufferData(arr, LockFlags.None);
        dummy.VertexBuffer.Unlock();
        arr.Initialize();
        return dummy;
    }

크리에이티브 커먼즈 라이선스
Creative Commons License

'C#' 카테고리의 다른 글

닷넷 프레임워크 3.0 런타임 설치  (0) 2007/03/14
HLSL  (0) 2007/02/27
Direct3D 메시의 크기 설정  (0) 2007/02/14
C# 이미지에 글쓰기..  (0) 2007/02/13
Direct3D 메시의 회전  (0) 2007/02/02
3D 렌더링...  (0) 2007/01/31

Tag : , ,

« PREV : 1 : ... 68 : 69 : 70 : 71 : 72 : 73 : 74 : 75 : 76 : ... 85 : NEXT »