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
#pragma strict | |
// Script to create a mesh with 2 triangles, getting colors from a text file. | |
function Start () | |
{ | |
gameObject.AddComponent.<MeshFilter>(); | |
gameObject.AddComponent.<MeshRenderer>(); | |
var mat = new Material(Shader.Find("Custom/Vertex Colored")); | |
GetComponent.<Renderer>().material = mat; |
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
// taken from http://answers.unity3d.com/questions/391561/create-a-mesh-and-color-cubes.html | |
Shader "Custom/Vertex Colored" | |
{ | |
Properties | |
{ | |
} | |
SubShader | |
{ | |
Pass | |
{ |
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
#pragma strict | |
// Script to create a mesh with 2 triangles with texture coordinates (UV). | |
// This expects to be attached to a GameObject that already has a mesh | |
// and material (such as a sphere), so that you can assign the texture | |
// through the Unity editor, instead of here in the code | |
// It uses the mesh's Clear() function to erase the old geometry before | |
// creating the triangles. | |
function Start () |
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
#pragma strict | |
public var rows = 30; | |
public var cols = 30; | |
private var myVertices = Array(); | |
private var myColors = Array(); | |
private var myTriangles = Array(); | |
function Start () |
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
#pragma strict | |
public var rows = 30; | |
public var cols = 30; | |
private var myVertices = Array(); | |
private var myColors = Array(); | |
private var myTriangles = Array(); | |
function Start () |
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
#pragma strict | |
public var rows = 30; | |
public var cols = 30; | |
private var myVertices = Array(); | |
private var myUVs = Array(); | |
private var myTriangles = Array(); | |
function Start () |
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
#pragma strict | |
import SimpleJSON; | |
public var min = 0; | |
public var max = 2; | |
function Start () | |
{ | |
var datastring = System.IO.File.ReadAllText("q.json"); |
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
#pragma strict | |
// Script to visualize earthquake data in GeoJSON format from USGS | |
// (http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) | |
// Requires the SimpleJSON plugin from http://wiki.unity3d.com/index.php/SimpleJSON | |
// The script should be attached to a model of the Earth such as a sphere | |
// with a 20 unit diameter. A prefab to use for marking the quakes should | |
// be assigned to the variable "prefab" in the Unity editor. | |
import SimpleJSON; |
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
#pragma strict | |
import SimpleJSON; | |
public var min = 0; | |
public var max = 2; | |
public var url = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/4.5_month.geojson"; | |
private var dataurl : WWW; | |
private var done = 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
#pragma strict | |
// Script to take AirNow AQI data and turn it into a line graph | |
// Data is assumed to be a time sequence for a single station, from the "Observations by Monitoring Site" query tool | |
// The data file should be in JSON format, and placed in a folder called "data" within the Assets folder | |
// This must be attached to a GameObject that has a Mesh Renderer and an empty Mesh Filter | |
// Using a Mesh Renderer, rather than a Line Renderer, allows us to set per-vertex colors. | |
import SimpleJSON; |