private ITextureProjectionRenderer FindOrCreateTextureProjectionRenderer(SpotLightGroupParameters groupParamaters) { if (groupParamaters.SpotParameters.ProjectionTexture == null) { return(null); // If no projection texture is set for this group, it means it doesn't require a texture projection renderer. } // Check if a texture projection renderer with the desired properties has already been created: var textureProjectionRendererKey = new TextureProjectionRendererKey(groupParamaters.SpotParameters); ITextureProjectionRenderer textureProjectionRenderer = null; if (textureProjectionRenderers.TryGetValue(textureProjectionRendererKey, out textureProjectionRenderer)) { // The desired texture projection renderer has already been created. Therefore we will reuse that one. return(textureProjectionRenderer); } // If the desired texture projection renderer is not already present in the dictionary, we create and add it: textureProjectionRenderer = new LightSpotTextureProjectionRenderer(groupParamaters.SpotParameters); textureProjectionRenderers.Add(textureProjectionRendererKey, textureProjectionRenderer); return(textureProjectionRenderer); }
public bool Equals(ref SpotLightGroupParameters other) { return(ShadowType == other.ShadowType && ShadowRenderer == other.ShadowRenderer && SpotParameters.Equals(ref other.SpotParameters)); }