protected void OnEnable() { sfMeshType = MelGraphicsSettings.preset.particleMeshSf; sfMesh = MeshStorage.GetMesh(sfMeshType, MelGraphicsSettings.preset.maxAtomsInParticle); flatMeshType = MelGraphicsSettings.preset.particleMeshFlat; flatMesh = MeshStorage.GetMesh(MelGraphicsSettings.preset.particleMeshFlat, MelGraphicsSettings.preset.maxAtomsInParticle); accurateDepthInParticles = MelGraphicsSettings.preset.accurateDepthInParticles; }
private void Awake() { #region Singleton if (Instance == null) { Instance = this; } if (Instance != this) { Destroy(gameObject); return; } #endregion asteroidMeshes = new Dictionary <int, Mesh>(); bgAsteroidMeshes = new Dictionary <int, Mesh>(); }
// TODO: Async init public BallsListBucket(BallsRendererSettings settings, int _size, Transform parent) : base(settings, parent) { size = _size; transforms = new Transform[size]; materials = new Material[size]; meshes = new MeshFilter[size]; Mesh atomMesh = MeshStorage.GetMesh(MeshStorage.MeshType.TrueSphere, 1); for (int i = 0; i < size; i++) { GameObject go = GameObject.Instantiate(settings.ballObjectPrototype, thisTransform); go.name = "ball_" + i; go.GetComponent <MeshFilter>().sharedMesh = atomMesh; transforms[i] = go.transform; materials[i] = go.GetComponent <MeshRenderer>().material; meshes[i] = go.GetComponent <MeshFilter>(); materials[i].SetFloat(billboardExtrudeFactorId, billboardScaleFactor); } }
public static void SetIndexingForBatch(Material mat, MeshStorage.MeshType type, int objects, bool reverse = false) { mat.SetInt(verticesPerObjectId, MeshStorage.GetVerticesPerObject(type)); mat.SetInt(indexingSignId, reverse ? -1 : 1); mat.SetInt(indexingBiasId, reverse ? (objects - 1) : 0); }
void Initialize() { meshFilter = GetComponent <MeshFilter>(); meshStorage = GetComponent <MeshStorage>(); }