Esempio n. 1
0
 public void Reload(DeviceResources deviceResources)
 {
     deviceResources.InitializeCBuffer(constantBuffer, c_bufferSize1);
     for (int i = 0; i < bgConstantBuffers.Length; i++)
     {
         deviceResources.InitializeCBuffer(bgConstantBuffers[i], c_bgBufferSize);
     }
 }
Esempio n. 2
0
        public void UpdateGPUResource()
        {
            #region Update bone data
            int count = dynamicContextRead.rendererComponents.Count;
            while (CBs_Bone.Count < count)
            {
                CBuffer constantBuffer = new CBuffer();
                deviceResources.InitializeCBuffer(constantBuffer, c_entityDataBufferSize);
                CBs_Bone.Add(constantBuffer);
            }
            _Data1  data1  = new _Data1();
            Vector3 camPos = dynamicContextRead.cameras[0].Pos;
            for (int i = 0; i < count; i++)
            {
                var rendererComponent = dynamicContextRead.rendererComponents[i];
                data1.vertexCount = rendererComponent.meshVertexCount;
                data1.indexCount  = rendererComponent.meshIndexCount;
                IntPtr    ptr1  = Marshal.UnsafeAddrOfPinnedArrayElement(bigBuffer, 0);
                Matrix4x4 world = Matrix4x4.CreateFromQuaternion(rendererComponent.rotation) * Matrix4x4.CreateTranslation(rendererComponent.position);
                Marshal.StructureToPtr(Matrix4x4.Transpose(world), ptr1, true);
                Marshal.StructureToPtr(rendererComponent.amountAB, ptr1 + 64, true);
                Marshal.StructureToPtr(rendererComponent.meshVertexCount, ptr1 + 68, true);
                Marshal.StructureToPtr(rendererComponent.meshIndexCount, ptr1 + 72, true);
                Marshal.StructureToPtr(data1, ptr1 + 80, true);

                graphicsContext.UpdateResource(CBs_Bone[i], bigBuffer, 256, 0);
                graphicsContext.UpdateResourceRegion(CBs_Bone[i], 256, rendererComponent.boneMatricesData, 65280, 0);
                data1.vertexStart += rendererComponent.meshVertexCount;
                data1.indexStart  += rendererComponent.meshIndexCount;


                if (rendererComponent.meshNeedUpdateA)
                {
                    graphicsContext.UpdateVerticesPos(rendererComponent.meshAppend, rendererComponent.meshPosData1, 0);
                    rendererComponent.meshNeedUpdateA = false;
                }
                if (rendererComponent.meshNeedUpdateB)
                {
                    graphicsContext.UpdateVerticesPos(rendererComponent.meshAppend, rendererComponent.meshPosData2, 1);
                    rendererComponent.meshNeedUpdateB = false;
                }
            }
            #endregion
        }
Esempio n. 3
0
        public void SetSlienceCount(DeviceResources deviceResources, int count)
        {
            int slience1 = (count + sliencesPerBuffer - 1) / sliencesPerBuffer;

            while (constantBuffers.Count < slience1)
            {
                CBuffer buffer1 = new CBuffer();
                deviceResources.InitializeCBuffer(buffer1, bufferSize);
                constantBuffers.Add(buffer1);
            }
        }
Esempio n. 4
0
        public async Task ReloadAssets(DeviceResources deviceResources)
        {
            rootSignature.ReloadCompute(deviceResources, new GraphicSignatureDesc[]
            {
                GraphicSignatureDesc.CBV,
                GraphicSignatureDesc.CBV,
                GraphicSignatureDesc.SRVTable,
                GraphicSignatureDesc.UAVTable,
            });
            deviceResources.InitializeCBuffer(constantBuffers, c_bufferSize);
            IrradianceMap0.Initialize(deviceResources, rootSignature, await ReadFile("ms-appx:///Coocoo3DGraphics/G_IrradianceMap0.cso"));
            EnvironmentMap0.Initialize(deviceResources, rootSignature, await ReadFile("ms-appx:///Coocoo3DGraphics/G_PreFilterEnv.cso"));
            ClearIrradianceMap.Initialize(deviceResources, rootSignature, await ReadFile("ms-appx:///Coocoo3DGraphics/G_ClearIrradianceMap.cso"));

            Ready = true;
        }
Esempio n. 5
0
 public void Reload(DeviceResources deviceResources)
 {
     deviceResources.InitializeCBuffer(postProcessDataBuffer, c_postProcessDataSize);
     Ready = true;
 }
Esempio n. 6
0
 public void Reload(DeviceResources deviceResources)
 {
     deviceResources.InitializeSBuffer(CameraDataBuffer, c_presentDataSize);
     deviceResources.InitializeCBuffer(LightCameraDataBuffer, c_lightCameraDataSize);
 }