public void Reset() { initialized = false; // is it the best way? penumbraSprite = null; atlasPenumbraSprite = null; whiteSprite = null; blackSprite = null; atlasSpriteMaskTexture = null; atlasBlackMaskSprite = null; occlusionEdge = null; occlusionBlur = null; shadowBlur = null; additive = null; multiplyHDR = null; alphablend = null; spriteProjection = null; mask = null; spriteShadow = null; atlasMaterial = null; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here Actors.Add(new BasicActor(Content.Load <Model>(@"ship"), new Vector3(0f, 300f, 0f), Vector3.Zero, Vector3.One)); Actors.Add(new BasicActor(Content.Load <Model>(@"teapot"), new Vector3(0f, 0f, -1200f), Vector3.Zero, Vector3.One * 10)); Actors.Add(new BasicActor(Content.Load <Model>(@"Ground"), Vector3.Zero, Vector3.Zero, Vector3.One)); Effect simpleEffect = Content.Load <Effect>("LightingEffect"); Actors[0].SetModelEffect(simpleEffect, true); Actors[1].SetModelEffect(simpleEffect, true); Actors[2].SetModelEffect(simpleEffect, true); LightingMaterial mat = new LightingMaterial(); //mat.LightColor = Color.Red.ToVector3(); mat.AmbientColor = new Vector3(0.1f, 0.1f, 0.1f); Actors[0].Material = mat; Actors[1].Material = mat; Actors[2].Material = mat; LastMouseState = Mouse.GetState(); }
public RenderInstance(Matrix worldMatrix, int meshId) { WorldMatrix = worldMatrix; MeshId = meshId; Material = new LightingMaterial(); }
public Material GetAdditive() { if (additive == null || additive.Get() == null) { additive = LightingMaterial.Load("Light2D/Internal/Additive"); } return(additive.Get()); }
public Material GetSoftShadow() { if (softShadow == null || softShadow.Get() == null) { softShadow = LightingMaterial.Load("Light2D/Internal/SoftShadow"); } return(softShadow.Get()); }
public Material GetBlurLight() { if (blur_light == null || blur_light.Get() == null) { blur_light = LightingMaterial.Load("Light2D/Internal/BlurLight"); } return(blur_light.Get()); }
public Material GetBlurMask() { if (blur_mask == null || blur_mask.Get() == null) { blur_mask = LightingMaterial.Load("Light2D/Internal/BlurMask"); } return(blur_mask.Get()); }
public Material GetNormalMapSpriteObjectToLight() { if (normalObjectToLightSprite == null || normalObjectToLightSprite.Get() == null) { normalObjectToLightSprite = LightingMaterial.Load("Light2D/Internal/NormalMapObjectToLight"); } return(normalObjectToLightSprite.Get()); }
public Material GetBumpedDaySprite() { if (bumpedDaySprite == null || bumpedDaySprite.Get() == null) { bumpedDaySprite = LightingMaterial.Load("Light2D/Internal/DayBump"); } return(bumpedDaySprite.Get()); }
public Material GetRoomMultiply() { if (roomMultiply == null || roomMultiply.Get() == null) { roomMultiply = LightingMaterial.Load("Light2D/Internal/RoomMultiply"); } return(roomMultiply.Get()); }
public Material GetMask() { if (mask == null || mask.Get() == null) { mask = LightingMaterial.Load("Light2D/Internal/Mask"); } return(mask.Get()); }
public Material GetRoomMask() { if (roomMask == null || roomMask.Get() == null) { roomMask = LightingMaterial.Load("Light2D/Internal/RoomMask"); } return(roomMask.Get()); }
public Material GetSpriteProjectionMaterial() { if (spriteProjection == null || spriteProjection.Get() == null) { spriteProjection = LightingMaterial.Load("Light2D/Internal/SpriteProjection"); } return(spriteProjection.Get()); }
public Material GetShadowBlur() { if (shadowBlur == null || shadowBlur.Get() == null) { shadowBlur = LightingMaterial.Load("Light2D/Internal/AlphaBlended"); shadowBlur.SetTexture("textures/shadowblur"); } return(shadowBlur.Get()); }
static public LightingMaterial Load(Material material) { LightingMaterial lightingMaterial = new LightingMaterial(); //lightingMaterial.path = material.name; lightingMaterial.material = material;; return(lightingMaterial); }
public Material GetAlphaBlend() { if (alphablend == null || alphablend.Get() == null) { alphablend = LightingMaterial.Load("Light2D/Internal/AlphaBlended"); alphablend.SetTexture("textures/white"); } return(alphablend.Get()); }
public Material GetAtlasMaterial() { if (atlasMaterial == null || atlasMaterial.Get() == null) { atlasMaterial = LightingMaterial.Load("Light2D/Internal/AlphaBlended"); } atlasMaterial.SetTexture(AtlasSystem.Manager.GetAtlasPage().GetTexture()); return(atlasMaterial.Get()); }
public Material GetMultiplyHDR() { if (multiplyHDR == null || multiplyHDR.Get() == null) { if (hdr == true) { multiplyHDR = LightingMaterial.Load("Light2D/Internal/Multiply HDR"); } else { multiplyHDR = LightingMaterial.Load("Light2D/Internal/Multiply"); } } return(multiplyHDR.Get()); }
public Material GetOcclusionBlur() { if (occlusionBlur == null || occlusionBlur.Get() == null) { if (hdr == true) { occlusionBlur = LightingMaterial.Load("Light2D/Internal/Multiply HDR"); } else { occlusionBlur = LightingMaterial.Load("Light2D/Internal/Multiply"); } occlusionBlur.SetTexture("textures/occlussionblur"); } return(occlusionBlur.Get()); }
public Material GetLight() { if (light == null || light.Get() == null) { light = LightingMaterial.Load("Light2D/Internal/Light"); } if (Lighting2D.ProjectSettings.colorSpace == LightingSettings.ColorSpace.Linear) { light.Get().SetFloat("_LinearColor", 1); } else { light.Get().SetFloat("_ColorSpace", 0); } return(light.Get()); }
static public LightingMaterial Load(string path) { LightingMaterial lightingMaterial = new LightingMaterial(); lightingMaterial.path = path; Shader shader = Shader.Find(path); if (shader == null) { Debug.LogError("Smart Lighting: Shader Not Found '" + path + "'"); } else { // Debug.Log("Smart Lighting: Loading Material " + path); lightingMaterial.material = new Material(shader); } return(lightingMaterial); }
public Material[] GetMaterials() { if (materials == null) { materials = new Material[1]; } if (materials.Length < 1) { materials = new Material[1]; } switch (meshModeShader) { case MeshModeShader.Additive: if (materials[0] == null) { materials[0] = LightingMaterial.Load("Light2D/Internal/MeshModeAdditive").Get(); } break; case MeshModeShader.Alpha: if (materials[0] == null) { materials[0] = LightingMaterial.Load("Light2D/Internal/MeshModeAlpha").Get(); } break; case MeshModeShader.Custom: materials = meshModeMaterial; break; } return(materials); }
public Material GetMaterial() { if (material == null || material.Get() == null) { switch (cameraSettings.renderShader) { case CameraSettings.RenderShader.MultiplyHDR: material = LightingMaterial.Load("Light2D/Internal/Multiply HDR"); break; case CameraSettings.RenderShader.Multiply: material = LightingMaterial.Load("Light2D/Internal/Multiply"); break; case CameraSettings.RenderShader.Additive: material = LightingMaterial.Load(Max2D.shaderPath + "Particles/Additive"); break; case CameraSettings.RenderShader.Custom: material = LightingMaterial.Load(cameraSettings.GetMaterial()); break; } } material.SetTexture(renderTexture.renderTexture); return(material.Get()); }
public override void LoadContent() { //colors for debug rndColors = new Color[20]; for (int i = 0; i < 20; i++) { rndColors[i] = new Color((float)RandomManager.TheRandom.NextDouble(), (float)RandomManager.TheRandom.NextDouble(), (float)RandomManager.TheRandom.NextDouble()); } //Content manager if (Content == null) { Content = new ContentManager(ScreenManager.Game.Services, "Content"); screenContentManager = new ScreenContentManager(Content); } DebugDrawer = new DebugDrawer(ScreenManager.Game, this); ScreenManager.Game.Components.Add(DebugDrawer); //Load models screenContentManager.AddModel("ground", @"Models\Ground"); screenContentManager.AddModel("ship", @"Models\ship"); screenContentManager.AddModel("teapot", @"Models\teapot"); //Set graphics graphics = ScreenManager.GraphicsDevice; graphics.BlendState = BlendState.Opaque; graphics.DepthStencilState = DepthStencilState.Default; //Load fonts screenContentManager.AddFont("kootenay14", @"Fonts\kootenay14"); //setup camera if (Cam == null) { Cam = new FreeCamera(new Vector3(0, 100, -250), MathHelper.ToRadians(180), MathHelper.ToRadians(5), graphics); } //set mouse to invisible ScreenManager.Game.IsMouseVisible = false; //set up game state foreach (Entity e in GameStateManager.GameManager.Entities) { Actors.Add(new BasicActor(e, screenContentManager.GetModel(e.Name))); } screenContentManager.AddEffect("lightingEffect", @"Models\LightingEffect"); LightingMaterial mat = new LightingMaterial(); //mat.LightColor = Color.Red.ToVector3(); mat.AmbientColor = new Vector3(0.1f, 0.1f, 0.1f); foreach (BasicActor actor in Actors) { actor.SetModelEffect(screenContentManager.GetEffect("lightingEffect"), true); actor.Material = mat; } //setup overlays Overlays.Add(new DebugOverlay(this)); Overlays[0].IsActive = true; }
public void ClearMaterial() { material = null; }