Ejemplo n.º 1
0
        public void AddGroup(List <Grass2PositionedEntity> positionedEntities, GrassGroupId id)
        {
            var list = positionedEntities.Select(c => _gpuInstancingContainer.AddInstance(_bucketId,
                                                                                          c.LocalToWorldMatrix, c.Uniforms)).ToList();

            _groupsIdsDict[id] = list;

            //foreach (var entity in positionedEntities)
            //{
            //    var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            //    var pos = entity.LocalToWorldMatrix.ExtractPosition();
            //    cube.transform.localPosition = new Vector3(pos.x, pos.y, pos.z);
            //    cube.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
            //    cube.GetComponent<MeshRenderer>().material.color = Color.red;
            //}
        }
Ejemplo n.º 2
0
 public void RemoveGroup(GrassGroupId groupId)
 {
     _groupsIdsDict[groupId].ForEach(c => _gpuInstancingContainer.RemoveInstance(c));
     _groupsIdsDict.Remove(groupId);
 }