- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我一直在研究在 XNA 中生成噪声的库。 Libnoise 似乎是最合乎逻辑的选择。该库非常易于使用并产生了一些很好的结果。不过,我在生成其他部分时遇到了一些麻烦。C++ 文档对此有一个非常好的功能:
utils::NoiseMap heightMap;
utils::NoiseMapBuilderPlane heightMapBuilder;
heightMapBuilder.SetSourceModule (myModule);
heightMapBuilder.SetDestNoiseMap (heightMap);
heightMapBuilder.SetDestSize (256, 256);
heightMapBuilder.SetBounds (6.0, 10.0, 1.0, 5.0); //this one!
heightMapBuilder.Build ();
//http://libnoise.sourceforge.net/tutorials/tutorial3.html
XNA 版本不是这样工作的,而是使用平移函数在生成的高度图中“移动”。
翻译.cs
/// <summary>
/// Initializes a new instance of Translate.
/// </summary>
/// <param name="x">The translation on the x-axis.</param>
/// <param name="y">The translation on the y-axis.</param>
/// <param name="z">The translation on the z-axis.</param>
/// <param name="input">The input module.</param>
public Translate(double x, double y, double z, ModuleBase input)
: base(1)
{
this.m_modules[0] = input;
this.X = x;
this.Y = y;
this.Z = z;
}
用法
perlin = new Perlin(zoom, 4, 0.2, 4, 1, QualityMode.Medium);
Translate translate = new Translate(location.X, location.Y, 0, perlin);
this.m_noiseMap = new Noise2D(200, 200, translate);
this.m_noiseMap.GeneratePlanar(-1 * zoom, 1 * zoom, -1 * zoom, 1 * zoom, true);
这就是问题所在;虽然它确实平移了高度图,但它也扭曲了高度图。这看起来很奇怪,因为 perlin 保持不变。我本可以想象改变 Z 轴会导致高度图发生变化,但我只是改变了 X 轴。
对此有什么想法吗?
最佳答案
看起来主要问题是高度图使用什么维度来生成结果。
因此,高度图构建器使用什么尺寸作为高程非常模糊,尤其是在应用投影之后...
在我看来,X 正在控制海拔高度(如果您观察海洋,看起来就像是在提高海平面)。虽然这可能没有多大意义,但最好检查源代码并查看其实际使用的维度。像这样的 3D 噪声通常不关心哪个维度是哪个,只要你让它与你的应用程序保持一致。
关于c# - Libnoise XNA translate perlin 导致失真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9525603/
我正在尝试更改通过AVAudioPlayer播放的声音文件的速率。它可以工作,但是有很多伪像,尤其是当我放慢速度时。我很高兴速率变化保持相同的音调,但是似乎有麻烦,尤其是持续的音符。 直到我用均衡,压
我正在开发一个需要同步声音的安卓音频应用。 我正在尝试合并两个声音缓冲器,但在大幅度时出现失真。这就是我正在做的: for(int i=0;i>8); } 缓冲区使用:
我正在尝试使用 MediaRecorder 从相机录制视频。这是一个代码 fragment 剪断.. mr.setAudioSource( MediaRecorder.AudioSource.MI
我想找点乐子看看 Canvas 。画一个盒子似乎很容易,所以我几乎从 mozilla 开发者网站上复制了一个例子。你可以在这里看到它:http://jsfiddle.net/Wolfy87/DZBwp
我有一个程序,可以简单地绘制一个立方体。当应用旋转缩放等变换时,程序可以工作。当我尝试应用任何透视矩阵(例如透视、平截头体或正交)时,立方体会以未定义的方式变得非常扭曲。我感到困惑的是为什么该程序在使
在 CSS 和 HTML 中,向下滚动时如何避免背景图像失真? 我的代码大纲如下:HTML * { margin : 0; background-image : url("im
我在 Qt 中旋转图像时遇到了一些问题。每次我用 QPainter 旋转我的图像它变得越来越扭曲。这是初始图像: 经过一些迭代后它变成: 这是我的代码: void Ship::Move(int x,
我正在尝试将 UILabel 旋转 45 度。我将 transform 属性设置为 CGAffineTransformMakeRotation(M_PI * 0.25) 但是当我这样做时,UILabe
当我添加一堆 (20-40) 个样本同时播放和重叠时,有时它会开始失真,然后开始出现一些波动、振荡和咔哒声。当样本正在播放时应用程序崩溃时会发出类似的声音 - 听起来像是突然、嘎吱作响的停止。 请注意
我想使用 amCharts Javascript 库显示我的用户排名。用户排名是这样的(很好,没问题): 问题是如果我有两个相同的配置文件名称(例如,如果我有两个 Sara 名称作为配置文件名称或什至
在 TornadoFX 中使用 SVG 时遇到奇怪的问题。我有一些 SVG 字符串存储在一个枚举中,我在程序中用作背景图像。当我在在线查看器中查看完全相同的 SVG 路径时,没有失真并且显示正确: 但
我使用录音机(Google Play 上的 AudioRec)。 我可以选择adjust the gain with [-20dB, + 20dB]范围。 它在我的手机上运行得很好,但用户使用连接到其
Logo 、搜索栏、购物车、登录和注册未在同一行对齐。 当我尝试查看移动 View 时,出现失真 搜索栏和其他东西搞砸了 在移动 View 中,点击菜单折叠按钮没有任何反应。 这是我的代码:
我仍然是 OpenGL 的初学者。我正在尝试使用着色器在 1280 x 720 的屏幕上绘制一个完美的正方形。 我使用的是 OpenGL 核心配置文件 3.3 版。当我试图在 1280 x 720 中
我的应用程序生成的电子邮件在浏览器(示例 chrome)中打开时可以完美打开。但是当在 Microsoft Outlook 中打开同一封电子邮件时,它会严重变形(例如文本不可见,按钮文本被换行)。任何
我对使用 OpenGL ES 2.0 还很陌生。我也在使用 iPhone 和 GLM 数学库。正如我所提到的,我经常使用本教程:http://tomdalling.com/blog/modern-op
我最初是在考虑 CoreImage 的情况下解决这个问题的(因为我还需要进行面部识别),但我意识到,不幸的是,CI 失真滤镜尚未包含在 iPhone 中。 我试图深入研究 GLImageProcess
我已经使用 twitter-bootstrap gem 来制作商店应用程序。在我添加 activeadmin gem 之前它工作正常。 admin主页的 View 有一行: 店铺名称 和 "trans
我拍了一张照片,然后用这张照片初始化了一个 UIImageView 对象。唯一的问题是,当我拍照时,照片是使用完整的 iPhone 屏幕(纵向)拍摄的。 使用这张照片初始化的 UIImageView
我正在使用 AVAssetWriter 将一系列图像编码为电影文件,遵循 Zoul 在这里的回答:How do I export UIImage array as a movie? . 简而言之我的流
我是一名优秀的程序员,十分优秀!