Three.cpp now supports texture and normal mappings


My ongoing port of Three.js to c++, now supports texture and normal mappings. The sample code shows how simple and similar it is to Three.js.

Here’s an example of creating a cylinder with texture and normal mappings.

auto cylinder = Mesh::create(
             CylinderGeometry::create(0.5, 0.5, 1.0, 30, 5),
             MeshPhongMaterial::create( 0xFFFFFF, 0xFFFFFF, 0x000000, 0x111111, 50.0, true ) );

cylinder->translate( -2.0, 0.0, 0.0 );
cylinder->texture   = TextureUtils::loadImageAsTexture( path, "rock_color.tga" );
cylinder->normalMap = TextureUtils::loadAsNormalMap( path, "rock_normal.tga" );
sphere->add( cylinder );

Here’s a sample video of the ongoing port:

If you’re interested in checking out or help to port three.js to C++, please check out my github repository:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s