浏览代码

adding layers to inc number of object for test scene

/batch_rendering
Arnaud Carre 8 年前
当前提交
27f56cfc
共有 11 个文件被更改,包括 297 次插入33 次删除
  1. 5
      Assets/BasicRenderBatching/BasicBatching.unity
  2. 2
      Assets/BasicRenderBatching/BasicRenderBatchingShader.shader
  3. 51
      Assets/BasicRenderBatching/Scripts/PopulateScene.cs
  4. 34
      Assets/BasicRenderBatching/Textures/numbers/1.png.meta
  5. 34
      Assets/BasicRenderBatching/Textures/numbers/2.png.meta
  6. 34
      Assets/BasicRenderBatching/Textures/numbers/3.png.meta
  7. 34
      Assets/BasicRenderBatching/Textures/numbers/4.png.meta
  8. 34
      Assets/BasicRenderBatching/Textures/numbers/5.png.meta
  9. 34
      Assets/BasicRenderBatching/Textures/numbers/6.png.meta
  10. 34
      Assets/BasicRenderBatching/Textures/numbers/7.png.meta
  11. 34
      Assets/BasicRenderBatching/Textures/numbers/8.png.meta

5
Assets/BasicRenderBatching/BasicBatching.unity


m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.1273174, g: 0.13414761, b: 0.12107885, a: 1}
m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0

- {fileID: 2800000, guid: 2d69bdda1399802499987e9f68ae88ed, type: 3}
- {fileID: 2800000, guid: 14d974c88ade21747938eb13f6cfc152, type: 3}
- {fileID: 2800000, guid: 8e18cf146b7c0d0449454cdeb8653d94, type: 3}
m_GridWidth: 64
m_GridWidth: 100
m_GridLayers: 2
m_Spacing: 0.4
--- !u!114 &870320119
MonoBehaviour:

2
Assets/BasicRenderBatching/BasicRenderBatchingShader.shader


//#include "UnityCG.cginc"
#include "HLSLSupport.cginc"
float4 _Color;
//float4 _Color;
// Global lighting data (setup from C# code once per frame).

51
Assets/BasicRenderBatching/Scripts/PopulateScene.cs


public Texture2D[] m_Textures = new Texture2D[8];
public int m_GridWidth = 16;
public int m_GridLayers = 1;
public float m_Spacing = 0.6f;
public static bool m_DifferentColors = true;

{
m_Objects = new GameObject[m_GridWidth * m_GridWidth];
m_Objects = new GameObject[m_GridWidth * m_GridWidth * m_GridLayers];
for (int z = 0; z < m_GridWidth; z++)
Random.InitState(31415926);
for (int y = 0; y < m_GridLayers; y++)
for (int x = 0; x < m_GridWidth; x++)
for (int z = 0; z < m_GridWidth; z++)
// int i = z * m_CubesRow + x;
for (int x = 0; x < m_GridWidth; x++)
{
// int i = z * m_CubesRow + x;
float fX = (x - (m_GridWidth / 2)) * 2;
float fY = Random.Range(-0.5f, 0.5f);
float fZ = (z - (m_GridWidth / 2)) * 2;
float fX = (x - (m_GridWidth / 2)) * 2;
float fY = (y - (m_GridLayers / 2)) * 2 + Random.Range(-0.5f, 0.5f);
float fZ = (z - (m_GridWidth / 2)) * 2;
Vector3 vPos = new Vector3(fX * m_Spacing, fY, fZ * m_Spacing);
vPos += m_CenterPoint.position;
Vector3 vPos = new Vector3(fX * m_Spacing, fY, fZ * m_Spacing);
vPos += m_CenterPoint.position;
int r = Random.Range(0, 3);
int r = Random.Range(0, 3 + 1);
m_Objects[iIndex] = Instantiate(m_ObjectsPrefab[r], vPos, m_CenterPoint.rotation) as GameObject;
m_Objects[iIndex] = Instantiate(m_ObjectsPrefab[r], vPos, m_CenterPoint.rotation) as GameObject;
if (m_DifferentColors)
{
Renderer renderer = m_Objects[iIndex].GetComponent<Renderer>();
Material mat = Instantiate(m_Material);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.SetColor("myColor", oColor);
if (m_DifferentColors)
{
Renderer renderer = m_Objects[iIndex].GetComponent<Renderer>();
Material mat = Instantiate(m_Material);
Color oColor = new Color(Random.value, Random.value, Random.value, 1.0f);
mat.SetColor("myColor", oColor);
int t = Random.Range(0, 7);
mat.SetTexture("_MainTex", m_Textures[t]);
int t = Random.Range(0, 7 + 1);
mat.SetTexture("_MainTex", m_Textures[t]);
mat.InitUniformBuffers();
mat.InitUniformBuffers();
renderer.material = mat;
renderer.material = mat;
}
iIndex++;
iIndex++;
}
}
}

34
Assets/BasicRenderBatching/Textures/numbers/1.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/2.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/3.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/4.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/5.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/6.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/7.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

34
Assets/BasicRenderBatching/Textures/numbers/8.png.meta


maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
aniso: 8
mipBias: -1
wrapMode: -1
nPOTScale: 1

textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Standalone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: iPhone
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: tvOS
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
- buildTarget: Windows Store Apps
maxTextureSize: 2048
textureFormat: -1
textureCompression: 1

正在加载...
取消
保存