Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions SimpleShader/Assets/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/LambertDark.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/LambertDark.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/RimMaterial.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/RimMaterial.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/SimpleShader.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/SimpleShader.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/SpecularMaterial.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Materials/TextureMaterial.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Materials/TextureMaterial.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/MetalRusted0001_1_M.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions SimpleShader/Assets/MetalRusted0001_1_M.jpg.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Scenes/TestScene.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Scenes/TestScene.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added SimpleShader/Assets/Scenes/ThreadingTest.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions SimpleShader/Assets/Scenes/ThreadingTest.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions SimpleShader/Assets/Scripts/DummyScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;

public class DumbyScript : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
}
12 changes: 12 additions & 0 deletions SimpleShader/Assets/Scripts/DummyScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions SimpleShader/Assets/Scripts/ScriptNewThreading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using UnityEngine;
using System.Collections;
using System.Threading;
using UnityEditor;

// Author: Nathan Boehning
// Purpose: Threading test
public class ScriptNewThreading : MonoBehaviour
{
private bool done = false;

// Use this for initialization
void Start ()
{
// Create four new threads that points to the functions
// That the threads will be running
ThreadStart firstThread = new ThreadStart(ThreadFunction1);
ThreadStart secondThread = new ThreadStart(ThreadFunction2);
ThreadStart thirdThread = new ThreadStart(ThreadFunction3);
ThreadStart fourthThread = new ThreadStart(ThreadFunction3);

// Create the four threads
Thread thread1 = new Thread(firstThread);
Thread thread2 = new Thread(secondThread);
Thread thread3 = new Thread(thirdThread);
Thread thread4 = new Thread(fourthThread);

// Start the four threads
thread1.Start();
thread2.Start();
thread3.Start();
thread4.Start();
}

// Function that prints x 10 times
private void ThreadFunction1()
{
for (int i = 0; i < 10; i++)
{
Debug.Log("X");
}
}

// Function that prints y 10 times
private void ThreadFunction2()
{
for (int i = 0; i < 10; i++)
{
Debug.Log("Y");
}
}

// Function that sets a bool to done
void ThreadFunction3()
{
if (!done)
{
Debug.Log("Done");
done = true;
}
}
}
12 changes: 12 additions & 0 deletions SimpleShader/Assets/Scripts/ScriptNewThreading.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions SimpleShader/Assets/Scripts/ScriptThreading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using UnityEngine;
using System.Collections;
using System.Threading;

// Author: Tiffany Fisher
// Modified by: Nathan Boehning
// Purpose: Demonstrate threading / locked threading
public class ScriptThreading : MonoBehaviour {

// Variable that both threads can access
private string _threadOutput = "";

// Bool to stop the threads
private bool _stopThreads = false;

// Use this for initialization
void Start ()
{
// Invoke the stop threads after 10 seconds to review the results
Invoke("StopThreads", 10);

// Create two new threads that points to the functions
// That the threads will be running
ThreadStart firstThread = new ThreadStart(DisplayThread1);
ThreadStart secondThread = new ThreadStart(DisplayThread2);

// Create the two threads
Thread thread1 = new Thread(firstThread);
Thread thread2 = new Thread(secondThread);

// Start the two threads
thread1.Start();
thread2.Start();
}

// Update is called once per frame
void Update ()
{

}

// Loop thread 1 continuously
// Assign the thread information into _threadOutput
void DisplayThread1()
{
while (!_stopThreads)
{
lock (this) // Lock on the current instance of the class for thread 1
{
Debug.Log("Display Thread 1");
_threadOutput = "Hello Thread1";

// Put the thread to sleep for 1000 ms
// This simulates a lot of processing calculations
// That would normally occur in a thread
Thread.Sleep(1000);
Debug.Log("Thread 1 Output ---> " + _threadOutput);
} // Realease the lock

}
}

// Loop thread 2 continuously
// Assign the thread information into _threadOutput
void DisplayThread2()
{
while (!_stopThreads)
{
lock (this) // Lock on the current instance of the class for thread 2
{
Debug.Log("Display Thread 2");
_threadOutput = "Hello Thread2";

// Put the thread to sleep for 1000 ms
// This simulates a lot of processing calculations
// That would normally occur in a thread
Thread.Sleep(1000);
Debug.Log("Thread 2 Output ---> " + _threadOutput);
} // Realease the lock
}
}

// Triggers to flag to stop threads from running
// Done to ensure Unity doesn't lock up.
void StopThreads()
{
_stopThreads = true;
}
}
12 changes: 12 additions & 0 deletions SimpleShader/Assets/Scripts/ScriptThreading.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions SimpleShader/Assets/Shaders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading