Ejemplo n.º 1
0
        public void polylineBegin(int contextId, bool closed)
        {
            Render.Context context = getContext(contextId);

            context.lineRenderer = lineRenderer;
            context.lineRenderer.begin(context, closed);
        }
Ejemplo n.º 2
0
        public void begin(Context context, bool isClosed)
        {
            this.context = context;
            this.isClosed = isClosed;
            miterLimit = context.miterLimit;
            //float det = Math.Sqrt(Math.Abs(context.transform.m00 * context.transform.m11 -
            //              context.transform.m01 * context.transform.m10));
            float det = (float)Math.Sqrt(Math.Abs(context.transform.Elements[0] * context.transform.Elements[3] -
                                            context.transform.Elements[1] * context.transform.Elements[2]));
            float a = det * context.lineWidth / 2.0f;

            width = context.lineWidth / 2.0f * (a + 0.1f) / a;
            minu = 0.25f;
            maxu = 0.25f + (a + 0.5f) / 2.0f;
            rendererCallback = context.vertexRenderer;
            rendererCallback.Transform = context.transform;

            count = 0;
            color = context.color;
            closeStroke = false;

            //if (lineEdgeTexture == 0)
            createEdgeTexture();
            //	if(lineDashTexture == 0)
            createDashTexture();
            dashPhase = context.lineDashPhase;
        }
Ejemplo n.º 3
0
        public void tessEnd(int context)
        {
            Glu.gluTessNormal(0, 0, 1);
            Glu.gluTessEndPolygon();

            Render.Context cntxt = getContext(context);
            cntxt.vertexRenderer.EndBlock();
        }
Ejemplo n.º 4
0
        public void drawSurface(int contextId)
        {
            Render.Context context = getContext(contextId);


#if PENDING
            ENTER(Java_scenic_jni_Renderer_drawSurface);

            Context * context = getContext(contextId);
            int       diffuse = context->color.getRGBA32();
            ClipArea *surface;
            VertexStore vs(VSF_TEX1, context, 0);

            context->setPrimitives(0);

            surface       = context->clip;
            context->clip = context->clip->parent;
            context->setRenderTarget(context->clip->surface);
            surface->surface->release();
            surface->surface = NULL;

            for (int y = 0; y < 2; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    double lx  = surface->x + x * surface->width;
                    double ly  = surface->y + y * surface->height;
                    double tx1 = (float)x / surface->textureWidth * surface->width;
                    double ty1 = (float)y / surface->textureHeight * surface->height;

                    vs.addVertex(lx, ly, diffuse, tx1, ty1);
                }
            }

            vs.addTriangle(0, 1, 2);
            vs.addTriangle(3, 2, 1);

            context->device->setTexture(0, surface->texture);
            context->device->setSamplerStates(0, FILTER_POINT, ADDRESS_CLAMP);
            context->device->setTextureStageModulation(0, surface->getModulation());
            context->device->setBlendFunc(BLEND_ONE, BLEND_ONE_MINUS_SRC_ALPHA);
            if (surface->linearColorSpace && !context->clip->linearColorSpace)
            {
                context->device->setState(STATE_SRGBWRITEENABLE, BOOLEAN_TRUE);
            }

            vs.draw();

            context->device->setTexture(0, NULL);
            context->device->setState(STATE_SRGBWRITEENABLE, BOOLEAN_FALSE);

            textureCache.addTexture(surface->texture);
            delete surface;
#endif
        }
Ejemplo n.º 5
0
        // Tesselerator
        public void tessBegin(int context)
        {
            Render.Context cntxt = getContext(context);
            cntxt.vertexRenderer.BeginBlock();
            GLUtessellatorCallback callback = new MogreTessellationCallbacks(null);

            Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
            Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
            Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
            Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
            Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
            Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
            Glu.gluTessBeginPolygon(null);
        }
Ejemplo n.º 6
0
 public void color(int contextId, ScenicColor pcolor)
 {
     Render.Context context = getContext(contextId);
     context.color = pcolor;
 }
Ejemplo n.º 7
0
        public int beginSurface(int contextId, int x, int y, int width, int height, int type)
        {
            throw new NotImplementedException();

#if PENDING
            Render.Context context = getContext(contextId);
            ClipArea       clip    = new ClipArea();

            clip.parent           = context.clip;
            clip.x                = max(context.clip.x, x);
            clip.y                = max(context.clip.y, y);
            clip.width            = min(context.clip.x + context.clip.width, x + width) - clip.x;
            clip.height           = min(context.clip.y + context.clip.height, y + height) - clip.y;
            clip.type             = type;
            clip.texture          = 0;
            clip.offsetX          = clip.x;
            clip.offsetY          = clip.y;
            clip.linearColorSpace = clip.parent.linearColorSpace;

            if (clip.width < 1 || clip.height < 1)
            {
                delete clip;

                return(0);
            }

            context.clip = clip;
            context.setPrimitives(0);

            Texture oldTexture = textureCache.getTexture(clip.width, clip.height);
            int     w = 0, h = 0;

            if (oldTexture && !oldTexture.contentsLost() &&
                oldTexture.getWidth() >= clip.width &&
                oldTexture.getHeight() >= clip.height)
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.1);
                clip.texture       = oldTexture;
                oldTexture         = 0;
                clip.textureWidth  = clip.texture.getWidth();
                clip.textureHeight = clip.texture.getHeight();
            }
            if (oldTexture)
            {
                w = oldTexture.getWidth();
                h = oldTexture.getHeight();
                oldTexture.release();
                oldTexture = 0;
            }
            if (!clip.texture)
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.2);
                w = max(clip.width, w + 100);
                h = max(clip.height, h + 100);

                // Some graphics cards (GeForce 2 - 4) do not support small render targets
                if (w < 16)
                {
                    w = 16;
                }
                if (h < 16)
                {
                    h = 16;
                }

                Console.WriteLine("Create temporary surface (width=%d, height=%d)\n", w, h);
                clip.texture = new Texture(w, h, FMT_A8R8G8B8, USAGE_RENDER_TARGET);
                if (!clip.texture)
                {
                    Console.WriteLine("Device::createTexture failed\n");

                    return(0);
                }
                clip.textureWidth  = w;
                clip.textureHeight = h;
            }
            {
                //ENTER(Java_scenic_jni_Renderer_beginSurface.3);
                clip.surface = clip.texture.getSurface(0);
                context.setRenderTarget(clip.surface);
                RGBAFloat color;

                color.red = color.green = color.blue = color.alpha = 0.0;

                context.device.clear(color, NULL);
            }

            return(1);
#endif
            return(0);
        }
Ejemplo n.º 8
0
 public void polylinePoint(int contextId, float x, float y)
 {
     Render.Context        context = getContext(contextId);
     System.Drawing.PointF p       = new System.Drawing.PointF(x, y);
     context.lineRenderer.addPoint(p);
 }
Ejemplo n.º 9
0
 public void polylineEnd(int contextId)
 {
     Render.Context context = getContext(contextId);
     context.lineRenderer.end();
 }