浏览代码

change the material color to new persistent uniform buffer

/batch_rendering
Arnaud Carré arnaud@unity3d.com 8 年前
当前提交
bb47b0ed
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 2
      Assets/BasicRenderBatching/BasicRenderBatchingShader.shader
  2. 3
      Assets/BasicRenderBatching/Scripts/PopulateScene.cs

2
Assets/BasicRenderBatching/BasicRenderBatchingShader.shader


float4 globalSH[7];
CBUFFER_END
CBUFFER_START(FastBatch_PerObjectData : register(b0) )
CBUFFER_START(UniformBuffer_FastBatch : register(b1) )
float4 myColor;
CBUFFER_END

3
Assets/BasicRenderBatching/Scripts/PopulateScene.cs


Material mat = Instantiate(m_Material);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.SetColor("myColor", oColor);
mat.InitUniformBuffers();
renderer.material = mat;
}
iIndex++;

正在加载...
取消
保存