Ejemplo n.º 1
0
 internal RegionRenderForm(Vegas Vegas, RenderSet RenderSet)
 {
     myVegas    = Vegas;
     _renderSet = RenderSet;
     InitializeComponent();
     Init();
 }
Ejemplo n.º 2
0
 public Drawable(RenderSet render_set)
 {
     _RenderSet = render_set;
     if(_RenderSet != null)
         _RenderSet.Add(this);
     RenderSetTransfer += HandlerenderSetTransfer;
 }
Ejemplo n.º 3
0
 // Main constructor:
 public BooleanIndicator(RenderSet render_set, double x, double y)
     : base(render_set, x, y, 1.0, 1.0, null, Texture.Get("sprite_indicator"))
 {
     State = false;
     _Color = new Color4(Color.SkyBlue);
     _NextLayer = new LayeredSprite(render_set, x, y, 1.0, 1.0, null, Texture.Get ("sprite_indicator_gloss"));
 }
Ejemplo n.º 4
0
		internal RegionRenderForm(Vegas Vegas, RenderSet RenderSet)
		{
			myVegas = Vegas;
			_renderSet = RenderSet;
			InitializeComponent();
			Init();
		}
Ejemplo n.º 5
0
 public HUDQuad(RenderSet render_set, Vector3d p, Vector3d s)
     : this(render_set, p,
          p + new Vector3d(s.X, 0.0, 0.0),
          p + new Vector3d(s.X, s.Y, 0.0),
          p + new Vector3d(0.0, s.Y, 0.0))
 {
 }
Ejemplo n.º 6
0
 public TileMap(RenderSet render_set, int countx, int county, Texture texture)
     : base(render_set)
 {
     _CountX = countx;
     _CountY = county;
     Texture = texture;
     IndexMap = new int[_CountX,_CountY];
 }
Ejemplo n.º 7
0
 public HUDQuad(RenderSet render_set, Vector3d a, Vector3d b, Vector3d c, Vector3d d)
 {
     A = a;
     B = b;
     C = c;
     D = d;
     render_set.Add(this);
 }
Ejemplo n.º 8
0
        protected void Start()
        {
            if (mesh == null)
            {
                Debug.LogError("[SampleController] No 'mesh' provided"); return;
            }
            if (material == null)
            {
                Debug.LogError("[SampleController] No 'material' provided"); return;
            }

            //Allocate arrays
            cubeData      = new CubeData[cubeCount];
            bucketedCubes = new BucketSet <CubeData>(bucketCount: avoidanceBucketCount, maxBucketSize: avoidanceMaxBucketSize);
            renderSet     = new RenderSet(mesh, material, maxBatches: Mathf.CeilToInt(cubeCount / 1023f));

            //Create misc stuff
            int numExecutors = useMultiThreading ? (System.Environment.ProcessorCount - 1) : 0;

            Debug.Log(string.Format("[SampleController] Staring 'TaskManager' with '{0}' executors", numExecutors));
            taskManager     = new TaskManager(numExecutors);
            avoidanceHasher = new PositionHasher();
            random          = new ShiftRandomProvider();

            //Create tasks
            startTask          = new StartFrameTask();
            bucketCubeTask     = new BucketCubeTask(bucketedCubes, avoidanceHasher);
            moveCubeTask       = new MoveCubeTask(avoidanceHasher, bucketedCubes);
            respawnCubeTask    = new RespawnCubeTask(random);
            addToRenderSetTask = new AddToRenderSetTask(renderSet);

            //Setup profiler timeline
            if (profiler != null)
            {
                completeProfilerTrack       = profiler.CreateTrack <TimelineTrack>("Blocking main-thread to complete tasks");
                renderProfilerTrack         = profiler.CreateTrack <TimelineTrack>("Render instanced");
                bucketCubesProfilerTrack    = profiler.CreateTrack <TaskTimelineTrack>("Bucket cubes");
                moveCubesProfilerTrack      = profiler.CreateTrack <TaskTimelineTrack>("Move cubes");
                respawnCubesProfilerTrack   = profiler.CreateTrack <TaskTimelineTrack>("Respawn cubes");
                addToRenderSetProfilerTrack = profiler.CreateTrack <TaskTimelineTrack>("Creating render batches");
                profiler.StartTimers();
            }

            //Setup initial data
            Rect spawnArea = MathUtils.FromCenterAndSize(Vector2.zero, spawnAreaSize);

            for (int i = 0; i < cubeCount; i++)
            {
                cubeData[i] = new CubeData
                {
                    ID                = i,
                    Position          = random.Inside(spawnArea),
                    TimeNotHitTarget1 = 999f,
                    TimeNotHitTarget2 = 999f
                }
            }
            ;
        }
