コード例 #1
0
    public void SetSVOBuffer(RT.SVOData data, int offset = 0)
    {
        Debug.Log("Setting svo buffer...");

        // _svoBuffer = new ComputeBuffer (data.childDescriptors.Count, 4);
        // _svoAttachmentsBuffer = new ComputeBuffer (data.attachments.Count, 4);

        // Print SVO

        /* string output = "\n";
         * for(int i = 0; i < data.childDescriptors.Count; i++) {
         *      int normal = (int)(data.attachments[i*2 + 1] >> 16);
         *      output += "CD: " + new RT.CS.ChildDescriptor(data.childDescriptors[i]) + "\n"; //, Normal: v" + Vector3.Normalize(RT.CS.NaiveCreator.decodeRawNormal16(normal)) + System.Convert.ToString(normal, 2).PadLeft(16, '0') + "(" + normal + ")\n";
         * }
         *
         * GUIUtility.systemCopyBuffer = output;*/

        _svoBuffer.SetData(data.childDescriptors, 0, offset, data.childDescriptors.Count);
        _svoAttachmentsBuffer.SetData(data.attachments, 0, offset, data.attachments.Count);
    }
コード例 #2
0
ファイル: Clipmap.cs プロジェクト: epitaque/RaytracingTest
    void UpdateMasterOctree()
    {
        RT.CS.NaiveCreator creator = new RT.CS.NaiveCreator();
        RT.CS.Node         sOctree = octree.ExtractSparseOctree();
        int sphereIndex            = 10000;

        RT.SVOData data = creator.Create(sOctree, x => sphereIndex);
        raytracingMaster.SetSVOBuffer(data);

        Debug.Log("Num child descriptors: " + data.childDescriptors.Count);
        string log = "SVO Trunk: \n";

        log += "Compressed:\n" + string.Join("\n", data.childDescriptors.ConvertAll(code => new RT.CS.ChildDescriptor(code))) + "\n\n";
        string path = Application.dataPath + "/trunkSVO.log";

        System.IO.File.WriteAllText(path, log);

        RT.SVOData sphereData = creator.Create(SampleFunctions.functions[1], 4);

        raytracingMaster.SetSVOBuffer(sphereData, sphereIndex);
    }
コード例 #3
0
    private void SetSVOBuffer()
    {
        Debug.Log("Setting svo buffer...");

        RT.CS.NaiveCreator creator = new RT.CS.NaiveCreator();
        RT.SVOData         data    = creator.Create(SampleFunctions.functions[(int)sampleType], maxLevel);
        _svoBuffer            = new ComputeBuffer(data.childDescriptors.Count, 4);
        _svoAttachmentsBuffer = new ComputeBuffer(data.attachments.Count, 4);

        // Print SVO

        /* string output = "\n";
         * for(int i = 0; i < data.childDescriptors.Count; i++) {
         *      int normal = (int)(data.attachments[i*2 + 1] >> 16);
         *      output += "CD: " + new RT.CS.ChildDescriptor(data.childDescriptors[i]) + "\n"; //, Normal: v" + Vector3.Normalize(RT.CS.NaiveCreator.decodeRawNormal16(normal)) + System.Convert.ToString(normal, 2).PadLeft(16, '0') + "(" + normal + ")\n";
         * }
         *
         * GUIUtility.systemCopyBuffer = output;*/

        _svoBuffer.SetData(data.childDescriptors);
        _svoAttachmentsBuffer.SetData(data.attachments);
    }