Esempio n. 1
0
        internal void DrawTextured(RenderContext renderContext, Texture texture, float opacity)
        {
            InitBuffer(renderContext);

            foreach (TimeSeriesPointVertexBuffer pointBuffer in pointBuffers)
            {
                TimeSeriesPointSpriteShader.Use(
                    renderContext, pointBuffer.VertexBuffer, texture.Texture2d,
                    Color.FromArgb(255 * opacity, 255, 255, 255), DepthBuffered, (float)(this.JNow),
                    (float)Decay, renderContext.CameraPosition, (float)(scale * (renderContext.Height / 960)), MinSize
                    );

                renderContext.gl.drawArrays(GL.POINTS, 0, pointBuffer.Count);
            }
        }
Esempio n. 2
0
        public void DrawTextured(RenderContext renderContext, WebGLTexture texture, float opacity)
        {
            InitBuffer(renderContext);

            Vector3d zero   = new Vector3d();
            Matrix3d matInv = Matrix3d.MultiplyMatrix(renderContext.World, renderContext.View);

            matInv.Invert();
            Vector3d cam = Vector3d.TransformCoordinate(zero, matInv);

            foreach (TimeSeriesPointVertexBuffer pointBuffer in pointBuffers)
            {
                TimeSeriesPointSpriteShader.Use(
                    renderContext, pointBuffer.VertexBuffer, texture,
                    Color.FromArgb(255 * opacity, 255, 255, 255), DepthBuffered, (float)(this.JNow),
                    (float)Decay, cam, (float)(scale * (renderContext.Height / 960)), MinSize, ShowFarSide, Sky
                    );

                renderContext.gl.drawArrays(GL.POINTS, 0, pointBuffer.Count);
            }
        }
Esempio n. 3
0
        public void Draw(RenderContext renderContext, float opacity, bool cull)
        {
            InitBuffer(renderContext);



            if (renderContext.gl == null)
            {
                if (!imageReady)
                {
                    return;
                }
                renderContext.Device.Save();

                renderContext.WVP.ProjectArrayToScreen(worldList, transformedList);
                CanvasContext2D ctx = renderContext.Device;
                ctx.Alpha = .4;

                double width  = renderContext.Width;
                double height = renderContext.Height;

                Vector3d viewPoint = Vector3d.MakeCopy(renderContext.ViewPoint);

                double scaleFactor = renderContext.FovScale / 100;
                foreach (DataItem item in items)
                {
                    // todo filter by date

                    // if (Vector3d.Dot(viewPoint, item.Location) < 0)
                    if (item.Tranformed.Z < 1)
                    {
                        double x    = item.Tranformed.X;
                        double y    = item.Tranformed.Y;
                        double size = .1 * item.Size / scaleFactor;
                        double half = size / 2;
                        if (x > -half && x < width + half && y > -half && y < height + half)
                        {
                            //ctx.DrawImage(starProfile, x - size / 2, y - size / 2, size, size);

                            ctx.BeginPath();
                            // ctx.FillStyle = "rgb(200,0,0)";
                            ctx.FillStyle = item.Color.ToFormat();
                            ctx.Arc(x, y, size, 0, Math.PI * 2, true);
                            ctx.Fill();
                        }
                    }
                }

                renderContext.Device.Restore();
            }
            else
            {
                Vector3d zero   = new Vector3d();
                Matrix3d matInv = Matrix3d.MultiplyMatrix(renderContext.World, renderContext.View);
                matInv.Invert();
                Vector3d cam = Vector3d.TransformCoordinate(zero, matInv);

                foreach (TimeSeriesPointVertexBuffer pointBuffer in pointBuffers)
                {
                    TimeSeriesPointSpriteShader.Use(
                        renderContext, pointBuffer.VertexBuffer, starTexture.Texture2d,
                        Color.FromArgb(255 * opacity, 255, 255, 255), DepthBuffered, (float)(this.JNow),
                        this.TimeSeries ? (float)Decay : 0, cam, (float)(scale * (renderContext.Height / 960)), MinSize, ShowFarSide, Sky
                        );

                    renderContext.gl.drawArrays(GL.POINTS, 0, pointBuffer.Count);
                }

                // renderContext.gl.disable(0x8642);
            }
        }