Ejemplo n.º 9
0
Archivo: Line.cs Proyecto: qwook/hungry
 public Line(Vector3d start, Vector3d end, float thickness, RenderSet render_set)
     : base(render_set)
 {
     _Position = start;
     _Direction = end;
     Color = Color.Black;
     Thickness = thickness;
     InitPhysics();
 }
Ejemplo n.º 10
0
 public Drawable(RenderSet render_set)
 {
     _RenderSet = render_set;
     if(_RenderSet != null)
         _RenderSet.Add(this);
     RenderSetTransfer += (object sender, RenderSetChangeEventArgs e) => {
         this._RenderSet = e.To;
     };
 }
Ejemplo n.º 11
0
 public Spidey(RenderSet render_set, double x, double y)
     : base(render_set, x, y, Texture.Get ("sprite_spidey_0"))
 {
     if (Body != null) {
         Body.OnCollision += HandleOnCollision;
         Body.BodyType = BodyType.Dynamic;
     }
     JumpTimer.Start();
 }
Ejemplo n.º 12
0
 protected ProjectileSwitch(RenderSet render_set, double x, double y,
                        ActionEventHandler state_changed,
                        SharedState<SwitchState> state,
                        SharedState<double> latch_expiration,
                        Stopwatch latch_timer, double latch_time)
     : base(render_set, x, y, state_changed, state, latch_expiration, latch_timer, latch_time, Texture.Get("sprite_projectile_switch"))
 {
     Theta = 0.0;
 }
Ejemplo n.º 13
0
 public BlueprintLine(Vector3d a, Vector3d b, RenderSet render_set, int millis)
 {
     RenderSet = render_set;
     RenderSet.Add(this);
     Lifespan = millis;
     A = a;
     B = b;
     Timer.Start();
 }
Ejemplo n.º 14
0
    private void Init()
    {
        //renderSetDict = new Dictionary<Renderer, RenderSet>();
        //renderSetList = new List<RenderSet>();
        // isCullList = new List<bool>();
        renderList = new List <RenderSet>();


        if (!registRenderSetManually)
        {
            Renderer[] renders = GameObject.FindObjectsOfType <Renderer>();

            for (int i = 0; i < renders.Length; ++i)
            {
                Texture2D     baseMap    = renders[i].sharedMaterial.GetTexture("_MainTex") as Texture2D;
                RenderTexture prevRender = new RenderTexture(baseMap ? baseMap.width / 2 : 1024, baseMap ? baseMap.height / 2 : 1024, 0);
                RenderTexture.active = prevRender;
                Graphics.Blit(baseMap, prevRender);
                RenderSet set;
                if (baseMap != null)
                {
                    set = new RenderSet()
                    {
                        render      = renders[i],
                        baseMap     = baseMap,
                        captureTex  = new RenderTexture(baseMap.width, baseMap.height, 0, RenderTextureFormat.ARGB32),
                        dilateMat   = globalDilateMat,
                        dilateTex   = new RenderTexture(baseMap.width, baseMap.height, 0, RenderTextureFormat.ARGB32),
                        sharedMat   = renders[i].sharedMaterial,
                        origBaseMap = baseMap,
                        prevTex     = baseMap,
                        prevRender  = prevRender,
                        meshF       = renders[i].GetComponent <MeshFilter>()
                    };
                }
                else
                {
                    set = new RenderSet()
                    {
                        render = renders[i],
                        //baseMap = null,
                        captureTex = new RenderTexture(1024, 1024, 0, RenderTextureFormat.ARGB32),
                        dilateMat  = globalDilateMat,
                        dilateTex  = new RenderTexture(1024, 1024, 0, RenderTextureFormat.ARGB32),
                        sharedMat  = renders[i].sharedMaterial,
                        prevRender = prevRender,
                        meshF      = renders[i].GetComponent <MeshFilter>()
                    };
                }

                //RenderCulling renderCull = new RenderCulling() { renderSet = set, isCull = false };
                //renderSetDict.Add(renders[i], set);
                renderList.Add(/*renderCull*/ set);
            }
        }
    }
        private void RenderObjectAt(Vector3[] Positions, Vector3 Direction, RenderSet Set)
        {
            Quaternion Rotation = Quaternion.identity;

            if (Direction != Vector3.zero)
            {
                Rotation = Quaternion.LookRotation(Direction);
            }                                                                                            // init rotation
            RenderObjectAt(Positions, Rotation, Set.gameObject.transform.localScale, Set);
        }
