Tutorial 2. Textures - gecko0307/dagon GitHub Wiki
Dagon version: >=0.14
You'll definitely want to load some textures and apply them to materials. This is very easy. Add a TextureAsset
to your scene:
class TestScene: Scene
{
TextureAsset aTexGrass;
// other stuff here...
}
Now load it in beforeLoad
:
override void beforeLoad()
{
// other stuff here...
aTexGrass = addTextureAsset("data/grass.png");
}
Create a material and apply the texture:
auto matGround = addMaterial();
matGround.baseColorTexture = aTexGrass.texture;
Now you can apply matGround
to our plane object from previous tutorial:
ePlane.material = matGround;
And the result should be this: