void GameApplication::PaintDecal() { return; Vector3 hitPos; Drawable* hitDrawable; if (Raycast(250.0f, hitPos, hitDrawable)) { // Check if target scene node already has a DecalSet component. If not, create now Node* targetNode = hitDrawable->GetNode(); DecalSet* decal = targetNode->GetComponent<DecalSet>(); if (!decal) { ResourceCache* cache = GetSubsystem<ResourceCache>(); decal = targetNode->CreateComponent<DecalSet>(); decal->SetMaterial(cache->GetResource<Material>("Materials/UrhoDecal.xml")); } decal->RemoveAllDecals(); // Add a square decal to the decal set using the geometry of the drawable that was hit, orient it to face the camera, // use full texture UV's (0,0) to (1,1). Note that if we create several decals to a large object (such as the ground // plane) over a large area using just one DecalSet component, the decals will all be culled as one unit. If that is // undesirable, it may be necessary to create more than one DecalSet based on the distance decal->AddDecal(hitDrawable, hitPos, cameraNode_->GetRotation(), 1.5f, 1.0f, 1.0f, Vector2::ZERO, Vector2::ONE); } }