Ejemplo n.º 16
0
        public SpriteObject(RenderSet render_set, Texture texture)
            : base(render_set, texture)
        {
            _RenderSet = render_set;

            InitPhysics();
            // HACK: Positioning the body must occur after world
            // has been solved at least one time in order to avoid
            // fixtures being shifted rather than the bodies.
            _RenderSet.Scene.Game.WorldMain.Step (0.0f);

            RenderSetEntry += EnteredRenderSet; // Virtual default event handler
        }
Ejemplo n.º 17
0
        public Dialog(RenderSet render_set, string title, List<DialogStanza> stanzas)
            : base(null)
        {
            _Title = title;
            Stanzas = stanzas;
            _RenderSet = render_set;
            _Shown = false;
            ScaleX = _RenderSet.Scene.ViewSize.X;
            ScaleY = (int)(_RenderSet.Scene.ViewSize.Y * 0.25);
            FadeUp = Texture.Get("sprite_dialog_fade_up");

            SpeakerWriter = new PTextWriter(new Size((int)ScaleX, 24));
            SpeechWriter = new PTextWriter(new Size((int)ScaleX, (int)ScaleY - 24));
        }
Ejemplo n.º 18
0
		public void FromVegas(Vegas Vegas, String ScriptFile, XmlDocument ScriptSettings, ScriptArgs Args)
		{
			if (ArgsHasSetup(Args)) // config mode
			{
				RunSetup(Vegas);
			}
			else
			{
				var renderset = new RenderSet();
				var form = new RegionRenderForm(Vegas, renderset);

				if (DialogResult.OK != form.ShowDialog())
					return;
				//renderset.Render(Vegas);
			}
		}
Ejemplo n.º 19
0
        public void FromVegas(Vegas Vegas, String ScriptFile, XmlDocument ScriptSettings, ScriptArgs Args)
        {
            if (ArgsHasSetup(Args))             // config mode
            {
                RunSetup(Vegas);
            }
            else
            {
                var renderset = new RenderSet();
                var form      = new RegionRenderForm(Vegas, renderset);

                if (DialogResult.OK != form.ShowDialog())
                {
                    return;
                }
                //renderset.Render(Vegas);
            }
        }
Ejemplo n.º 20
0
        public SpriteBase(RenderSet render_set, double x, double y, double scalex, double scaley, Texture texture)
            : base(render_set)
        {
            // Size will scale _Texture width and height
            _Color = Color.White;
            _Scale.X = scalex;
            _Scale.Y = scaley;
            _TileX = 1.0;
            _TileY = 1.0;
            _AnimationFrameIndex = 0;
            _FrameTimer = new Stopwatch();
            _AnimationDefault = _AnimationCurrent = new SpriteAnimation(texture, 0);
            //_FrameStatic = _AnimationDefault.Frames[0];

            // Position for world objects is handled differently
            if(!(this is IWorldObject))
                Corner = new Vector3d(x, y, 0.0);
        }
