如何像 GL_REPEAT 一样重复纹理贴图? [英] How to repeat the texture map like GL_REPEAT?

查看:25
本文介绍了如何像 GL_REPEAT 一样重复纹理贴图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的游戏中有一个房屋模型,并且我有一些用于房屋几何形状的材料.房子的墙壁有一个材质,我有一个纹理贴图图像来显示砖块.

I have a house model in my game, and I have some materials for the house geometry. There is a material for the wall of the house, and I have a texture-map-image to show the bricks.

var mat = new THREE.MeshPhongMaterial( { 
    ambient: 0x969696,
    map: THREE.ImageUtils.loadTexture( 'textures/G/G0.jpg' ), 
    overdraw: true,combine: THREE.MultiplyOperation 
} );

上面这样,纹理贴图看起来像 GL_CLAMP 我希望它像 GL_REPEAT 一样显示.

In this way above, the texture map appears like GL_CLAMP I want it to show like GL_REPEAT.

我该怎么办?

如果您看不到图像,请检查this.

If you can not see the images check this.

推荐答案

我在以下位置发布了一个完整的工作示例:http://stemkoski.github.com/Three.js/Texture-Repeat.html

I have posted a full working example at: http://stemkoski.github.com/Three.js/Texture-Repeat.html

代码示例的相关部分是:

The relevant part of the code example is:

// for example, texture repeated twice in each direction
var lavaTexture = THREE.ImageUtils.loadTexture( 'images/lava.jpg' );
lavaTexture.wrapS = lavaTexture.wrapT = THREE.RepeatWrapping;
lavaTexture.repeat.set( 2, 2 );
var lavaMaterial = new THREE.MeshBasicMaterial( { map: lavaTexture } );
var lavaBall = new THREE.Mesh( THREE.GeometryUtils.clone(sphereGeom), lavaMaterial );
scene.add( lavaBall );      

这篇关于如何像 GL_REPEAT 一样重复纹理贴图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