Esempio n. 1
0
 public CgImageCache(IGraphicsInfra infra, IImage image, bool linear = false)
 {
     this.image = image;
     this.infra = infra;
     format     = linear ? Format.Rgba8 : Format.Srgb8Alpha8;
     isDirty    = true;
 }
Esempio n. 2
0
 public OffScreenContainer(IGraphicsInfra infra, IEventRoutingService eventRoutingService)
 {
     this.infra = infra;
     dict       = new Dictionary <Pair <object>, DictItem>();
     deathNote  = new List <Pair <object> >();
     eventRoutingService.Subscribe <INewFrameEvent>(typeof(OffScreenContainer), nameof(Update), Update);
 }
Esempio n. 3
0
        public unsafe HighlightDrawer(IGraphicsInfra infra, IBlurDrawer blurDrawer, IQuadDrawer quadDrawer, IBleedDrawer bleedDrawer, IOffScreenContainer offScreenContainer)
        {
            this.infra              = infra;
            this.blurDrawer         = blurDrawer;
            this.quadDrawer         = quadDrawer;
            this.bleedDrawer        = bleedDrawer;
            this.offScreenContainer = offScreenContainer;

            #region Shader Text
            const string vertexShaderText =
                @"#version 150
in vec4 in_position;

void main()
{
    gl_Position = in_position;
}
";

            const string fragmentShaderText =
                @"#version 150
out vec4 out_color;

void main()
{
    out_color = vec4(1, 1, 1, 1);
}
";
            #endregion

            var vs = infra.GlContext.Create.VertexShader(vertexShaderText);
            var fs = infra.GlContext.Create.FragmentShader(fragmentShaderText);
            program = infra.GlContext.Create.Program(new ShaderProgramDescription
            {
                VertexShaders        = vs.EnumSelf(),
                FragmentShaders      = fs.EnumSelf(),
                VertexAttributeNames = new[] { "in_position" }
            });

            var vertices = new[]
            {
                new Vector4(-1, 1, 0.5f, 1),
                new Vector4(-1, -1, 0.5f, 1),
                new Vector4(1, 1, 0.5f, 1),
                new Vector4(1, -1, 0.5f, 1)
            };

            IBuffer vb;

            fixed(Vector4 *pVertices = vertices)
            vb = infra.GlContext.Create.Buffer(BufferTarget.Array, vertices.Length * sizeof(Vector4), BufferUsageHint.StaticDraw, (IntPtr)pVertices);

            vao = infra.GlContext.Create.VertexArray();
            vao.SetVertexAttributeF(0, vb, VertexAttributeDimension.Four, VertexAttribPointerType.Float, false, sizeof(Vector4), 0);

            drawSpotFramebuffer = infra.GlContext.Create.Framebuffer();
        }
Esempio n. 4
0
 public Ogl3TextureImage(ResourceVolatility volatility, IGraphicsInfra infra, IntSize2 size, bool hasTransparency)
     : base(volatility)
 {
     this.infra      = infra;
     Size            = size;
     HasTransparency = hasTransparency;
     // todo: to sRGB format
     GlTexture = infra.GlContext.Create.Texture2D(size.Width, size.Height,
                                                  GraphicsHelper.TextureMipCount(size.Width, size.Height), Format.Srgb8Alpha8);
 }
Esempio n. 5
0
        public RenderingRuntime(IGraphicsInfra infra, ISceneRendererPool sceneRendererPool, IOffScreenContainer offScreenContainer)
        {
            this.infra                 = infra;
            this.sceneRendererPool     = sceneRendererPool;
            this.offScreenContainer    = offScreenContainer;
            offScreenCacheDeathNote    = new List <object>();
            sceneRendererSettingsCache = new Dictionary <Tuple3 <bool>, IPropertyBag>();

            glContext      = infra.GlContext;
            rttFramebuffer = glContext.Create.Framebuffer();
        }
 public SceneRendererFactory(IGraphicsInfra infra, ISkyboxDrawer skyboxDrawer,
                             IVisualElementHandlerContainer handlerContainer, IBlurDrawer blurDrawer,
                             ISketchDrawer sketchDrawer, IVeilDrawer veilDrawer, IHighlightDrawer highlightDrawer)
 {
     this.infra            = infra;
     this.skyboxDrawer     = skyboxDrawer;
     this.handlerContainer = handlerContainer;
     this.blurDrawer       = blurDrawer;
     this.sketchDrawer     = sketchDrawer;
     this.veilDrawer       = veilDrawer;
     this.highlightDrawer  = highlightDrawer;
 }
Esempio n. 7
0
        public SceneRenderer(IGraphicsInfra infra, ISkyboxDrawer skyboxDrawer, 
            IVisualElementHandlerContainer handlerContainer, IBlurDrawer blurDrawer, 
            ISketchDrawer sketchDrawer, IVeilDrawer veilDrawer, IHighlightDrawer highlightDrawer)
        {
            this.infra = infra;
            this.skyboxDrawer = skyboxDrawer;
            this.handlerContainer = handlerContainer;
            this.blurDrawer = blurDrawer;
            this.sketchDrawer = sketchDrawer;
            this.veilDrawer = veilDrawer;
            this.highlightDrawer = highlightDrawer;

            regularQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            focusedQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            overlayQueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            opaqueSubqueue= new List<Pair<RenderQueueItem, IVisualElementHandler>>();
            transparentSubqueue= new List<Tuple3<RenderQueueItem, IVisualElementHandler, float>>();
        }
Esempio n. 8
0
 public RawDataResCache(IGraphicsInfra infra, IRawDataResource rawDataResource)
 {
     this.infra           = infra;
     this.rawDataResource = rawDataResource;
     dirty = true;
 }
Esempio n. 9
0
 public OffScreen(IGraphicsInfra infra)
 {
     this.infra         = infra;
     Framebuffer        = infra.GlContext.Create.Framebuffer();
     resolveFramebuffer = infra.GlContext.Create.Framebuffer();
 }
Esempio n. 10
0
 public SkyboxCache(IGraphicsInfra infra, ISkybox skybox)
 {
     this.skybox = skybox;
     this.infra  = infra;
     isDirty     = true;
 }
Esempio n. 11
0
 public VertexSetCache(IGraphicsInfra infra, IFlexibleModelVertexSet vertexSet)
 {
     this.infra     = infra;
     this.vertexSet = vertexSet;
     dirty          = true;
 }
Esempio n. 12
0
 public ExplicitModelCache(IGraphicsInfra infra, IExplicitModel model)
 {
     this.infra = infra;
     this.model = model;
     dirty      = true;
 }
 public ModelVisualElementHandler(IGraphicsInfra infra, ICommonObjects commonObjects, ISamplerCache samplerCache)
 {
     this.infra         = infra;
     this.commonObjects = commonObjects;
     this.samplerCache  = samplerCache;
 }
Esempio n. 14
0
 public DictItem(IGraphicsInfra infra)
 {
     OffScreen = new OffScreen(infra);
 }