1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
20 /// Renderer is a handle to an object used to show content by combining a Geometry, a TextureSet and a shader.
22 public class Renderer : Animatable
24 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26 internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Renderer_SWIGUpcast(cPtr), cMemoryOwn)
28 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
31 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj)
33 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
36 protected override void Dispose(DisposeTypes type)
43 if (type == DisposeTypes.Explicit)
46 //Release your own managed resources here.
47 //You should release all of your own disposable objects here.
51 //Release your own unmanaged resources here.
52 //You should not access any managed member here except static instance.
53 //because the execution order of Finalizes is non-deterministic.
56 if (swigCPtr.Handle != global::System.IntPtr.Zero)
61 NDalicPINVOKE.delete_Renderer(swigCPtr);
63 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71 public static readonly int DEPTH_INDEX = NDalicPINVOKE.Renderer_Property_DEPTH_INDEX_get();
72 public static readonly int FACE_CULLING_MODE = NDalicPINVOKE.Renderer_Property_FACE_CULLING_MODE_get();
73 public static readonly int BLEND_MODE = NDalicPINVOKE.Renderer_Property_BLEND_MODE_get();
74 public static readonly int BLEND_EQUATION_RGB = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_RGB_get();
75 public static readonly int BLEND_EQUATION_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_ALPHA_get();
76 public static readonly int BLEND_FACTOR_SRC_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_RGB_get();
77 public static readonly int BLEND_FACTOR_DEST_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_RGB_get();
78 public static readonly int BLEND_FACTOR_SRC_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get();
79 public static readonly int BLEND_FACTOR_DEST_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get();
80 public static readonly int BLEND_COLOR = NDalicPINVOKE.Renderer_Property_BLEND_COLOR_get();
81 public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get();
82 public static readonly int INDEX_RANGE_FIRST = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_FIRST_get();
83 public static readonly int INDEX_RANGE_COUNT = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_COUNT_get();
84 public static readonly int DEPTH_WRITE_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_WRITE_MODE_get();
85 public static readonly int DEPTH_FUNCTION = NDalicPINVOKE.Renderer_Property_DEPTH_FUNCTION_get();
86 public static readonly int DEPTH_TEST_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_TEST_MODE_get();
87 public static readonly int RENDER_MODE = NDalicPINVOKE.Renderer_Property_RENDER_MODE_get();
88 public static readonly int STENCIL_FUNCTION = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_get();
89 public static readonly int STENCIL_FUNCTION_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_MASK_get();
90 public static readonly int STENCIL_FUNCTION_REFERENCE = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get();
91 public static readonly int STENCIL_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_MASK_get();
92 public static readonly int STENCIL_OPERATION_ON_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get();
93 public static readonly int STENCIL_OPERATION_ON_Z_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get();
94 public static readonly int STENCIL_OPERATION_ON_Z_PASS = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get();
99 /// Create an instance of Renderer.
101 /// <since_tizen> 3 </since_tizen>
102 public Renderer(Geometry geometry, Shader shader) : this(NDalicPINVOKE.Renderer_New(Geometry.getCPtr(geometry), Shader.getCPtr(shader)), true)
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
109 /// Sets the geometry to be used by this renderer.
111 /// <param name="geometry">The geometry to be used by this renderer.</param>
112 /// <since_tizen> 3 </since_tizen>
113 public void SetGeometry(Geometry geometry)
115 NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry));
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 /// Gets the geometry used by this renderer.
122 /// <returns>The geometry used by the renderer.</returns>
123 /// <since_tizen> 3 </since_tizen>
124 public Geometry GetGeometry()
126 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetGeometry(swigCPtr);
127 Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Geometry;
129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 /// Sets effective range of indices to draw from bound index buffer.
136 /// <param name="firstElement">The First element to draw.</param>
137 /// <param name="elementsCount">The number of elements to draw.</param>
138 /// <since_tizen> 3 </since_tizen>
139 public void SetIndexRange(int firstElement, int elementsCount)
141 NDalicPINVOKE.Renderer_SetIndexRange(swigCPtr, firstElement, elementsCount);
142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 /// Sets the texture set to be used by this renderer.
148 /// <param name="textureSet">The texture set to be used by this renderer.</param>
149 /// <since_tizen> 3 </since_tizen>
150 public void SetTextures(TextureSet textureSet)
152 NDalicPINVOKE.Renderer_SetTextures(swigCPtr, TextureSet.getCPtr(textureSet));
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 /// Gets the texture set used by this renderer.
159 /// <returns>The texture set used by the renderer.</returns>
160 /// <since_tizen> 3 </since_tizen>
161 public TextureSet GetTextures()
163 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetTextures(swigCPtr);
164 TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TextureSet;
166 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 /// Sets the shader used by this renderer.
173 /// <param name="shader">The shader to be used by this renderer.</param>
174 /// <since_tizen> 3 </since_tizen>
175 public void SetShader(Shader shader)
177 NDalicPINVOKE.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader));
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 /// Gets the shader used by this renderer.
184 /// <returns>The shader used by the renderer.</returns>
185 /// <since_tizen> 3 </since_tizen>
186 public Shader GetShader()
188 System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetShader(swigCPtr);
189 Shader ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Shader;
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Gets and Sets DepthIndex property.
198 /// <since_tizen> 3 </since_tizen>
199 public int DepthIndex
204 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX).Get(out temp);
209 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX, new Tizen.NUI.PropertyValue(value));
214 /// Gets and Sets FaceCullingMode.
216 /// <since_tizen> 3 </since_tizen>
217 public int FaceCullingMode
222 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE).Get(out temp);
227 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE, new Tizen.NUI.PropertyValue(value));
232 /// Gets and Sets BlendMode.
234 /// <since_tizen> 3 </since_tizen>
240 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_MODE).Get(out temp);
245 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_MODE, new Tizen.NUI.PropertyValue(value));
250 /// Gets and Sets BlendEquationRgb.
252 /// <since_tizen> 3 </since_tizen>
253 public int BlendEquationRgb
258 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB).Get(out temp);
263 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB, new Tizen.NUI.PropertyValue(value));
268 /// Gets and Sets BlendEquationAlpha.
270 /// <since_tizen> 3 </since_tizen>
271 public int BlendEquationAlpha
276 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA).Get(out temp);
281 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA, new Tizen.NUI.PropertyValue(value));
286 /// Gets and Sets BlendFactorSrcRgb.
288 /// <since_tizen> 3 </since_tizen>
289 public int BlendFactorSrcRgb
294 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB).Get(out temp);
299 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB, new Tizen.NUI.PropertyValue(value));
304 /// Gets and Sets BlendFactorDestRgb.
306 /// <since_tizen> 3 </since_tizen>
307 public int BlendFactorDestRgb
312 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB).Get(out temp);
317 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB, new Tizen.NUI.PropertyValue(value));
322 /// Gets and Sets BlendFactorSrcAlpha.
324 /// <since_tizen> 3 </since_tizen>
325 public int BlendFactorSrcAlpha
330 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA).Get(out temp);
335 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA, new Tizen.NUI.PropertyValue(value));
340 /// Gets and Sets BlendFactorDestAlpha.
342 /// <since_tizen> 3 </since_tizen>
343 public int BlendFactorDestAlpha
348 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA).Get(out temp);
353 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA, new Tizen.NUI.PropertyValue(value));
358 /// Gets and Sets BlendColor.
360 /// <since_tizen> 3 </since_tizen>
361 public Vector4 BlendColor
365 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
366 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_COLOR).Get(temp);
371 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_COLOR, new Tizen.NUI.PropertyValue(value));
376 /// Gets and Sets BlendPreMultipliedAlpha.
378 /// <since_tizen> 3 </since_tizen>
379 public bool BlendPreMultipliedAlpha
384 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA).Get(out temp);
389 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value));
394 /// Gets and Sets IndexRangeFirst.
396 /// <since_tizen> 3 </since_tizen>
397 public int IndexRangeFirst
402 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST).Get(out temp);
407 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST, new Tizen.NUI.PropertyValue(value));
412 /// Gets and Sets IndexRangeCount.
414 /// <since_tizen> 3 </since_tizen>
415 public int IndexRangeCount
420 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT).Get(out temp);
425 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT, new Tizen.NUI.PropertyValue(value));
430 /// Gets and Sets DepthWriteMode.
432 /// <since_tizen> 3 </since_tizen>
433 public int DepthWriteMode
438 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE).Get(out temp);
443 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE, new Tizen.NUI.PropertyValue(value));
448 /// Gets and Sets DepthFunction.
450 /// <since_tizen> 3 </since_tizen>
451 public int DepthFunction
456 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION).Get(out temp);
461 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION, new Tizen.NUI.PropertyValue(value));
466 /// Gets and Sets DepthTestMode.
468 /// <since_tizen> 3 </since_tizen>
469 public int DepthTestMode
474 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE).Get(out temp);
479 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE, new Tizen.NUI.PropertyValue(value));
484 /// Gets and Sets RenderMode.
486 /// <since_tizen> 3 </since_tizen>
487 public int RenderMode
492 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.RENDER_MODE).Get(out temp);
497 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.RENDER_MODE, new Tizen.NUI.PropertyValue(value));
502 /// Gets and Sets StencilFunction.
504 /// <since_tizen> 3 </since_tizen>
505 public int StencilFunction
510 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION).Get(out temp);
515 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION, new Tizen.NUI.PropertyValue(value));
520 /// Gets and Sets StencilFunctionMask.
522 /// <since_tizen> 3 </since_tizen>
523 public int StencilFunctionMask
528 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK).Get(out temp);
533 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK, new Tizen.NUI.PropertyValue(value));
538 /// Gets and Sets StencilFunctionReference.
540 /// <since_tizen> 3 </since_tizen>
541 public int StencilFunctionReference
546 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE).Get(out temp);
551 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE, new Tizen.NUI.PropertyValue(value));
556 /// Gets and Sets StencilMask.
558 /// <since_tizen> 3 </since_tizen>
559 public int StencilMask
564 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_MASK).Get(out temp);
569 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_MASK, new Tizen.NUI.PropertyValue(value));
574 /// Gets and Sets StencilOperationOnFail.
576 /// <since_tizen> 3 </since_tizen>
577 public int StencilOperationOnFail
582 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL).Get(out temp);
587 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL, new Tizen.NUI.PropertyValue(value));
592 /// Gets and Sets StencilOperationOnZFail.
594 /// <since_tizen> 3 </since_tizen>
595 public int StencilOperationOnZFail
600 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL).Get(out temp);
605 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL, new Tizen.NUI.PropertyValue(value));
610 /// Gets and Sets StencilOperationOnZPass property.
612 /// <since_tizen> 3 </since_tizen>
613 public int StencilOperationOnZPass
618 Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS).Get(out temp);
623 Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS, new Tizen.NUI.PropertyValue(value));