Ejemplo n.º 21
0
        protected void RefillColorLinks()
        {
            _ColorLinks.Clear();              // clear color links

            Utils.RenderSet.Set[] Sets = RenderSet.Sets.ToArray();
            // add basic color links
            for (int i = 0; i < Sets.Length; i++)
            {
                Renderer Renderer = Sets [i].Renderer;
                if (Renderer.sharedMaterial != null && Renderer.sharedMaterial.HasProperty("_ColorMaskCount"))
                {
                    int count = Renderer.sharedMaterial.GetInt("_ColorMaskCount");

                    if (!ColorsFromMaterial)                       // get colors from material
                    {
                        MaterialPropertyBlock PropertyBlock = new MaterialPropertyBlock();
                        Renderer.GetPropertyBlock(PropertyBlock);
                        count = (int)PropertyBlock.GetFloat("_ColorMaskCount");
                    }

                    // add color links with a max of 4
                    if (count > 0)
                    {
                        _ColorLinks.Add(new ColorLink(RenderSet.GetRendererColor(i, "_MaskColor1"), RenderSet, i, ColorsFromMaterial, 0));                           // add color link 1
                    }
                    if (count > 1)
                    {
                        _ColorLinks.Add(new ColorLink(RenderSet.GetRendererColor(i, "_MaskColor2"), RenderSet, i, ColorsFromMaterial, 1));                           // add color link 2
                    }
                    if (count > 2)
                    {
                        _ColorLinks.Add(new ColorLink(RenderSet.GetRendererColor(i, "_MaskColor3"), RenderSet, i, ColorsFromMaterial, 2));                           // add color link 3
                    }
                }
            }
            _ColorLinks = _ColorLinks.CollapseLinks();              // collapse color links
        }
        public void Enter(List <object> GenData = null)
        {
            System = GenData.Find <ModularBuildingSystem> (true);            // create link to Modular building system
            var Getters = GenData.Find <System.Func <StrokeType, ModularPlacableObject>[]>(true);

            OriginSetData      = GenData.Find <ModularStrokeSetData>(true);
            OnCanceledCallback = GenData.Find <System.Action <object[]> >(true);          // set on cancle callback

            var PlacedDelete = GenData.Find <System.Action <ModularPlacableObject>[]> (true);

            OnPlaced              = PlacedDelete [0];
            OnDeleted             = PlacedDelete[1]; // set on cancle callback
            CanPlace              = GenData.Find <System.Func <int, bool> >(true);
            ModularInfoGetter     = Getters [0];
            ModularInstanceGetter = Getters [1];
            OriginPlacable        = (StrokeModularPiece)ModularInfoGetter(StrokeType.Straight);
            Distance              = OriginPlacable.Scale;

            // set renderset
            RenderSet      = OriginPlacable.RenderSet;
            CrossRenderSet = Management.GameManager.I.Modular.CrossPrefab.GetComponent <RenderSet> ();

            Init();
        }
Ejemplo n.º 23
0
 public SpriteObject(RenderSet render_set, SpriteObject relative_to, double x, double y, Texture texture)
     : this(render_set, x, y, texture)
 {
     Corner = new Vector3d(relative_to.CornerX + x, relative_to.CornerY + y, relative_to.PositionZ);;
 }
Ejemplo n.º 24
0
        // Main constructor:
        public Player(RenderSet render_set, double x, double y, Texture texture)
            : base(render_set, x, y, texture)
        {
            HealthChanged += (object sender, HealthChangedEventArgs e) => { _Health = Math.Max (0, e.HealthNow); };
            OnHealthChanged(this, _HealthMax);

            AnimationStand = 	new SpriteAnimation(texture, "protag standing");
            AnimationWalk  = 		new SpriteAnimation(texture, true, "protag walking 1", "protag walking 2", "protag walking 3", "protag walking 4");
            AnimationStationaryFw = new SpriteAnimation(texture, "protag standing facing front");
            AnimationWalkFw = 		new SpriteAnimation(texture, true, "protag walking front 1", "protag walking front 2", "protag walking front 3", "protag walking front 4");
            AnimationStationaryBk = new SpriteAnimation(texture, "protag standing back" );
            AnimationWalkBk = 		new SpriteAnimation(texture, true, "protag walking back 1", "protag walking back 2", "protag walking back 3", "protag walking back 4");

            AnimationCrouch =		new SpriteAnimation(texture, true, "protag crouch");
            AnimationCrawl =		new SpriteAnimation(texture, 150, true, "protag crouch walk 1", "protag crouch walk 2", "protag crouch walk 3", "protag crouch walk 4");

            AnimationPreJump = 		new SpriteAnimation(texture, "protag jumping 2");
            AnimationJumping = 		new SpriteAnimation(texture, "protag jumping 2");
            AnimationEndJump = 		new SpriteAnimation(texture, "protag jumping 4");

            AnimationAimGunFwd = 		new SpriteAnimation(texture, true, "protag aiming gun");
            AnimationAimGunFwdUp = 		new SpriteAnimation(texture, true, "protag aiming gun up");
            AnimationAimGunFwdDown = 	new SpriteAnimation(texture, true, "protag aiming gun down");
            AnimationAimGunFwdCrouch = 	new SpriteAnimation(texture, true, "protag aiming gun crouch");
            AnimationAimGunFwdJump = 	new SpriteAnimation(texture, true, "protag aiming gun jump");

            AnimationPreJump.Frames[0].FrameTime = 100;
            //AnimationPreJump.Frames[1].FrameTime = 50;

            AnimationEndJump.Frames[0].FrameTime = 200;

            _FrameTimer.Start ();
            JumpTimer.Start();
        }
