public PointLight(Location pos, int tsize, float radius, Location col)
 {
     EyePos  = pos;
     Texsize = tsize;
     Radius  = radius;
     Color   = col;
     for (int i = 0; i < 6; i++)
     {
         InternalLights.Add(new Light());
         InternalLights[i].Create(Texsize, pos.ToOVector(), (pos + Location.UnitX).ToOVector(), 90f, Radius, Color.ToOVector());
     }
     InternalLights[4].up = new Vector3(0, 1, 0);
     InternalLights[5].up = new Vector3(0, 1, 0);
     Reposition(EyePos);
 }
 /// <summary>
 /// Constructs the point light.
 /// </summary>
 /// <param name="pos">The position.</param>
 /// <param name="radius">The radius.</param>
 /// <param name="col">The color.</param>
 public PointLight(Location pos, float radius, Color3F col)
 {
     EyePos = pos;
     Radius = radius;
     Color  = col;
     for (int i = 0; i < 6; i++)
     {
         Light li = new Light();
         li.Create(pos.ToOpenTK3D(), (pos + Location.UnitX).ToOpenTK3D(), 90f, Radius, Color.ToOpenTK());
         InternalLights.Add(li);
     }
     InternalLights[4].up = new Vector3(0, 1, 0);
     InternalLights[5].up = new Vector3(0, 1, 0);
     Reposition(EyePos);
     MaxDistance = radius;
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
 }
Beispiel #3
0
 public PointLight(Location pos, int tsize, float radius, Location col)
 {
     EyePos  = pos;
     Texsize = tsize;
     Radius  = radius;
     Color   = col;
     for (int i = 0; i < 6; i++)
     {
         Light li = new Light();
         li.Create(ClientUtilities.ConvertD(pos), ClientUtilities.ConvertD(pos + Location.UnitX), 90f, Radius, ClientUtilities.Convert(Color));
         InternalLights.Add(li);
     }
     InternalLights[4].up = new Vector3(0, 1, 0);
     InternalLights[5].up = new Vector3(0, 1, 0);
     Reposition(EyePos);
     MaxDistance = radius;
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
 }
Beispiel #4
0
 public SpotLight(Location pos, float radius, Location col, Location dir, float size)
 {
     EyePos = pos;
     Radius = radius;
     Color  = col;
     Width  = size;
     InternalLights.Add(new Light());
     if (dir.Z >= 1 || dir.Z <= -1)
     {
         InternalLights[0].up = new Vector3(0, 1, 0);
     }
     else
     {
         InternalLights[0].up = new Vector3(0, 0, 1);
     }
     Direction = dir;
     InternalLights[0].Create(ClientUtilities.ConvertD(pos), ClientUtilities.ConvertD(pos + dir), Width, Radius, ClientUtilities.Convert(Color));
     MaxDistance = radius;
 }
Beispiel #5
0
 /// <summary>
 /// Constructs the spot light.
 /// </summary>
 /// <param name="pos">Position.</param>
 /// <param name="radius">Radius.</param>
 /// <param name="col">Color.</param>
 /// <param name="dir">Direction.</param>
 /// <param name="size">FOV.</param>
 public SpotLight(Location pos, float radius, Location col, Location dir, float size)
 {
     EyePos = pos;
     Radius = radius;
     Color  = col;
     Width  = size;
     InternalLights.Add(new Light());
     if (dir.Z >= 1 || dir.Z <= -1)
     {
         InternalLights[0].up = new Vector3(0, 1, 0);
     }
     else
     {
         InternalLights[0].up = new Vector3(0, 0, 1);
     }
     Direction = dir;
     InternalLights[0].Create(pos.ToOpenTK3D(), (pos + dir).ToOpenTK3D(), Width, Radius, Color.ToOpenTK());
     MaxDistance = radius;
 }
Beispiel #6
0
 public SkyLight(Location pos, float radius, Location col, Location dir, float size, bool transp, int twidth)
 {
     EyePos = pos;
     Radius = radius;
     Color  = col;
     Width  = size;
     InternalLights.Add(new LightOrtho());
     if (dir.Z >= 0.99 || dir.Z <= -0.99)
     {
         InternalLights[0].up = new Vector3(0, 1, 0);
     }
     else
     {
         InternalLights[0].up = new Vector3(0, 0, 1);
     }
     InternalLights[0].transp = transp;
     Direction = dir;
     InternalLights[0].Create(ClientUtilities.ConvertD(pos), ClientUtilities.ConvertD(pos + dir), Width, Radius, ClientUtilities.Convert(Color));
     MaxDistance = radius;
     TexWidth    = twidth;
     FBO         = GL.GenFramebuffer();
     FBO_Tex     = GL.GenTexture();
     GL.BindTexture(TextureTarget.Texture2D, FBO_Tex);
     GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.R32f, TexWidth, TexWidth, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
     FBO_DepthTex = GL.GenTexture();
     GL.BindTexture(TextureTarget.Texture2D, FBO_DepthTex);
     GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.DepthComponent32, TexWidth, TexWidth, 0, PixelFormat.DepthComponent, PixelType.Float, IntPtr.Zero);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge);
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge);
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, FBO);
     GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, FBO_Tex, 0);
     GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthAttachment, TextureTarget.Texture2D, FBO_DepthTex, 0);
     GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
 }