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; }
protected override void _initAttributeBuffers(BufferUsageHint hint) { hint = BufferUsageHint.DynamicDraw; _posBuffer = new SSAttributeBuffer <SSAttributeVec3> (hint); _cylAxesBuffer = new SSAttributeBuffer <SSAttributeVec3> (hint); _prevJointBuffer = new SSAttributeBuffer <SSAttributeVec3> (hint); _nextJointBuffer = new SSAttributeBuffer <SSAttributeVec3> (hint); _widthsBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint); _lengthsBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint); _colorBuffer = new SSAttributeBuffer <SSAttributeColor> (hint); _innerColorBuffer = new SSAttributeBuffer <SSAttributeColor> (hint); _innerColorRatioBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint); _outerColorRatioBuffer = new SSAttributeBuffer <SSAttributeFloat> (hint); }
// TODO interface or abstract classify protected virtual void _initAttributeBuffers(BufferUsageHint hint) { _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); }
public SSInstancedMeshRenderer(SSParticleSystem ps, BufferUsageHint hint = BufferUsageHint.StreamDraw) { particleSystem = 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); }