Ejemplo n.º 25
0
 public Player(RenderSet render_set, Texture texture)
     : this(render_set, 0.0, 0.0, texture)
 {
 }
Ejemplo n.º 26
0
 public HealthMeter(RenderSet render_set, double x, double y, Player player)
     : base(render_set, x, y, Texture.Get("sprite_health_meter_atlas"))
 {
     _Player = player;
     player.HealthChanged += OnHealthChanged;
 }
Ejemplo n.º 27
0
Archivo: Door.cs Proyecto: qwook/hungry
 public Door(RenderSet render_set, double x, double y)
     : base(render_set, x, y, Texture.Get("sprite_doorway"))
 {
 }
 private void RenderObjectAt(Vector3 Position, Vector3 Direction, RenderSet Set)
 {
     RenderObjectAt(new Vector3[] { Position }, Direction, Set);
 }
Ejemplo n.º 29
0
 protected void HandlerenderSetTransfer(object sender, RenderSetChangeEventArgs e)
 {
     this._RenderSet = e.To;
 }
 private void RenderObjectAt(Vector3 Position, Quaternion Rotation, Vector3 Scale, RenderSet Set)
 {
     RenderObjectAt(new Vector3[] { Position }, Rotation, Scale, Set);
 }
Ejemplo n.º 31
0
 public virtual void AutoFillRenderSet()
 {
     RenderSet.AutoFindAll();
 }
        private void RenderObjectAt(Vector3[] Positions, Quaternion Rotation, Vector3 Scale, RenderSet Set)
        {
            BrokenArray <Matrix4x4>[] TempMatrices = new BrokenArray <Matrix4x4> [Set.Sets.Count];          // initialize matrices array

            for (int i = 0; i < Positions.Length; i++)
            {
                for (int x = 0; x < TempMatrices.Length; x++)
                {
                    if (TempMatrices [x] == null)
                    {
                        TempMatrices [x] = new BrokenArray <Matrix4x4>(Positions.Length, 1023);
                    }                                                                                               // init broken array if isnt there
                    RenderSet.Set CurrentSet   = Set.Sets[x];                                                       // get current renderset
                    Transform     SetTransform = CurrentSet.ParentSet.transform;                                    // get transform of current set

                    Matrix4x4 Matrix = new Matrix4x4();                                                             // init new matrix
                    Vector3   Point  = Positions [i] + (SetTransform.position - Set.gameObject.transform.position); // calculate position
                    Point = RotatePointAroundPivot(Point, Positions [i], Rotation);                                 // offset point by rotation

                    Matrix.SetTRS(Point, Rotation * SetTransform.rotation, Scale);                                  // set matrix transform
                    TempMatrices [x][i] = Matrix;                                                                   // set matrix
                }
            }

            // render matrixes
            for (int i = 0; i < TempMatrices.Length; i++)                                                                                                                                                   // for every matrix
            {
                MaterialPropertyBlock Properties = new MaterialPropertyBlock();                                                                                                                             // init new property block
                Set.Sets [i].Renderer.GetPropertyBlock(Properties);                                                                                                                                         // load in properties

                if (TempMatrices [i] != null && TempMatrices[i].Count > 0)                                                                                                                                  // only try to draw if is not null
                {
                    for (int x = 0; x < TempMatrices [i].PatchAmount; x++)                                                                                                                                  // for every patch
                    {
                        Graphics.DrawMeshInstanced(Set.MeshFilters [i].sharedMesh, 0, Set.Sets [i].Renderer.sharedMaterial, TempMatrices [i].Patches [x], TempMatrices [i].Patches [x].Length, Properties); // draw patch with property block
                    }
                }
            }
        }
Ejemplo n.º 33
0
 public SpriteObject(RenderSet render_set, double x, double y, Texture texture)
     : this(render_set, texture)
 {
     Corner = new Vector3d(x, y, 0.0);
 }
Ejemplo n.º 34
0
 public AddToRenderSetTask(RenderSet renderSet)
 {
     this.renderSet = renderSet;
 }
