问题描述
大家好,
背景::
我目前正在使用c#.Net创建3D建模引擎,而未使用任何第三方库(例如DirectX或OpenGl).到目前为止,我已经构建了一个引擎,该引擎支持创建新对象,灯光,运动和物理(考虑到限制:p,到目前为止,我认为这是非常令人印象深刻的).但是我碰到了一点迷路.我无法将图像映射到三角形.
问题::
我的引擎从数组中存储的3d三角形生成了3个屏幕点.我可以简单地在两点之间画线以生成网格,但是我希望能够将给定的纹理扭曲到该三角形的边界.给定的纹理由图像和它将作为图像源的不同三角形的3个点组成.我该怎么办?
感谢所有帮助我解决挑战的人:) :)
-------------------------------------------------- ----
Hi all,
Background::
I am currently in the process of creating a 3D modelling engine using c#.Net without the use of any 3rd party libraries like DirectX or OpenGl. So far I have built an engine that supports the creation of new objects, lights, movement and physics (which I think is pretty impressive so far considering the restrictions :p). However I have hit a bit of a stumble. I cannot map an Image to a triangle.
Question::
I have 3 screen points generated by my engine from a 3d triangle stored in an array. I can simply draw lines between the points to generate a mesh but I would like to be able to put a given texture warped to the bounds of this triangle. The given texture is made up of an Image and the 3 points of a different triangle it will source of the image. How can I accomplish this?
Thank you to all who help me solve my challenge :) :)
------------------------------------------------------
Graphics Drawer; //Graphics Object
Image TextureImage; //Image to draw source
Point[] PointsOnImageToSource; //triangle on source image we want drawn
Point[] PointsOnScreenToDraw; //Triangle in 2D space where texture needs to be drawn
//TODO - Draw triangle to screen
推荐答案
这篇关于将图像绘制为三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!