using System;
using System.Collections.Generic;
using Core.BRG;
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
public class BRG_backgrond : MonoBehaviour
{
public BRGSamples samples;
// public Material mat;
// public Mesh mesh;
public bool m_castShadows;
public int w;
public int h;
///
/// BRG容器对象
///
private BRGRender _mBrgRenderBasic;
private int m_itemCount;
public bool isUpdate = true;
///
/// GPU项目大小(2个4x3矩阵加1个颜色,每个float4占16字节)
///
private const int kGpuItemSize = (3 * 2 + 1) * 16;
public List m_gameObjectInfos = new List();
private void Start()
{
m_itemCount = w * h;
for (int i = 0; i < w; i++)
{
for (int j = 0; j < h; j++)
{
BGRGameObjectInfo info = new BGRGameObjectInfo();
info.pos = new Vector3(i * 2, j , 0); // 增加间距,使物体更容易看到
info.rot = Vector3.zero;
info.scale = Vector3.one; // 调整尺寸
m_gameObjectInfos.Add(info);
}
}
_mBrgRenderBasic = new BRGRender();
_mBrgRenderBasic.InitRender(samples, m_gameObjectInfos);
}
private void OnDestroy()
{
if (_mBrgRenderBasic != null)
{
_mBrgRenderBasic.Shutdown();
_mBrgRenderBasic = null;
}
}
private void Update()
{
UpdatePos();
}
private void UpdatePos()
{
if (!isUpdate)
{
return;
}
_mBrgRenderBasic.UpdatePos();
}
}