Ejemplo n.º 35
0
    public void Decal()
    {
        for (int i = 0; i < projectors.Count; ++i)
        {
            CustomProjector p = projectors[i].projector;

            if (p.enableShadow)
            {
                //Debug.Log(p.cam);
                p.cam.SetTargetBuffers(p.depthMap.colorBuffer, p.depthMap.depthBuffer);
                //p.cam.SetTargetBuffers(colorMap.colorBuffer, depthMap.depthBuffer);
                p.cam.Render();
                // for (int j = 0; j < renderSet.Length; ++j)
                //{
                // _uvMaskMaterial.SetTexture("_DepthMap", p.depthMap);
                //}
                p.cam.RemoveAllCommandBuffers();
            }

            // p.SendMatrix(_uvMaskMaterial);


            //int count = GeometryUtility.Physics.OverlapSphereNonAlloc(
            //    directionalRangeAttackArea[currentRangeWeaponNum].bounds.center,
            //    directionalRangeAttackArea[currentRangeWeaponNum].bounds.extents.magnitude,
            //    neighbours,
            //    enemyLayerMask);
            //Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(p.cam);
        }
        CommandBuffer command = new CommandBuffer();

        command.Clear();
        command.name = "UV Space Renderer";
        for (int j = 0; j < renderList.Count; ++j)
        {
            // if (GeometryUtility.TestPlanesAABB(frustumPlanes, renderList[i].render.bounds))
            {
                //Texture2D prevTex = renderList[j].baseMap;
                //RenderTexture prevRender = renderList[0].captureTex;
                //Texture prevTex = renderList[j].baseMap;
                //RenderTexture.active = prevRender;
                if (convertRenderTextureToTexture2D)
                {
                    for (int i = 0; i < projectors.Count; ++i)
                    {
                        CustomProjector p = projectors[i].projector;

                        RenderSet render = renderList[j];
                        Plane[]   plane  = GeometryUtility.CalculateFrustumPlanes(p.cam);
                        if (!GeometryUtility.TestPlanesAABB(plane, render.render.bounds))
                        {
                            continue;
                        }

                        p.SendMatrix(_uvMaskMaterial);
                        _uvMaskMaterial.SetTexture("_DepthMap", p.depthMap);

                        bool isDilated = false;

                        command.SetRenderTarget(render.captureTex);
                        _uvMaskMaterial.SetTexture("_MainTex", p.decal);
                        //if (render.baseMap)

                        _uvMaskMaterial.SetTexture("_BaseMap", render.prevTex);

                        // _uvMaskMaterial.SetTexture("_BaseMap", convertRenderTextureToTexture2D?prevTex:prevRender/* render.baseMap*/);

                        command.DrawRenderer(render.render, _uvMaskMaterial, 0);
                        if (render.dilateTex && render.dilateMat)
                        {
                            command.Blit(render.captureTex, render.dilateTex, render.dilateMat);
                            isDilated = true;
                        }
                        Graphics.ExecuteCommandBuffer(command);

                        Texture2D tex = RenderTextureToTexture2D(isDilated ? render.dilateTex : render.captureTex);
                        render.render.sharedMaterial.SetTexture("_MainTex", tex /* isDilated ? render.dilateTex : render.captureTex*/);
                        render.prevTex = tex;
                        renderList[j]  = render;

                        command.Clear();
                    }
                }
                else
                {
                    //RenderTexture prevRender = new RenderTexture(prevTex?prevTex.width / 2:1024, prevTex?prevTex.height / 2:1024, 0);
                    //RenderTexture.active = prevRender;
                    //Graphics.Blit(prevTex, prevRender);
                    for (int i = 0; i < projectors.Count; ++i)
                    {
                        CustomProjector p = projectors[i].projector;

                        RenderSet render = renderList[j];
                        Plane[]   plane  = GeometryUtility.CalculateFrustumPlanes(p.cam);
                        if (!GeometryUtility.TestPlanesAABB(plane, render.render.bounds))
                        {
                            continue;
                        }

                        p.SendMatrix(_uvMaskMaterial);
                        _uvMaskMaterial.SetTexture("_DepthMap", p.depthMap);

                        bool isDilated = false;

                        command.SetRenderTarget(render.captureTex);
                        _uvMaskMaterial.SetTexture("_MainTex", p.decal);

                        _uvMaskMaterial.SetTexture("_BaseMap", render.prevRender);

                        command.DrawRenderer(render.render, _uvMaskMaterial, 0);
                        if (render.dilateTex && render.dilateMat)
                        {
                            command.Blit(render.captureTex, render.dilateTex, render.dilateMat);
                            isDilated = true;
                        }
                        Graphics.ExecuteCommandBuffer(command);

                        if (isDilated)
                        {
                            render.captureTex = render.dilateTex;
                        }
                        //RenderTexture rt = isDilated ? render.dilateTex : render.captureTex;
                        render.render.sharedMaterial.SetTexture("_MainTex", render.captureTex /*rt*/);
                        render.prevRender = render.captureTex;// rt;
                        renderList[j]     = render;
                        command.Clear();
                    }
                }
            }
        }
    }
