Пример #1
0
        /// <summary>
        /// Sets a material parameter value by name.
        /// </summary>
        /// <param name="paramName"></param>
        /// <param name="value"></param>
        /// <returns>true if successful, otherwise false.</returns>
        public bool SetParam(string paramName, ColorSingle value)
        {
            Vector3 vecValue = new Vector3(value.R, value.G, value.B);
            var     result   = MaterialInterop.SetGetMaterialParamVec3(Handle, paramName, ref vecValue, false);

            Opacity = value.A;

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Attempts to get parameter value by name.
        /// </summary>
        /// <param name="paramName"></param>
        /// <param name="value"></param>
        /// <returns>true if successful, otherwise false.</returns>
        public bool TryGetParam(string paramName, out ColorSingle value)
        {
            Vector3 vecVal = Vector3.Zero;
            bool    result = MaterialInterop.SetGetMaterialParamVec3(Handle, paramName, ref vecVal, true);

            value = new ColorSingle {
                R = vecVal.X, G = vecVal.Y, B = vecVal.Z, A = this.Opacity
            };

            return(result);
        }
Пример #3
0
 extern internal static void AddPersistentLine(Vector3 pos, Vector3 end, ColorSingle color, float timeout);
Пример #4
0
 extern internal static void AddAABB(Vector3 pos, BoundingBox bbox, ColorSingle color, float timeout);
Пример #5
0
 extern internal static void AddPersistentText2D(string text, float size, ColorSingle color, float timeout);
Пример #6
0
 /// <summary>
 /// Initializes a new instance of direction light.
 /// </summary>
 /// <param name="name">The name of the light.</param>
 /// <param name="direction">Direction of the light.</param>
 /// <param name="ambient">The ambient color of the light.</param>
 /// <param name="diffuse">The diffuse color of the light.</param>
 /// <param name="specular">The specular color of the light.</param>
 public Light(string name, Vector3 direction, ColorSingle ambient, ColorSingle diffuse, ColorSingle specular) :
     this(name, LightSource.Directional, default, direction, default, ambient, diffuse, specular, default, default, default, default, default)
 {
 }
Пример #7
0
 public static void DrawTextToScreen(float x, float y, float fontSize, ColorSingle color, string text, params object[] args)
 {
     DrawTextToScreen(x, y, fontSize, color, false, text, args);
 }
Пример #8
0
 /// <summary>
 /// Sets a shader parameter value by name.
 /// </summary>
 /// <param name="param"></param>
 /// <param name="value"></param>
 public void SetShaderParam(ShaderColorParameter param, ColorSingle value)
 {
     SetShaderParam(param.GetEngineName(), value);
 }
Пример #9
0
 public static void DrawBoundingBox(Vector3 pos, BoundingBox bbox, ColorSingle color, float timeout)
 {
     DebugInterop.AddAABB(pos, bbox, color, timeout);
 }
Пример #10
0
 public static void DrawLine(Vector3 startPos, Vector3 endPos, ColorSingle color, float timeout)
 {
     DebugInterop.AddPersistentLine(startPos, endPos, color, timeout);
 }
Пример #11
0
 public static void DrawText(string text, float size, ColorSingle color, float timeout)
 {
     DebugInterop.AddPersistentText2D(text, size, color, timeout);
 }
Пример #12
0
 public static void DrawDirection(Vector3 pos, float radius, Vector3 dir, ColorSingle color, float timeout)
 {
     DebugInterop.AddDirection(pos, radius, dir, color, timeout);
 }
Пример #13
0
 public static void DrawSphere(Vector3 pos, float radius, ColorSingle color, float timeout)
 {
     DebugInterop.AddPersistentSphere(pos, radius, color, timeout);
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of area light.
 /// </summary>
 /// <param name="name">The name of the light.</param>
 /// <param name="areaSize">The area size of the light.</param>
 /// <param name="ambient">The ambient color of the light.</param>
 /// <param name="diffuse">The diffuse color of the light.</param>
 /// <param name="specular">The specular color of the light.</param>
 /// <param name="position">The position of the light.</param>
 /// <param name="constant">The constant light attenuation factor.</param>
 /// <param name="linear">The linear light attenuation factor.</param>
 /// <param name="quadratic">The quadratic light attenuation factor.</param>
 public Light(string name, Vector2 areaSize, ColorSingle ambient, ColorSingle diffuse, ColorSingle specular, Vector3 position, float constant, float linear, float quadratic) :
     this(name, LightSource.Area, position, default, areaSize, ambient, diffuse, specular, constant, linear, quadratic, default, default)
 {
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of spot light.
 /// </summary>
 /// <param name="name">The name of the light.</param>
 /// <param name="position">The position of the light.</param>
 /// <param name="direction">Direction of the light.</param>
 /// <param name="ambient">The ambient color of the light.</param>
 /// <param name="diffuse">The diffuse color of the light.</param>
 /// <param name="specular">The specular color of the light.</param>
 /// <param name="constant">The constant light attenuation factor.</param>
 /// <param name="linear">The linear light attenuation factor.</param>
 /// <param name="quadratic">The quadratic light attenuation factor.</param>
 /// <param name="innerConde">The inner angle of a spot light's cone.</param>
 /// <param name="outerCone">The outer angle of a spot light</param>
 public Light(string name, Vector3 position, Vector3 direction, ColorSingle ambient, ColorSingle diffuse, ColorSingle specular, float constant, float linear, float quadratic, float innerConde, float outerCone) :
     this(name, LightSource.Spot, position, direction, default, ambient, diffuse, specular, constant, linear, quadratic, innerConde, outerCone)
 {
 }
Пример #16
0
 extern internal static void SetShaderParam(IntPtr ptr, string paramName, ColorSingle newVal);
Пример #17
0
 /// <summary>
 /// Sets a shader parameter value by name.
 /// </summary>
 /// <param name="paramName"></param>
 /// <param name="newVal"></param>
 public void SetShaderParam(string paramName, ColorSingle newVal)
 {
     MaterialInterop.SetShaderParam(Handle, paramName, newVal);
 }
Пример #18
0
 extern internal static void AddPersistentSphere(Vector3 pos, float radius, ColorSingle color, float timeout);
Пример #19
0
 extern internal static void DrawTextToScreen(float x, float y, float fontSize, ColorSingle color, bool center, string text);
Пример #20
0
 extern internal static void AddDirection(Vector3 pos, float radius, Vector3 dir, ColorSingle color, float timeout);
Пример #21
0
 public static void DrawTextToScreen(float x, float y, float fontSize, ColorSingle color, bool centered, string text, params object[] args)
 {
     RendererInterop.DrawTextToScreen(x, y, fontSize, color, centered, string.Format(text, args));
 }
Пример #22
0
 /// <summary>
 /// Initializes a new instance of <see cref="Light"/> struct.
 /// </summary>
 /// <param name="name">The name of the light.</param>
 /// <param name="lightSource">The light source.</param>
 /// <param name="position">The position of the light.</param>
 /// <param name="direction">Direction of the light.</param>
 /// <param name="areaSize">The area size of the light.</param>
 /// <param name="ambient">The ambient color of the light.</param>
 /// <param name="diffuse">The diffuse color of the light.</param>
 /// <param name="specular">The specular color of the light.</param>
 /// <param name="constant">The constant light attenuation factor.</param>
 /// <param name="linear">The linear light attenuation factor.</param>
 /// <param name="quadratic">The quadratic light attenuation factor.</param>
 /// <param name="inner">The inner angle of a spot light's cone.</param>
 /// <param name="outer">The outer angle of a spot light</param>
 public Light(string name, LightSource lightSource, Vector3 position, Vector3 direction, Vector2 areaSize, ColorSingle ambient, ColorSingle diffuse, ColorSingle specular, float constant, float linear, float quadratic, float inner, float outer)
 {
     (Name,
      LightSource,
      Position,
      Direction,
      Ambient,
      Diffuse,
      Specular,
      AttenuationConstant,
      AttenuationLinear,
      AttenuationQuadratic,
      AngleInnerCone,
      AngleOuterCone,
      AreaSize) =
         (name,
          lightSource,
          position,
          direction,
          diffuse,
          ambient,
          specular,
          constant,
          linear,
          quadratic,
          inner,
          outer,
          areaSize);
     _hashcode = HashHelper <Light> .Combine(Name, LightSource, Position, Direction, AreaSize, Ambient, Diffuse,
                                             Specular, AttenuationConstant, AttenuationLinear, AttenuationQuadratic, AngleInnerCone, AngleOuterCone);
 }