示例#1
0
 public InstancedEntity(InstanceBatch batchOwner, uint instanceID) : this(OgrePINVOKE.new_InstancedEntity__SWIG_1(InstanceBatch.getCPtr(batchOwner), instanceID), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
示例#2
0
 public InstancedEntity(InstanceBatch batchOwner, uint instanceID, InstancedEntity sharedTransformEntity) : this(OgrePINVOKE.new_InstancedEntity__SWIG_0(InstanceBatch.getCPtr(batchOwner), instanceID, InstancedEntity.getCPtr(sharedTransformEntity)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
示例#3
0
 public void _addDirtyBatch(InstanceBatch dirtyBatch)
 {
     OgrePINVOKE.InstanceManager__addDirtyBatch(swigCPtr, InstanceBatch.getCPtr(dirtyBatch));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
示例#4
0
        public InstanceBatch _getOwner()
        {
            global::System.IntPtr cPtr = OgrePINVOKE.InstancedEntity__getOwner(swigCPtr);
            InstanceBatch         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new InstanceBatch(cPtr, false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
    // Manually draw meshes with instancing
    void RenderInstanced()
    {
        profiler.ResetDisplay();

        // Draw weapons (without LOD)
        profiler.Log("Weapon count: " + weaponBatches.Sum(item => item.Count));
        for (int i = 0; i < weaponBatches.Count; i++)
        {
            InstanceBatch batch = weaponBatches[i];
            batch.InstanceProperties.SetVectorArray("_AnimState", batch.AnimStates);

            Graphics.DrawMeshInstanced(
                batch.Mesh, 0, GPUWeaponMaterial,
                batch.Transforms, batch.Count, batch.InstanceProperties,
                shadowCastingMode, shadowReceivingMode);
        }

        // Draw characters (for every LOD)
        profiler.Log("Instance count: " + LODBatches.Sum(item => item.Count));
        for (int i = 0; i < LODBatches.Count; i++)
        {
            InstanceBatch lod = LODBatches[i];
            lod.InstanceProperties.SetVectorArray("_AnimState", lod.AnimStates);

            profiler.Log(string.Format("LOD_{0}: {1}", i, lod.Count));

            if (i < 2)
            {
                Graphics.DrawMeshInstanced(
                    lod.Mesh, 0, GPUSkinMaterial,
                    lod.Transforms, lod.Count, lod.InstanceProperties,
                    shadowCastingMode, shadowReceivingMode);
            }
            else
            {
                Graphics.DrawMeshInstanced(
                    lod.Mesh, 0, GPUSkinMaterialSimple,
                    lod.Transforms, lod.Count, lod.InstanceProperties,
                    UnityEngine.Rendering.ShadowCastingMode.Off, false);
            }
        }
    }
示例#6
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InstanceBatch obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 private void RenderInstancedObjects(InstanceBatch batch)
 {
     _shader.UseInstancingTechnique();
     _shader.SetRenderable(Matrix.Identity, batch.Material);
     _shader.Apply();
     _renderer.DrawInstancedGeometry(batch);
 }