Ejemplo n.º 36
0
 public ProjectileSwitch(RenderSet render_set, double x, double y, ActionEventHandler state_changed, PressureSwitch sync_switch, double latch_time)
     : this(render_set, x, y, state_changed, new SharedState<SwitchState>(SwitchState.Open), new SharedState<double>(latch_time), new Stopwatch(), latch_time)
 {
 }
Ejemplo n.º 37
0
 public BlueprintLine(Vector3d a, Vector3d b, RenderSet render_set)
     : this(a, b, render_set, 100)
 {
 }
Ejemplo n.º 38
0
 public override void AutoFillRenderSet()
 {
     RenderSet.AutoFindRenderSets();              // auto find rendersets
 }
Ejemplo n.º 39
0
 public FadedTileMap(RenderSet render_set, int countx, int county, Texture texture)
     : base(render_set, countx, county, texture)
 {
 }
Ejemplo n.º 40
0
    public void ProjectionOnArray()
    {
        for (int i = 0; i < projectorsArray.Length; ++i)
        {
            CustomProjector p = projectorsArray[i].projector;

            if (p.enableShadow)
            {
                p.cam.SetTargetBuffers(p.depthMap.colorBuffer, p.depthMap.depthBuffer);
                p.cam.Render();
                p.cam.RemoveAllCommandBuffers();
            }
        }
        for (int j = 0; j < renderList.Count; ++j)
        {
            {
                if (convertRenderTextureToTexture2D)
                {
                    for (int i = 0; i < projectorsArray.Length; ++i)
                    {
                        CustomProjector p = projectorsArray[i].projector;

                        if (!p.projectionMat || !p.cam.gameObject.activeInHierarchy)
                        {
                            continue;
                        }

                        RenderSet render = renderList[j];
                        p.SendMatrix(p.projectionMat);
                        p.projectionMat.SetTexture("_DepthMap", p.depthMap);

                        p.projectionMat.SetTexture("_MainTex", p.decal);

                        p.projectionMat.SetTexture("_BaseMap", render.prevTex);

                        Transform t  = renderList[j].render.transform;
                        Matrix4x4 mx = Matrix4x4.TRS(t.position, t.rotation, t.localScale);
                        Graphics.DrawMesh(renderList[j].meshF.sharedMesh, mx, p.projectionMat, LayerMask.NameToLayer("Default"));
                    }
                }
                else
                {
                    for (int i = 0; i < projectorsArray.Length; ++i)
                    {
                        CustomProjector p = projectorsArray[i].projector;

                        if (!p.projectionMat || !p.cam.gameObject.activeInHierarchy)
                        {
                            continue;
                        }

                        RenderSet render = renderList[j];
                        p.SendMatrix(p.projectionMat);
                        p.projectionMat.SetTexture("_DepthMap", p.depthMap);

                        // bool isDilated = false;

                        p.projectionMat.SetTexture("_MainTex", p.decal);

                        p.projectionMat.SetTexture("_BaseMap", render.prevRender);

                        Transform t  = renderList[j].render.transform;
                        Matrix4x4 mx = Matrix4x4.TRS(t.position, t.rotation, t.localScale);
                        Graphics.DrawMesh(renderList[j].meshF.sharedMesh, mx, p.projectionMat, LayerMask.NameToLayer("Default"));
                    }
                }
            }
        }
    }
Ejemplo n.º 41
0
 public virtual void Dispose()
 {
     _RenderSet = null;
     if (_Blueprints != null) {
         for(int i = 0; i < _Blueprints.Count; i++)
         {
             if(_Blueprints[i].Set != null)
                 _Blueprints[i].Set.Remove(_Blueprints[i]);
             _Blueprints[i].Dispose();
             _Blueprints[i] = null;
         }
         _Blueprints.Clear ();
         _Blueprints = null;
     }
     RenderSetEntry = null;
     RenderSetTransfer = null;
 }
Ejemplo n.º 42
0
Archivo: Door.cs Proyecto: qwook/hungry
 public Door(RenderSet render_set, double x, double y, Scene next_scene)
     : this(render_set, x, y)
 {
     _NextScene = next_scene;
 }
