public SSInstancedMeshRenderer(SSInstancesData ps,
                                ISSInstancable mesh  = null,
                                BufferUsageHint hint = BufferUsageHint.StreamDraw)
     : this(ps, hint)
 {
     this.mesh = mesh;
 }
예제 #2
0
        public SSInstancedMeshRenderer(SSInstancesData ps,
                                       BufferUsageHint hint = BufferUsageHint.StreamDraw)
        {
            instanceData            = ps;
            _posBuffer              = new SSAttributeBuffer <SSAttributeVec3> (hint);
            _orientationXYBuffer    = new SSAttributeBuffer <SSAttributeVec2> (hint);
            _orientationZBuffer     = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _masterScaleBuffer      = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _componentScaleXYBuffer = new SSAttributeBuffer <SSAttributeVec2> (hint);
            _componentScaleZBuffer  = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _colorBuffer            = new SSAttributeBuffer <SSAttributeColor> (hint);

            //m_spriteIndexBuffer = new SSAttributeBuffer<SSAttributeByte> (hint);
            _spriteOffsetUBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _spriteOffsetVBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _spriteSizeUBuffer   = new SSAttributeBuffer <SSAttributeFloat> (hint);
            _spriteSizeVBuffer   = new SSAttributeBuffer <SSAttributeFloat> (hint);

            // Fixes flicker issues for particles with "fighting" view depth values
            this.renderState.depthFunc = DepthFunction.Lequal;

            // In many situations selecting instances is computationally intensive.
            // Turn it off and let users customize
            this.selectable = false;
        }
        public SSInstancedMeshRenderer(SSInstancesData ps,
                                       BufferUsageHint hint = BufferUsageHint.StreamDraw)
        {
            instanceData = ps;
            _initAttributeBuffers(hint);

            // Fixes flicker issues for particles with "fighting" view depth values
            this.renderState.depthFunc = DepthFunction.Lequal;

            // In many situations selecting instances is computationally intensive.
            // Turn it off and let users customize
            this.selectable = false;

            this.preRenderHook +=
                (obj, rc) => { if (this.simulateOnRender)
                               {
                                   instanceData.update(rc.timeElapsedS);
                               }
            };
            // TODO: unhook safely
        }
 public SSInstanceBVH(SSInstancesData instanceData, int maxTrianglesPerLeaf = 1)
     : base(new SSInstanceBNHNodeAdaptor(instanceData), new List <int>(), maxTrianglesPerLeaf)
 {
 }
 public SSInstanceBNHNodeAdaptor(SSInstancesData instanceData)
 {
     _instanceData = instanceData;
 }