当前位置: 首页>>代码示例>>C#>>正文


C# Sample.InitSample方法代码示例

本文整理汇总了C#中Sample.InitSample方法的典型用法代码示例。如果您正苦于以下问题:C# Sample.InitSample方法的具体用法?C# Sample.InitSample怎么用?C# Sample.InitSample使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sample的用法示例。


在下文中一共展示了Sample.InitSample方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSample

        public Sample GetSample(Sample prevSample)
        {
            TotalSamples++;
            Sample sample = new Sample(this);
            sample.sampleData = new float[SampleDataOffset.SamplesPerVertex * sceneMaxPathDepth];
            //sample.modifyData = new int[SampleDataOffset.SamplesPerVertex * sceneMaxPathDepth];
            //MC.StratifiedSample1D(sample.sampleData, SampleDataOffset.SamplesPerVertex * sceneMaxPathDepth, rnd, false);
            //sample.sampleData 
            sample.InitSample(SampleDataOffset.SamplesPerVertex * sceneMaxPathDepth);


            sample.imageX = rnd.NextFloat()*screenWidth;
            sample.imageY = rnd.NextFloat()*screenHeight;
            //sample.imageY += screenStartLine;
            return sample;
            /*if ((pass >= MagicValue2))
            {
                // In order to improve ray coherency
                int stepX = currentSubSampleIndex % 4;
                int stepY = currentSubSampleIndex / 4;

                scrX = currentSampleScreenX;
                scrY = currentSampleScreenY;

                currentSubSampleIndex++;
                if (currentSubSampleIndex == (MagicValue1 / 2))
                {
                    currentSubSampleIndex = 0;
                    currentSampleScreenX++;
                    if (currentSampleScreenX >= screenWidth)
                    {
                        currentSampleScreenX = 0;
                        currentSampleScreenY++;

                        if (currentSampleScreenY >= screenHeight)
                        {
                            currentSampleScreenY = 0;
                            pass += 16;
                        }
                    }
                }

                float r1 = (stepX + ((float)rnd.NextDouble())) / 4f - 0.5f;
                float r2 = (stepY + ((float)rnd.NextDouble())) / 4f - 0.5f;
                sample.imageX = scrX + r1;
                sample.imageY = scrY + r2;
                //sample.Init(this,pass, valuesPerSample, false);
            }
            else if (pass >= MagicValue1)
            {
                scrX = currentSampleScreenX;
                scrY = currentSampleScreenY;

                currentSampleScreenX++;
                if (currentSampleScreenX >= screenWidth)
                {
                    currentSampleScreenX = 0;
                    currentSampleScreenY++;

                    if (currentSampleScreenY >= screenHeight)
                    {
                        currentSampleScreenY = 0;
                        pass++;
                    }
                }

                float r1 = ((float)rnd.NextDouble()) - .5f;
                float r2 = ((float)rnd.NextDouble()) - .5f;
                sample.imageX = scrX + r1;
                sample.imageY = scrY + r2;
                //sample.Init(this, pass,valuesPerSample, false);
            }
            else
            {
                // In order to update the screen faster for the first 16 passes
                for (; ; )
                {
                    int stepX = pass % 4;
                    int stepY = (pass / 4) % 4;

                    scrX = currentSampleScreenX * 4 + stepX;
                    scrY = currentSampleScreenY * 4 + stepY;

                    currentSampleScreenX++;
                    if (currentSampleScreenX * 4 >= screenWidth)
                    {
                        currentSampleScreenX = 0;
                        currentSampleScreenY++;

                        if (currentSampleScreenY * 4 >= screenHeight)
                        {
                            currentSampleScreenY = 0;
                            pass++;
                        }
                    }

                    // Check if we are inside the screen
                    if ((scrX < screenWidth) && (scrY < screenHeight))
                    {
                        // Ok, it is a valid sample
//.........这里部分代码省略.........
开发者ID:HungryBear,项目名称:rayden,代码行数:101,代码来源:MCMCSampler.cs

示例2: GetNewSample

        private Sample GetNewSample(bool regen)
        {
            TotalSamples++;
            Sample sample = new Sample(this);
            if (regen)
                sample.InitSample(10 * 10);
            int scrX, scrY;

            if (!lowLatency || (pass >= MagicValue2))
            {
                // In order to improve ray coherency
                int stepX = currentSubSampleIndex % SuperSamplingSize;
                int stepY = currentSubSampleIndex / SuperSamplingSize;

                scrX = currentSampleScreenX;
                scrY = currentSampleScreenY;

                currentSubSampleIndex++;
                if (currentSubSampleIndex == (SamplesPerPassX4))
                {
                    currentSubSampleIndex = 0;
                    currentSampleScreenX++;
                    if (currentSampleScreenX >= screenWidth)
                    {
                        currentSampleScreenX = 0;
                        currentSampleScreenY++;

                        if (currentSampleScreenY >= ScreenHeight)
                        {
                            currentSampleScreenY = _currentSampleScreenY;
                            pass += SamplesPerPassX4;
                        }
                    }
                }

                float r1 = (stepX + ((float)rnd.NextDouble())) / (float)SuperSamplingSize - 0.5f;
                float r2 = (stepY + ((float)rnd.NextDouble())) / (float)SuperSamplingSize - 0.5f;
                sample.imageX = scrX + r1;
                sample.imageY = scrY + r2;
                //sample.imageY += screenStartLine;

                //sample.Init(this,pass, valuesPerSample, false);
            }
            else if (pass >= PreviewPasses)
            {
                scrX = currentSampleScreenX;
                scrY = currentSampleScreenY;

                currentSampleScreenX++;
                if (currentSampleScreenX >= screenWidth)
                {
                    currentSampleScreenX = 0;
                    currentSampleScreenY++;

                    if (currentSampleScreenY >= ScreenHeight)
                    {
                        currentSampleScreenY = _currentSampleScreenY;
                        pass++;
                    }
                }

                float r1 = ((float)rnd.NextDouble()) - .5f;
                float r2 = ((float)rnd.NextDouble()) - .5f;
                sample.imageX = scrX + r1;
                sample.imageY = scrY + r2;
                //sample.imageY += screenStartLine;
                //sample.Init(this, pass,valuesPerSample, false);
            }
            else
            {
                // In order to update the screen faster for the first 16 passes
                for (; ; )
                {
                    int stepX = pass % SuperSamplingSize;
                    int stepY = (pass / SuperSamplingSize) % SuperSamplingSize;

                    scrX = currentSampleScreenX * SuperSamplingSize + stepX;
                    scrY = currentSampleScreenY * SuperSamplingSize + stepY;

                    currentSampleScreenX++;
                    if ((currentSampleScreenX * SuperSamplingSize) >= screenWidth)
                    {
                        currentSampleScreenX = 0;
                        currentSampleScreenY++;

                        if ((currentSampleScreenY * SuperSamplingSize) >= ScreenHeight)
                        {
                            currentSampleScreenY = _currentSampleScreenY;
                            pass++;
                        }
                    }

                    // Check if we are inside the screen
                    if ((scrX < screenWidth) && (scrY < ScreenHeight))
                    {
                        // Ok, it is a valid sample
                        break;
                    }
                    else if (pass >= PreviewPasses)
                    {
//.........这里部分代码省略.........
开发者ID:HungryBear,项目名称:rayden,代码行数:101,代码来源:PSSMLTSampler.cs


注:本文中的Sample.InitSample方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。