Initial ARPG Port
ARPG scene assets from old project are now correctly visualizing sectors generated by ZoneGenerator and updated by GameContext
This commit is contained in:
parent
1e2b474fc1
commit
d12d7c5c45
379 changed files with 42700 additions and 7253 deletions
39
Assets/Scripts/Sector Display/VolumeSampling.cs
Normal file
39
Assets/Scripts/Sector Display/VolumeSampling.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Drives the volume render.
|
||||
/// </summary>
|
||||
//[ExecuteInEditMode]
|
||||
[RequireComponent( typeof( Camera ) ), ImageEffectAllowedInSceneView]
|
||||
public class VolumeSampling : MonoBehaviour
|
||||
{
|
||||
public Material _volMaterial;
|
||||
public Transform GridTransform;
|
||||
private Camera _camera;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_camera = GetComponent<Camera>();
|
||||
}
|
||||
|
||||
[ImageEffectOpaque]
|
||||
void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
// check for no shader / shader compile error
|
||||
if( _volMaterial == null )
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
|
||||
// Shader needs this matrix to generate world space rays
|
||||
_volMaterial.SetMatrix("_CamProj", (_camera.projectionMatrix * _camera.worldToCameraMatrix).inverse);
|
||||
|
||||
// Shader needs to know the position and scale of cameras used to render input textures
|
||||
if(GridTransform != null)
|
||||
_volMaterial.SetVector("_GridTransform", new Vector4(GridTransform.position.x,GridTransform.position.z,GridTransform.localScale.x*4));
|
||||
|
||||
Graphics.Blit( source, destination, _volMaterial, 0 );
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue