Esempio n. 1
0
        public myLine3D()
        {
            Init_Event_GetSquaredViewDepth();
            Init_Event_GetBoundingRadius();
            Init_Event_GetWorldOrientation();
            Init_Event_GetWorldPosition();

            evtGetSquaredViewDepth += new SRD_Delegate_getSquaredViewDepth(event_getSquaredViewDepth);
            evtGetBoundingRadius   += new SRD_Delegate_getBoundingRadius(event_getBoundingRadius);
            evtGetWorldOrientation += new SRD_Delegate_getWorldOrientation(event_getWorldOrientation);
            evtGetWorldPosition    += new SRD_Delegate_getWorldPosition(event_getWorldPosition);

            mPoints            = new ArrayList();
            mVD                = new VertexData();
            this.RO_VertexData = mVD;

            mDrawn = false;
            mVertexBufferCapacity = 0;

            this.setMaterial("BaseWhiteNoLighting");
        }
Esempio n. 2
0
        public myBillBoardChain(Camera vCamera, int maxNbChainElements) : base()
        {
            Init_Event_NotifyCurrentCamera();
            Init_Event_GetSquaredViewDepth();
            Init_Event_GetBoundingRadius();

            evtNotifyCurrentCamera += new SRD_Delegate_notifyCurrentCamera(event_notifyCurrentCamera);
            evtGetSquaredViewDepth += new SRD_Delegate_getSquaredViewDepth(event_getSquaredViewDepth);
            evtGetBoundingRadius   += new SRD_Delegate_getBoundingRadius(event_getBoundingRadius);

            mCamera           = vCamera;
            mChainElementList = new ArrayList();

            mRadius             = 0.0f;
            mMaxNbChainElements = maxNbChainElements;

            mVD = new VertexData();
            this.RO_VertexData = mVD;
            this.RO_IndexData  = null;

            mVD.vertexCount       = (uint)0;
            mVD.vertexStart       = 0;
            this.RO_OperationType = OperationType.OT_TRIANGLE_STRIP;
            this.RO_UseIndexes    = false;

            mVBPostOff  = 0;   mVBVertexSize = 0;
            mVCBrgbaOff = 0;  mVCBVertexSize = 0;
            mTCBuvOff   = 0;    mTCVertexSize = 0;

            //----------
            // Add a description for the buffer of the positions of the vertices
            mVBPostOff     = mVD.vertexDeclaration.addElement(POSITION_BINDING, 0, VertexElementType.VET_FLOAT3, VertexElementSemantic.VES_POSITION).getOffset();
            mVBVertexSize += VertexElement.getTypeSize(VertexElementType.VET_FLOAT3);
            // Create the buffer
            HardwareVertexBufferSharedPtr pVertexBuffer = HardwareBufferManager.getSingleton().createVertexBuffer(
                mVD.vertexDeclaration.getVertexSize(POSITION_BINDING),
                (uint)(mMaxNbChainElements * 2),
                HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY);

            // Bind the buffer
            mVD.vertexBufferBinding.setBinding(POSITION_BINDING, pVertexBuffer);

            //----------
            // Add a description for the buffer of the diffuse color of the vertices
            mVCBrgbaOff     = mVD.vertexDeclaration.addElement(DIFFUSE_COLOR_BINDING, 0, VertexElementType.VET_FLOAT4, VertexElementSemantic.VES_DIFFUSE).getOffset();
            mVCBVertexSize += VertexElement.getTypeSize(VertexElementType.VET_FLOAT4);
            // Create the buffer
            HardwareVertexBufferSharedPtr pVertexColorBuffer = HardwareBufferManager.getSingleton().createVertexBuffer(
                mVD.vertexDeclaration.getVertexSize(DIFFUSE_COLOR_BINDING),
                (uint)(mMaxNbChainElements * 2),
                HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY);

            // Bind the buffer
            mVD.vertexBufferBinding.setBinding(DIFFUSE_COLOR_BINDING, pVertexColorBuffer);

            //----------
            // Add a description for the buffer of the texture coordinates of the vertices
            mTCBuvOff      = mVD.vertexDeclaration.addElement(TEXCOORD_BINDING, 0, VertexElementType.VET_FLOAT2, VertexElementSemantic.VES_TEXTURE_COORDINATES).getOffset();
            mTCVertexSize += VertexElement.getTypeSize(VertexElementType.VET_FLOAT2);
            // Create the buffer
            HardwareVertexBufferSharedPtr pTexCoordBuffer = HardwareBufferManager.getSingleton().createVertexBuffer(
                mVD.vertexDeclaration.getVertexSize(TEXCOORD_BINDING),
                (uint)(mMaxNbChainElements * 2),
                HardwareBuffer.Usage.HBU_STATIC_WRITE_ONLY);

            // Bind the buffer
            mVD.vertexBufferBinding.setBinding(TEXCOORD_BINDING, pTexCoordBuffer);


            // set basic white material
            this.setMaterial("BaseWhiteNoLighting");
        }