Beispiel #1
0
 private void AddDefaultRenderers(Func <RenderContext, bool> renderCallback)
 {
     Renderers.Add(new StandardShadowMapRenderer(renderCallback));
     Renderers.Add(new CubeMapShadowMapRenderer(renderCallback));
     Renderers.Add(new CascadedShadowMapRenderer(renderCallback));
     Renderers.Add(new CompositeShadowMapRenderer(Renderers));
 }
Beispiel #2
0
 private void RendererDiscoverer_ItemAdded(object sender, RendererDiscovererItemAddedEventArgs e)
 {
     if (!Renderers.Contains(e.RendererItem))
     {
         Renderers.Add(e.RendererItem);
     }
 }
Beispiel #3
0
        public RogueskivRenderer(
            UxContext uxContext,
            IGameContext gameContext,
            RogueskivGame game,
            IRogueskivUxConfig uxConfig,
            IRogueskivGameConfig gameConfig
            ) : base(uxContext, game)
        {
            RogueskivGame      = game;
            UxContext          = uxContext;
            UxConfig           = uxConfig;
            PlayerPositionComp = game.Entities.GetSingleComponent <PlayerComp, CurrentPositionComp>();

            var font = uxContext.GetFont(uxConfig.FontFile, FONT_SIZE);

            BoardTexture = uxContext.GetTexture("board.png");

            var bgrRenderer = new BgrRenderer(uxContext, new Size(1920, 1440));

            Renderers.Add(bgrRenderer);
            Renderers.Add(new BoardRenderer(uxContext, game, BoardTexture));

            CompRenderers[typeof(FoodComp)]        = new FoodRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(TorchComp)]       = new TorchRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(MapRevealerComp)] = new MapRevealerRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(AmuletComp)]      = new AmuletRenderer(this, uxContext, game, BoardTexture);
            CompRenderers[typeof(EnemyComp)]       = new EnemyRenderer(uxContext, game);
            CompRenderers[typeof(FOVComp)]         = new FOVRenderer(uxContext);
            CompRenderers[typeof(PlayerComp)]      = new PlayerRenderer(uxContext, game, gameConfig.PlayerRadius);
            CompRenderers[typeof(HealthComp)]      = new HealthRenderer(uxContext);
            CompRenderers[typeof(TimerComp)]       = new GameInfoRenderer(
                uxContext,
                gameContext,
                font,
                game.Floor,
                inGameTimeVisible: gameConfig.InGameTimeVisible,
                realTimeVisible: gameConfig.RealTimeVisible
                );
            CompRenderers[typeof(PopUpComp)] = new PopUpRenderer(uxContext, game, font);

            PlayerMovementEffectPlayer = new PlayerMovementEffectPlayer(uxContext, game);
            EffectPlayers.Add(new BounceEffectPlayer(uxContext, game));
            EffectPlayers.Add(new TorchPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new MapRevealerPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new FoodPickedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new WinEffectPlayer(uxContext, game));
            EffectPlayers.Add(new EnemyCollidedEffectPlayer(uxContext, game));
            EffectPlayers.Add(new StairsUpEffectPlayer(uxContext, game));
            EffectPlayers.Add(new StairsDownEffectPlayer(uxContext, game));
            EffectPlayers.Add(new DeathEffectPlayer(uxContext, game));
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LightRenderer"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public LightRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            {
                throw new ArgumentNullException("graphicsService");
            }

            Renderers.Add(new AmbientLightRenderer(graphicsService));
            Renderers.Add(new ImageBasedLightRenderer(graphicsService));
            Renderers.Add(new DirectionalLightRenderer(graphicsService));
            Renderers.Add(new PointLightRenderer(graphicsService));
            Renderers.Add(new ProjectorLightRenderer(graphicsService));
            Renderers.Add(new SpotlightRenderer(graphicsService));
        }
        public RogueskivMenuRenderer(UxContext uxContext, RogueskivMenu game, string fontFile)
            : base(uxContext, game)
        {
            var titleFont = uxContext.GetFont(fontFile, TITLE_FONT_SIZE);
            var menuFont  = uxContext.GetFont(fontFile, MENU_FONT_SIZE);
            var smallFont = uxContext.GetFont(fontFile, SMALL_FONT_SIZE);

            Renderers.Add(new TitleRenderer(uxContext, titleFont, smallFont));
            Renderers.Add(new InstructionsRenderer(uxContext, smallFont));
            Renderers.Add(new ControlsInfoRenderer(uxContext, game, smallFont));
            Renderers.Add(new CustomSeedInputRenderer(uxContext, game, smallFont));
            CompRenderers[typeof(MenuOptionComp)] = new MenuOptionRenderer(uxContext, game, menuFont);
            CompRenderers[typeof(StatsComp)]      = new StatsRenderer(uxContext, smallFont);
        }
Beispiel #6
0
        public Renderer AddRenderer(Renderer renderer)
        {
            if (renderer == null)
            {
                throw new System.ArgumentNullException("renderer");
            }

            if (!Renderers.Contains(renderer))
            {
                Renderers.Add(renderer);
                renderer.RecalculateProjection();
            }

            return(renderer);
        }
Beispiel #7
0
        internal static void InitializeShaders()
        {
            Renderers.Add("Standard", new RendererStandard());
            Renderers.Add("Shadow", new RendererShadow());
            Renderers.Add("Bloom", new RendererBloom());
            Renderers.Add("Explosion", new RendererExplosion());
            Renderers.Add("Background", new RendererBackground());
            Renderers.Add("Skybox", new RendererSkybox());
            Renderers.Add("Particle", new RendererParticle());
            Renderers.Add("Terrain", new RendererTerrain());
            Renderers.Add("HUD", new RendererHUD());
            Renderers.Add("Merge", new RendererMerge());

            RendererSimple = new RendererSimple();
            RendererPBR    = new RendererStandardPBR();
        }
Beispiel #8
0
 public void AttachComponents(params IMComponent[] components)
 {
     foreach (var component in components)
     {
         component.SetOwnerNode(this);
         _components.Add(component);
         if (component is IRenderer rend)
         {
             Renderers.Add(rend);
         }
     }
     foreach (var component in _components)
     {
         component.Initialize();
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ShadowMaskRenderer"/> class with the specified
        /// number of shadow masks.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <param name="maxNumberOfShadowMasks">The max number of shadow masks.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="maxNumberOfShadowMasks"/> is negative or greater than 255.
        /// </exception>
        public ShadowMaskRenderer(IGraphicsService graphicsService, int maxNumberOfShadowMasks)
        {
            if (graphicsService == null)
            {
                throw new ArgumentNullException("graphicsService");
            }

            _graphicsService         = graphicsService;
            _lightNodes              = new List <LightNode>();
            MaxNumberOfShadowsMasks  = maxNumberOfShadowMasks;
            UpsampleDepthSensitivity = 1000;

            Renderers.Add(new StandardShadowMaskRenderer(graphicsService));
            Renderers.Add(new CubeMapShadowMaskRenderer(graphicsService));
            Renderers.Add(new CascadedShadowMaskRenderer(graphicsService));
            Renderers.Add(new CompositeShadowMaskRenderer(graphicsService, Renderers));
        }
        void Start()
        {
            player = GameObject.Find("PLAYER");

            Renderers = GetChildRenderers(gameObject);
            Lights    = GetChildLights(gameObject);

            Renderer thisRenderer = gameObject.GetComponent <Renderer>();

            if (thisRenderer != null)
            {
                Renderers.Add(thisRenderer);
            }

            if (Renderers != null || Renderers.Count == 0)
            {
                InvokeRepeating("Toggle", MopOcclusionCoreSettings.OcclusionSampleDelay, MopOcclusionCoreSettings.OcclusionSampleDelay);
                StartCoroutine(WaitForHideDelayCalculation());
            }

            IsVisible = true;
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SkyRenderer"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public SkyRenderer(IGraphicsService graphicsService)
        {
            if (graphicsService == null)
            {
                throw new ArgumentNullException("graphicsService");
            }

            if (graphicsService.GraphicsDevice.GraphicsProfile == GraphicsProfile.Reach)
            {
                Renderers.Add(new SkyboxRendererInternal(graphicsService));
            }
            else
            {
                Renderers.Add(new SkyboxRendererInternal(graphicsService));
                Renderers.Add(new StarfieldRenderer(graphicsService));
                Renderers.Add(new SkyObjectRenderer(graphicsService));
                Renderers.Add(new GradientSkyRenderer(graphicsService));
                Renderers.Add(new GradientTextureSkyRenderer(graphicsService));
                Renderers.Add(new ScatteringSkyRenderer(graphicsService));
                Renderers.Add(new CloudLayerRenderer(graphicsService));
            }
        }
Beispiel #12
0
            public void Push(SkinnedMeshRenderer renderer)
            {
                var mesh = renderer.sharedMesh;

                if (mesh == null)
                {
                    Debug.LogWarningFormat("{0} has no mesh", renderer.name);
                    return;
                }

                Renderers.Add(renderer);

                var indexOffset     = Positions.Count;
                var boneIndexOffset = Bones.Count;

                Positions.AddRange(mesh.vertices);
                Normals.AddRange(mesh.normals);
                UV.AddRange(mesh.uv);
                Tangents.AddRange(mesh.tangents);

                if (mesh.vertexCount == mesh.boneWeights.Length)
                {
                    BoneWeights.AddRange(mesh.boneWeights.Select(x => AddBoneIndexOffset(x, boneIndexOffset)).ToArray());
                }
                else
                {
                    BoneWeights.AddRange(Enumerable.Range(0, mesh.vertexCount).Select(x => new BoneWeight()).ToArray());
                }

                BindPoses.AddRange(mesh.bindposes);
                Bones.AddRange(renderer.bones);

                for (int i = 0; i < mesh.subMeshCount; ++i)
                {
                    var indices = mesh.GetIndices(i).Select(x => x + indexOffset);
                    var mat     = renderer.sharedMaterials[i];
                    var sameMaterialSubMeshIndex = SubMeshes.FindIndex(x => ReferenceEquals(x.Material, mat));
                    if (sameMaterialSubMeshIndex >= 0)
                    {
                        SubMeshes[sameMaterialSubMeshIndex].Indices.AddRange(indices);
                    }
                    else
                    {
                        SubMeshes.Add(new SubMesh
                        {
                            Indices  = indices.ToList(),
                            Material = mat,
                        });
                    }
                }

                for (int i = 0; i < mesh.blendShapeCount; ++i)
                {
                    var positions = (Vector3[])mesh.vertices.Clone();
                    var normals   = (Vector3[])mesh.normals.Clone();
                    var tangents  = mesh.tangents.Select(x => (Vector3)x).ToArray();

                    mesh.GetBlendShapeFrameVertices(i, 0, positions, normals, tangents);
                    BlendShapes.Add(new BlendShape
                    {
                        VertexOffset = indexOffset,
                        FrameWeight  = mesh.GetBlendShapeFrameWeight(i, 0),
                        Name         = mesh.GetBlendShapeName(i),
                        Positions    = positions,
                        Normals      = normals,
                        Tangents     = tangents,
                    });
                }
            }
Beispiel #13
0
 /// <summary>
 /// Add a renderer.
 /// </summary>
 /// <param name="renderer"></param>
 public void AddRow(RenderableElement renderer)
 {
     Renderers.Add(renderer);
 }
Beispiel #14
0
 /// <summary>
 /// Adds the specified scene renderer.
 /// </summary>
 /// <param name="sceneRenderer">The scene renderer.</param>
 public void Add(ISceneRenderer sceneRenderer)
 {
     Renderers.Add(sceneRenderer);
 }
Beispiel #15
0
 public void RegisterRenderer(IExecutableHandler handler)
 {
     Renderers.Add(handler);
 }
Beispiel #16
0
 /// <summary>
 /// Shortcut function to remove a Renderer from the Renderer list
 /// </summary>
 /// <param name="renderer">The Renderer to remove</param>
 public void Remove(Renderer renderer)
 {
     Renderers.Add(renderer);
 }
Beispiel #17
0
 /// <summary>
 /// Shortcut function to add a Renderer to the Renderer list
 /// </summary>
 /// <param name="renderer">The Renderer to add</param>
 public void Add(Renderer renderer)
 {
     Renderers.Add(renderer);
 }
 public TypeScriptCodeGenerator()
 {
     Renderers.Add(new EnumRenderer());
     Renderers.Add(new ObjectRenderer());
     Renderers.Add(new ServiceRenderer());
 }
Beispiel #19
0
 public CSharpCodeGenerator()
 {
     Renderers.Add(new EnumRenderer());
     Renderers.Add(new ObjectRenderer());
     Renderers.Add(new ServiceRenderer());
 }