Ejemplo n.º 43
0
 public void AddModularPieceRenderer(ModularPiece Piece)
 {
     RenderSet.AddRenderObject(Piece.RenderSet);
 }
 private void RenderObjectAt(Vector3 Position, Quaternion Rotation, RenderSet Set)
 {
     RenderObjectAt(new Vector3[] { Position }, Rotation, Set.gameObject.transform.localScale, Set);
 }
Ejemplo n.º 45
0
Archivo: Door.cs Proyecto: qwook/hungry
 public Door(RenderSet render_set, double x, double y, Door destination)
     : this(render_set, x, y, destination._RenderSet.Scene)
 {
     _Destination = destination;
 }
Ejemplo n.º 46
0
Archivo: Door.cs Proyecto: qwook/hungry
 public Door(RenderSet render_set, Door destination)
     : this(render_set, destination.PositionX, destination.PositionY, destination)
 {
 }
Ejemplo n.º 47
0
 public SpriteObject(RenderSet render_set)
     : this(render_set,Texture.DefaultTexture)
 {
 }
Ejemplo n.º 48
0
    public void ProjectionOnList()
    {
        for (int i = 0; i < projectors.Count; ++i)
        {
            CustomProjector p = projectors[i].projector;

            if (p.enableShadow)
            {
                p.cam.SetTargetBuffers(p.depthMap.colorBuffer, p.depthMap.depthBuffer);
                p.cam.Render();
                p.cam.RemoveAllCommandBuffers();
            }

            projectors[i].cullingCount = 0;
        }
        for (int j = 0; j < renderList.Count; ++j)
        {
            {
                if (convertRenderTextureToTexture2D)
                {
                    for (int i = 0; i < projectors.Count; ++i)
                    {
                        CustomProjector p = projectors[i].projector;

                        if (!p.projectionMat)
                        {
                            continue;
                        }

                        RenderSet render = renderList[j];

                        Plane[] plane = GeometryUtility.CalculateFrustumPlanes(p.cam);
                        if (!GeometryUtility.TestPlanesAABB(plane, render.render.bounds))
                        {
                            continue;
                        }

                        //EFrustumIntersection result = p.frustum.TestPoint(render.render.bounds.center);//(render.render.bounds);
                        //Debug.Log(p.cam.name + "'s " + render.render.name + " Culling Result is " + result);

                        //if(result == EFrustumIntersection.Outside)
                        //{
                        //    continue;
                        //}
                        projectors[i].cullingCount++;

                        p.SendMatrix(p.projectionMat);
                        p.projectionMat.SetTexture("_DepthMap", p.depthMap);

                        p.projectionMat.SetTexture("_MainTex", p.decal);

                        p.projectionMat.SetTexture("_BaseMap", render.prevTex);

                        Transform t  = renderList[j].render.transform;
                        Matrix4x4 mx = Matrix4x4.TRS(t.position, t.rotation, t.localScale);
                        Graphics.DrawMesh(renderList[j].meshF.sharedMesh, mx, p.projectionMat, LayerMask.NameToLayer("Default"));
                    }
                }
                else
                {
                    for (int i = 0; i < projectors.Count; ++i)
                    {
                        CustomProjector p = projectors[i].projector;

                        if (!p.projectionMat)
                        {
                            continue;
                        }

                        RenderSet render = renderList[j];

                        Plane[] plane = GeometryUtility.CalculateFrustumPlanes(p.cam);
                        if (!GeometryUtility.TestPlanesAABB(plane, render.render.bounds))
                        {
                            continue;
                        }

                        //EFrustumIntersection result = p.frustum.TestPoint(render.render.bounds.center);//(render.render.bounds);
                        //Debug.Log(p.cam.name + "'s " + render.render.name + " Culling Result is " + result);

                        //if(result == EFrustumIntersection.Outside)
                        //{
                        //    continue;
                        //}
                        projectors[i].cullingCount++;

                        p.SendMatrix(p.projectionMat);
                        p.projectionMat.SetTexture("_DepthMap", p.depthMap);

                        // bool isDilated = false;

                        p.projectionMat.SetTexture("_MainTex", p.decal);

                        p.projectionMat.SetTexture("_BaseMap", render.prevRender);

                        Transform t  = renderList[j].render.transform;
                        Matrix4x4 mx = Matrix4x4.TRS(t.position, t.rotation, t.localScale);
                        Graphics.DrawMesh(renderList[j].meshF.sharedMesh, mx, p.projectionMat, LayerMask.NameToLayer("Default"));
                    }
                }
            }
        }
    }