Last active
September 21, 2015 09:31
-
-
Save cslroot/c66ebadf2ad3651bcab3 to your computer and use it in GitHub Desktop.
Unity Ray Tracing 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class RayTracer : MonoBehaviour { | |
private Texture2D myCanvas; | |
// Use this for initialization | |
void Start () { | |
myCanvas = new Texture2D(Screen.width, Screen.height); // ゲーム実行時のスクリーンサイズと同じにしておく | |
Rendering(); | |
} | |
// Update is called once per frame | |
void Update () { | |
} | |
void Rendering() | |
{ | |
Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 1.0f); | |
for (int h = 0; h < myCanvas.height; h++) { | |
for (int w = 0; w < myCanvas.width; w++) { | |
Color c = backgroundColor; | |
myCanvas.SetPixel(w, h, c); | |
} | |
} | |
myCanvas.Apply(); | |
} | |
void OnGUI() { | |
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), myCanvas); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment