Created
July 4, 2018 16:58
-
-
Save rms80/11f680a32bd36b3c82ef572bb3c18982 to your computer and use it in GitHub Desktop.
Setting face colors in mesh shader
This file contains hidden or 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
//int N = 256; | |
//Texture2D tex = new Texture2D(N, N, TextureFormat.RFloat, false); | |
//float[] buffer = new float[N * N]; | |
//foreach (int tid in startMesh.TriangleIndices()) { | |
// int v = tid / N; | |
// int u = tid % N; | |
// int n = 0; | |
// Vector3d c = startMesh.GetTriCentroid(tid); | |
// if (c.x > startMesh.CachedBounds.Center.x) | |
// n++; | |
// if (c.y > startMesh.CachedBounds.Center.y) | |
// n++; | |
// if (c.z > startMesh.CachedBounds.Center.z) | |
// n++; | |
// Color col = new Color((float)n, 0, 0, 1); | |
// buffer[tid] = (float)n; | |
//} | |
//tex.LoadRawTextureData(FloatToByte(buffer)); | |
//tex.Apply(); | |
//wireframeShader.SetTexture("_FaceIndexMap", tex); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment