Ejemplo n.º 1
0
        Box RekursiveGetBox(Assimp.Node node, Box BoxMin)
        {
            Box _Box = BoxMin;

            if ((node.HasMeshes))
            {
                foreach (var index in node.MeshIndices)
                {
                    D3DMesh mesh = (Meshes[index] as D3DMesh);

                    xyzf b = new xyzf(0, 0, 0);


                    CpuSkinningEvaluator.CachedMeshData MD = SkinninEvaluator.GetEntry(mesh);
                    SkinninEvaluator.GetTransformedVertexPosition(node, mesh, 0, out b);

                    xyzf[] P = new xyzf[MD._cachedPositions.Length];
                    for (int i = 0; i < P.Length; i++)
                    {
                        P[i] = mesh.Transformation * MD._cachedPositions[i];
                    }
                    _Box = Box.GetEnvBox(P, _Box);
                }
            }
            for (int i = 0; i < node.Children.Count; i++)
            {
                _Box = RekursiveGetBox(node.Children[i], _Box);
            }
            return(_Box);
        }
Ejemplo n.º 2
0
        void RekursiveDraw(Assimp.Node node, OpenGlDevice Device)
        {
            if ((node.HasMeshes))
            {
                foreach (var index in node.MeshIndices)
                {
                    D3DMesh mesh = (Meshes[index] as D3DMesh);

                    xyzf b = new xyzf(0, 0, 0);


                    CpuSkinningEvaluator.CachedMeshData MD = SkinninEvaluator.GetEntry(mesh);
                    SkinninEvaluator.GetTransformedVertexPosition(node, mesh, 0, out b);
                    if (mesh.Material.Translucent < 1)
                    {
                        TransparentMeshes.Add(new TransParencyItem(mesh, MD._cachedPositions, MD._cachedNormals));
                        continue;
                    }

                    xyzf[] SavePos     = mesh.Position;
                    xyzf[] SaveNormals = mesh.Normals;
                    mesh.Position = MD._cachedPositions;
                    mesh.Normals  = MD._cachedNormals;
                    mesh.Paint(Device);
                    mesh.Position = SavePos;
                    mesh.Normals  = SaveNormals;
                }
            }
            for (int i = 0; i < node.Children.Count; i++)
            {
                RekursiveDraw(node.Children[i], Device);
            }
        }