/*
* Copyright(c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Diagnostics.CodeAnalysis;
using System.ComponentModel;
namespace Tizen.NUI
{
///
/// Shader.
///
/// 3
public class Shader : Animatable
{
///
/// Creates Shader object.
///
/// The vertex shader code for the effect.
/// The fragment Shader code for the effect.
/// The hints to define the geometry of the rendered object.
/// 3
public Shader(string vertexShader, string fragmentShader, Shader.Hint.Value hints) : this(Interop.Shader.New(vertexShader, fragmentShader, (int)hints), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates Shader object.
///
/// The vertex shader code for the effect.
/// The fragment Shader code for the effect.
/// 3
public Shader(string vertexShader, string fragmentShader) : this(Interop.Shader.New(vertexShader, fragmentShader), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Gets and Sets the program property.
///
/// 3
public Tizen.NUI.PropertyMap Program
{
get
{
Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap();
var pValue = Tizen.NUI.Object.GetProperty(SwigCPtr, Shader.Property.PROGRAM);
pValue.Get(temp);
pValue.Dispose();
return temp;
}
set
{
var temp = new Tizen.NUI.PropertyValue(value);
Tizen.NUI.Object.SetProperty(SwigCPtr, Shader.Property.PROGRAM, temp);
temp.Dispose();
}
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Shader obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
}
internal Shader(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Shader.Upcast(cPtr), cMemoryOwn)
{
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.Shader.DeleteShader(swigCPtr);
}
///
/// Hint.
///
/// 3
public sealed class Hint
{
///
/// Enumeration for the hint value.
///
/// 3
public enum Value
{
///
/// No hints.
///
/// 3
NONE = 0x00,
///
/// Might generate transparent alpha from opaque inputs
///
/// 3
OUTPUT_IS_TRANSPARENT = 0x01,
///
/// Might change position of vertices, this option disables any culling optimizations
///
/// 3
MODIFIES_GEOMETRY = 0x02
}
}
///
/// Enumeration for instances of properties belonging to the Shader class.
///
/// 3
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Deprecated in API6; Will be removed in API9.")]
#pragma warning disable CA1716, CA1052, CA1034 // Identifiers should not match keywords
public class Property
#pragma warning restore CA1716, CA1052, CA1034 // Identifiers should not match keywords
{
///
/// The default value is empty.
/// Format: {"vertex":"","fragment":"",hints:"","vertexPrefix":"","fragmentPrefix":""}
///
/// 3
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Deprecated in API6; Will be removed in API9.")]
public static readonly int PROGRAM = Interop.Shader.ProgramGet();
}
}
}