public void GetDynamicMeshBatch(FMeshBatchCollector MeshBatchCollector) { #if UNITY_EDITOR if (StaticMesh != null) { #endif UpdateMatrix(); UpdateBounds(); for (int Index = 0; Index < StaticMesh.subMeshCount; Index++) { FMeshBatch MeshBatch; MeshBatch.Visible = Visible; MeshBatch.BoundBox = BoundBox; MeshBatch.CastShadow = (int)CastShadow; MeshBatch.MotionType = (int)MotionVector; MeshBatch.RenderLayer = RenderLayer; MeshBatch.SubmeshIndex = Index; MeshBatch.Mesh = GetWorld().WorldMeshList.Add(StaticMesh); MeshBatch.Material = GetWorld().WorldMaterialList.Add(Materials[Index]); MeshBatch.Priority = RenderPriority + Materials[Index].renderQueue; MeshBatch.Matrix_LocalToWorld = Matrix_LocalToWorld; //MeshBatch.CustomPrimitiveData = new float4x4(GetCustomPrimitiveData(0), GetCustomPrimitiveData(4), GetCustomPrimitiveData(8), GetCustomPrimitiveData(12)); MeshBatchCollector.AddDynamicMeshBatch(MeshBatch); } #if UNITY_EDITOR } #endif }
//Function public RenderWorld(string InName) { name = InName; ActiveWorld = this; WorldMeshList = new SharedRefFactory <Mesh>(128); WorldMaterialList = new SharedRefFactory <Material>(128); WorldViewList = new List <CameraComponent>(16); WorldLightList = new List <LightComponent>(32); WorldPrimitiveList = new List <MeshComponent>(128); MeshBatchCollector = new FMeshBatchCollector(); }