コード例 #1
0
 public ISg SetParameters(AbstractTraversal t)
 {
     return(m_instance.Cvg);
 }
コード例 #2
0
 public void InitForPath(AbstractTraversal t)
 {
     // nop
 }
コード例 #3
0
        public ISg SetParameters(AbstractTraversal t)
        {
            if (!m_isInitialized)
            {
                var info = m_instance.PatchFileInfo;
                var bb   = m_instance.PositionsType == PositionsType.V3dPositions ?
                           info.LocalBoundingBox : info.LocalBoundingBox2d;

                var patch = new StreamingJob(
                    () =>
                {
                    //TaskCombinators.Delay(100);
                    //do importer logic here

                    var patchVg = m_instance.LoadingStrategy.Load(m_instance.PatchFileInfo, m_instance.PatchFilePath, m_instance.PositionsType,
                                                                  true, true, true, m_instance.MaxTriangleSize);

                    if (patchVg == null)
                    {
                        return(EmptyLeaf.Singleton);
                    }

                    var lodColor        = Patch.GetLodColor(m_instance.Level, m_instance.MaxLevel);
                    patchVg["LodColor"] = lodColor;

                    for (int i = 0; i < patchVg.Textures.Count; i++)
                    {
                        var key = patchVg.Textures.Keys.ToList()[i];

                        var source         = patchVg.Textures[key].Convertible;
                        Convertible target = null;

                        if (t.Renderer is SlimDx9Renderer)
                        {
                            target = SlimDx9TextureConvertible.Create(
                                new SlimDx9TextureConvertible.SlimDx9TextureParameters()
                            {
                                //SlimDx9Format = SlimDX.Direct3D9.Format., // .Dxt5,
                                Pool = SlimDX.Direct3D9.Pool.Default
                            });
                            source.ConvertInto(target);
                        }
                        else
                        {
                            // nothing todo in slimdx10renderer (this just loads the texture on demand)
                            // fix this if you are fed up with framerate hick ups
                            target = source;
                        }

                        patchVg.Textures[key] = new Texture(target);
                    }
                    lock (asyncLock)
                    {
                        m_asyncTextures = patchVg.Textures;
                    }

                    return(patchVg.ToVertexGeometrySet());
                },
                    bb, m_instance.MaxLevel - m_instance.Level, true);

                patch.DestructSideEffects = DisposeSideEffects;

                var placeHolder = Primitives.WireBox(bb, C4b.Red).ToVertexGeometrySet();

                m_returnISg = new AsyncStreamingNode(patch, placeHolder)
                {
                    DebugName = Path.GetFileName(m_instance.PatchFilePath),
                };

                var local2Global = m_instance.PatchFileInfo.GetLocal2Global(m_instance.PositionsType);

                if (m_instance.InvertZ)
                {
                    local2Global = M44d.Scale(1, 1, -1) * local2Global;
                }

                var global2Local = local2Global.Inverse;
                m_returnISg = Rsg.Apply(Rsg.Attribute.PushTrafo3d(new Trafo3d(local2Global, global2Local)), m_returnISg);

                m_isInitialized = true;
            }

            return(m_returnISg);
        }
コード例 #4
0
 public CachedCvgRule(CachedCvg instance, AbstractTraversal t)
 {
     m_instance = instance;
 }
コード例 #5
0
 public PatchRule(Patch instance, AbstractTraversal traversal)
 {
     m_instance = instance;
 }