`
ejc371fj
  • 浏览: 13819 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

pv3d 2.0版本的一篇英文教程翻译 5 基础纹理

 
阅读更多

pv3d 2.0版本的一篇英文教程翻译 5 基础纹理
2009年12月21日
  http://papervision2.com/5-basic-texturing/  将用到得文件请这里下载
  5 基础纹理
  原文:Before starting this tutorial, please note that it follows on from Tutorial 4 - Basic Template Usage. If you haven't followed that tutorial, I suggest that you do so.
  Be modifying a few lines, we're going to give our spinning cone a texture. The result will be something like this:
  翻译:在开始这个教程前,请注意它是第4片教程的继续,基础模板使用方法。如果你没有看过那篇教程,我建议你去看一看。
  通过修改几行代码,我们将给我们的旋转椎体一个纹理。结果大约如下。(源地址是flash 这里使用的截图。)
  
  
  
  原文:Firstly, open up the project that you made in tutorial 4. I'm going to show you how to use the BitmapFileMaterial, so before we start, you need to import org.papervision3d.materials.BitmapFileMaterial. To do this, find where you have two lines starting with import and just below them, add the line:
  翻译:首先,打开你在第四篇教程创建的项目,我将演示如何使用"BitmapFileMaterial"。那么在我们开始前,你需要导入BitmapFileMaterial类,要这样做,你得找到以"import"开头的两行,然则在他们下面添加:
  import org.papervision3d.materials.BitmapFileMaterial;
  原文:That line will import the BitmapFileMaterial package into your project, so that you can use it.
  翻译:这一行将导入BitmapFileMaterial 包到你的项目中,这样你就可以使用它了。
  原文:Now, we need to add a BitmapFileMaterial to our cone. We can do this when we create it, but first I'll explain BitmapFileMaterial.
  翻译:现在,我们需要添加BitmapFileMaterial 到我们的圆锥。我们可以在创建它的时候做添加。但是,首先我要讲解一下BitmapFileMaterial.这个类。
  原文:BitmapFileMaterial is a papervision 3d material which takes a url of an image file, and creates a texture from it. This is very useful when loading collada models, and it opens possibilities of having things like user-uploaded textures.
  翻译:BitmapFileMaterial 是一种 papervision 3d 材质,它包含图片文件的url路径,用这个图片创建纹理。当我们加载collada(拉风?)模型时它是非常有用的,而且它使用户上传纹理成为可能。
  原文:When you create a new BitmapFileMaterial object, you pass it a URL from which the texture will be fetched.
  翻译:当你创建了一个新的BitmapFileMaterial对象,你传递给它一个url地址,你创建的对象将从这个地址获得一个相应的纹理。
  原文:To add the material to our cone, we're going to pass a BitmapFileMaterial object to the cone when we create it. This is really simple to do, simply change the line:
  翻译:要给我们的圆锥添加材质,我们将在创建它的时候赋予它一个BitmapFileMaterial 材质对象,这很简单,仅仅修改这一行:
  public var cone:Cone = new Cone();
  to:
  public var cone:Cone = new Cone(new BitmapFileMaterial("http://papervision2.com/wp-content/downloads/ourtex.jpg" ));
  原文:This will now get the file from my server and use it as the texture on your cone.
  翻译:这样将从我的服务器获取文件,并将它作为纹理使用在你的圆锥上。
  原文:Now, when you run your code you'll see the red and white texture on your cone. Simple!
  翻译:现在,当你运行你的代码,你会看到红白相间的纹理在你的圆锥上。非常简单。
  My final code looks like this:
  package  {
  import PaperBase;
  import org.papervision3d.objects.primitives.Cone;
  import org.papervision3d.materials.BitmapFileMaterial;
  public class Main extends PaperBase {
  public var cone:Cone = new Cone(new BitmapFileMaterial("http://papervision2.com/wp-content/downloads/ourtex.jpg"), 20, 200);
  // I've added a width and height to change the shape of my cone.
  public function Main() {
  init();
  }
  override protected function init3d():void {
  cone.scale = 3;
  cone.pitch( -30);
  default_scene.addChild(cone);
  }
  override protected function processFrame():void {
  cone.yaw(20);
  // Here, I've made my cone spin faster by increasing the amount sent to yaw();
  }
  }
  }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics