This project is read-only.

Trying to figure out how to use this, not working.

May 2, 2012 at 5:04 AM

so im trying to figure this engine out, i followed the test bed almost verbatim. but when i run it everything is just darker than normal. example:

the redish box sprite im using is pure red, but as you can see its more maroon here. anyways heres the code im using.

Variable declaration:

 Krypton.KryptonEngine engine;
        Texture2D image;
        Vector2 imagePosition;
        ShadowHull boxHull;
        Light2D light;
        Texture2D background;
        Texture2D lightTexture;

in game1 constructor

            engine = new KryptonEngine(this, "KryptonEffect");//initialize the lighting engine


Load content
 spriteBatch = new SpriteBatch(GraphicsDevice);
            image = Content.Load<Texture2D>("Box");
            background = Content.Load<Texture2D>("Background");
            imagePosition = new Vector2(300, 300);
            //setup light
            lightTexture = LightTextureBuilder.CreatePointLight(this.GraphicsDevice, 256);
            light = new Light2D();
            light.Texture = lightTexture;
            light.Position = new Vector2(20, 20);
            light.Range = 6;
            light.Color = Color.White;
            light.Intensity = 1;
            light.Angle = MathHelper.TwoPi * .3f;
            light.Fov = (float)((MathHelper.PiOver2 * 0.34 * 0.75) + 0.25);
            boxHull = ShadowHull.CreateRectangle(new Vector2(48,48));
            boxHull.Position = imagePosition;

update method

imagePosition = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
            engine.Hulls[0].Position = imagePosition;

draw method

Matrix world = Matrix.Identity;
            Matrix view = Matrix.CreateTranslation(new Vector3(0, 0, 0) * -1f);
            Matrix projection = Matrix.CreateOrthographic(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, 0, 1);

            engine.Matrix = world * view * projection;
            engine.Bluriness = 3;
            engine.SpriteBatchCompatablityEnabled = true;


            // TODO: Add your drawing code here
            spriteBatch.Draw(background, new Vector2(0), Color.White);
            spriteBatch.Draw(image, imagePosition, Color.White);

the only difference i see is where i define the projection matrix. in the testbed

he used

            Matrix projection = Matrix.CreateOrthographic(this.mVerticalUnits * this.GraphicsDevice.Viewport.AspectRatio, this.mVerticalUnits, 0, 1);
where vertical units, from what i can see is set to 50, i cant see where im going wrong. any ideas?

May 22, 2012 at 9:37 PM

I can't see anything wrong with your declarations initially, but I might be faster for me to debug the issue if you post the source here (or pm it to me).