Пример #1
0
 /// <summary>
 /// Constructs a Color4D from a Color3D and alpha value.
 /// </summary>
 /// <param name="rgb">RGB values</param>
 /// <param name="alpha">Alpha value</param>
 public Color4D(Color3D rgb, float alpha)
 {
     R = rgb.R;
     G = rgb.G;
     B = rgb.B;
     A = alpha;
 }
Пример #2
0
 /// <summary>
 /// Constructs a Color4D from a Color3D. Alpha is set to 1.0.
 /// </summary>
 /// <param name="rgb">RGB values</param>
 public Color4D(Color3D rgb)
 {
     R = rgb.R;
     G = rgb.G;
     B = rgb.B;
     A = 1.0f;
 }
Пример #3
0
        /// <summary>
        /// Sets the property raw data as a Color3D.
        /// </summary>
        /// <param name="value">Color3D</param>
        /// <returns>True if successful, false otherwise</returns>
        public bool SetColor3DValue(Color3D value)
        {
            if (m_type != PropertyType.Float)
            {
                return(false);
            }

            return(SetValueAs <Color3D>(value));
        }
Пример #4
0
        /// <summary>
        /// Constructs a new instance of the <see cref="MaterialProperty"/> class. Creates a Color3D property.
        /// </summary>
        /// <param name="name">Name of the property</param>
        /// <param name="value">Property value</param>
        public MaterialProperty(String name, Color3D value)
        {
            m_name     = name;
            m_type     = PropertyType.Float;
            m_texIndex = 0;
            m_texType  = TextureType.None;
            m_rawValue = null;

            SetColor3DValue(value);
        }
Пример #5
0
 /// <summary>
 /// Reads the unmanaged data from the native value.
 /// </summary>
 /// <param name="nativeValue">Input native value</param>
 void IMarshalable <Light, AiLight> .FromNative(ref AiLight nativeValue)
 {
     m_name           = nativeValue.Name.GetString();
     m_lightType      = nativeValue.Type;
     m_angleInnerCone = nativeValue.AngleInnerCone;
     m_angleOuterCone = nativeValue.AngleOuterCone;
     m_attConstant    = nativeValue.AttenuationConstant;
     m_attLinear      = nativeValue.AttenuationLinear;
     m_attQuadratic   = nativeValue.AttenuationQuadratic;
     m_position       = nativeValue.Position;
     m_direction      = nativeValue.Direction;
     m_diffuse        = nativeValue.ColorDiffuse;
     m_specular       = nativeValue.ColorSpecular;
     m_ambient        = nativeValue.ColorAmbient;
 }
Пример #6
0
 /// <summary>
 /// Constructs a new Light.
 /// </summary>
 /// <param name="light">Unmanaged AiLight struct</param>
 internal Light(ref AiLight light)
 {
     m_name           = light.Name.GetString();
     m_lightType      = light.Type;
     m_angleInnerCone = light.AngleInnerCone;
     m_angleOuterCone = light.AngleOuterCone;
     m_attConstant    = light.AttenuationConstant;
     m_attLinear      = light.AttenuationLinear;
     m_attQuadratic   = light.AttenuationQuadratic;
     m_position       = light.Position;
     m_direction      = light.Direction;
     m_diffuse        = light.ColorDiffuse;
     m_specular       = light.ColorSpecular;
     m_ambient        = light.ColorAmbient;
 }
Пример #7
0
 /// <summary>
 /// Tests equality between this color and another color
 /// </summary>
 /// <param name="other">Color to test against</param>
 /// <returns>True if components are equal</returns>
 public bool Equals(Color3D other)
 {
     return((R == other.R) && (G == other.G) && (B == other.B));
 }
Пример #8
0
 public static int ToInteger(Color3D color)
 {
     return (int)(color.R * 255) | ((int)(color.G * 255) << 8) | ((int)(color.B * 255) << 16);
 }
Пример #9
0
 public float ToFloat(Color3D color)
 {
     return (color.R + color.G + color.B) / 3f;
 }
Пример #10
0
 public static Color ToSuperBMDColorRGB(this Assimp.Color3D color3)
 {
     return(new Color(color3.R, color3.G, color3.B, 1.0f));
 }
Пример #11
0
 /// <summary>
 /// Tests equality between this color and another color
 /// </summary>
 /// <param name="other">Color to test against</param>
 /// <returns>True if components are equal</returns>
 public bool Equals(Color3D other) {
     return (R == other.R) && (G == other.G) && (B == other.B);
 }
Пример #12
0
 public static void AreEqual(Color3D a, Vector3 b)
 {
     Assert.AreEqual(a.R, b.X);
     Assert.AreEqual(a.G, b.Y);
     Assert.AreEqual(a.B, b.Z);
 }