public Color GetDesaturatedColor() { RXColorHSL hsl = RXColor.HSLFromColor(_upColor); hsl.s = 0.25f; hsl.l = 0.6f; return(RXColor.ColorFromHSL(hsl)); }
override public void PopulateRenderLayer() { if(_isOnStage && _firstFacetIndex != -1) { _isMeshDirty = false; Vector3[] vertices = _renderLayer.vertices; Vector2[] uvs = _renderLayer.uvs; Color[] colors = _renderLayer.colors; List<Vector2[]> vertexPolygons = _mesh2D.polygonalData.vertexPolygons; List<int[]> trianglePolygons = _mesh2D.polygonalData.trianglePolygons; int polyCount = trianglePolygons.Count; int nextTriangleIndex = _firstFacetIndex; for(int p = 0; p<polyCount; p++) { Vector2[] polyVertices = vertexPolygons[p]; int[] polyTriangleIndices = trianglePolygons[p]; int polyTriangleCount = polyTriangleIndices.Length /3; Color drawColor = RXColor.ColorFromHSL(0.8f+RXRandom.Float(p) * 0.3f,1f,0.5f); for(int t = 0; t < polyTriangleCount; t++) { int vertexIndex0 = nextTriangleIndex*3; int vertexIndex1 = vertexIndex0 + 1; int vertexIndex2 = vertexIndex0 + 2; int threeT = t*3; _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0], polyVertices[polyTriangleIndices[threeT]],0); _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex1], polyVertices[polyTriangleIndices[threeT+1]],0); _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex2], polyVertices[polyTriangleIndices[threeT+2]],0); uvs[vertexIndex0] = _uvBottomLeft; uvs[vertexIndex1] = _uvTopLeft; uvs[vertexIndex2] = _uvBottomRight; colors[vertexIndex0] = drawColor; colors[vertexIndex1] = drawColor; colors[vertexIndex2] = drawColor; // colors[vertexIndex0] = _alphaColor; // colors[vertexIndex1] = _alphaColor; // colors[vertexIndex2] = _alphaColor; nextTriangleIndex++; } } _renderLayer.HandleVertsChange(); } }
public static Color ColorHSL(float sat = 1f, float lum = 0.5f, float alpha = 1f) { return(RXColor.ColorFromHSL(RXRandom.Float(), sat, lum, alpha)); }