-
-
Notifications
You must be signed in to change notification settings - Fork 34
Tutorial 2. Textures
Timur Gafarov edited this page Oct 15, 2018
·
11 revisions
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
{
// other stuff here...
TextureAsset aTexGrass;
// other stuff here...
}
Now load it in onAssetsRequest
:
override void onAssetsRequest()
{
// other stuff here...
aTexGrass = addTextureAsset("data/grass.png");
}
Create a material and apply the texture:
auto matGround = createMaterial();
matGround.diffuse = aTexGrass.texture;
Yes, in Dagon you can assign both colors and textures to material parameters!
Now you can apply matGround
to our plane object from previous tutorial:
ePlane.material = matGround;
And the result should be this: