/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public StatePart Create(StatePartTypeEnum type, BinaryReader reader) { StatePart part = null; switch (type) { case StatePartTypeEnum.GAME_OBJECT: part = new GameObjectPart(); break; case StatePartTypeEnum.MOVABLE_ENTITY: part = new MovableEntityPart(); break; case StatePartTypeEnum.COMBAT_ENTITY: part = new CombatEntityPart(); break; case StatePartTypeEnum.HERO_ENTITY: part = new HeroEntityPart(); break; case StatePartTypeEnum.PHYSIC_OBJECT: part = new PhysicObjectPart(); break; default: throw new ArgumentException("unknow state part type id : " + type); } try { part.FromNetwork(reader); } catch (Exception e) { throw new StatePartDeserializationException("unable to deserialize part : " + part.Type, e); } return(part); }
/// <summary> /// given color and depth textures, render them. /// </summary> public static RenderPass CreateRenderTextureToBuffer( TextureBase source, TextureBase depth_source, IValueProvider<Vector2> viewportSize, Action<GameWindow> beforeState, Action<GameWindow> beforeRender, params StatePart[] stateParts ) { //TODO: BUG see System21.State.cs: line 351. Order of states has also some influence var states = new StatePart[]{ new TextureBindingSet ( new TextureBinding { VariableName = "source_texture", Texture = source }, new TextureBinding { VariableName = "depth_texture", Texture = depth_source } ) }; states = stateParts.Concat(states).ToArray(); return CreateFullscreenQuad ( "rendertexture", "RenderPassFactory", viewportSize, beforeState, beforeRender, states); }
/// <summary> /// /// </summary> /// <param name="part"></param> public void AddPart(StatePart part) => m_parts.Add(part);