Spotlights and decorator

I’m use a decorator pattern for lights I have created. At the moment I have basic spot light which doesn’t move and I also have a rotating spot light. Please see pastebin:

http://pastebin.java-gaming.org/9f1607579451b

Is this overkill? Just this pattern seems nice when wanting to add more functionality to existing object.

Thanks

Please add some comments to your code and describe what your functions should do and when they are called, so we can help you.
For exemple : it is hard to guess what

float r

is.

It feels a bit mixed up.

I don’t think the subclass RotatingSpotLight should exist. This is a behaviour and so everything can be put in a “RotatingLightDelegate” that could be assigned an angle on construction.

The RotatingLightDelegate would replace the RotatingSplotLightDelegate – which is misnamed anyway as it can apply to any light, not just splot lights.

RotatingSplotLightDelegate is probably more accurately named “MoveOnRenderDelegate”. As an aside, updating on render is a bad idea (but not really relevant to the design pattern discussion).

The core idea that’s missing is that any delegate can wrap any light (including other delegates). If you ever start making code that relies on specific pairs of delegates/lights being used then the design has gone wrong.

The question basically was not what the code does, but if it was overkill using a decorator pattern. Anyway, looks like my implementation is incorrect now having looked back at it (I quickly wrote that on my lunch break).

Thanks all.