// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using SharpDX.Mathematics.Interop; using System; namespace SharpDX.Direct3D11 { public partial class EffectScalarVariable { /// /// Set a floating-point variable. /// /// A reference to the variable. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetFloat([None] float Value) public void Set(float value) { SetFloat(value); } /// /// Set an array of floating-point variables. /// /// A reference to the start of the data to set. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetFloatArray([In, Buffer] float* pData,[None] int Offset,[None] int Count) public void Set(float[] dataRef) { Set(dataRef, 0); } /// /// Set an array of floating-point variables. /// /// A reference to the start of the data to set. /// Must be set to 0; this is reserved for future use. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetFloatArray([In, Buffer] float* pData,[None] int Offset,[None] int Count) public void Set(float[] dataRef, int offset) { SetFloatArray(dataRef, offset, dataRef.Length); } /// /// Get an array of floating-point variables. /// /// The number of array elements to set. /// Returns an array of floats. /// HRESULT ID3D10EffectScalarVariable::GetFloatArray([Out, Buffer] float* pData,[None] int Offset,[None] int Count) public float[] GetFloatArray(int count) { return GetFloatArray(0, count); } /// /// Get an array of floating-point variables. /// /// Must be set to 0; this is reserved for future use. /// The number of array elements to set. /// Returns an array of floats. /// HRESULT ID3D10EffectScalarVariable::GetFloatArray([Out, Buffer] float* pData,[None] int Offset,[None] int Count) public float[] GetFloatArray(int offset, int count) { var temp = new float[count]; GetFloatArray(temp, offset, count); return temp; } /// /// Set an unsigned integer variable. /// /// A reference to the variable. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetInt([None] int Value) public void Set(uint value) { int temp = 0; unchecked { temp = (int)value; } SetInt(temp); } /// /// Set an array of unsigned integer variables. /// /// A reference to the start of the data to set. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetIntArray([In, Buffer] int* pData,[None] int Offset,[None] int Count) public void Set(uint[] dataRef) { int[] temp = new int[dataRef.Length]; unchecked { for (int n = 0; n < dataRef.Length; n++) temp[n] = (int)dataRef[n]; } Set(temp, 0); } /// /// Set an integer variable. /// /// A reference to the variable. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetInt([None] int Value) public void Set(int value) { SetInt(value); } /// /// Set an array of integer variables. /// /// A reference to the start of the data to set. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetIntArray([In, Buffer] int* pData,[None] int Offset,[None] int Count) public void Set(int[] dataRef) { Set(dataRef, 0); } /// /// Set an array of integer variables. /// /// A reference to the start of the data to set. /// Must be set to 0; this is reserved for future use. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetIntArray([In, Buffer] int* pData,[None] int Offset,[None] int Count) public void Set(int[] dataRef, int offset) { SetIntArray(dataRef, offset, dataRef.Length); } /// /// Get an array of integer variables. /// /// The number of array elements to set. /// Returns an array of integer variables. /// HRESULT ID3D10EffectScalarVariable::GetIntArray([Out, Buffer] int* pData,[None] int Offset,[None] int Count) public int[] GetIntArray(int count) { return GetIntArray(0, count); } /// /// Get an array of integer variables. /// /// Must be set to 0; this is reserved for future use. /// The number of array elements to set. /// Returns an array of integer variables. /// HRESULT ID3D10EffectScalarVariable::GetIntArray([Out, Buffer] int* pData,[None] int Offset,[None] int Count) public int[] GetIntArray(int offset, int count) { var temp = new int[count]; GetIntArray(temp, offset, count); return temp; } /// /// Set a boolean variable. /// /// A reference to the variable. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetBool([None] BOOL Value) public void Set(bool value) { SetBool(value); } /// /// Get a boolean variable. /// /// Returns a boolean. /// HRESULT ID3D10EffectScalarVariable::GetBool([Out] BOOL* pValue) public bool GetBool() { RawBool temp; GetBool(out temp); return temp; } /// /// Set an array of boolean variables. /// /// A reference to the start of the data to set. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetBoolArray([In, Buffer] BOOL* pData,[None] int Offset,[None] int Count) public void Set(bool[] dataRef) { Set(dataRef, 0); } /// /// Set an array of boolean variables. /// /// A reference to the start of the data to set. /// Must be set to 0; this is reserved for future use. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::SetBoolArray([In, Buffer] BOOL* pData,[None] int Offset,[None] int Count) public void Set(bool[] dataRef, int offset) { SetBoolArray(Utilities.ConvertToIntArray(dataRef), offset, dataRef.Length); } /// /// Get an array of boolean variables. /// /// Must be set to 0; this is reserved for future use. /// The number of array elements to set. /// Returns one of the following {{Direct3D 10 Return Codes}}. /// HRESULT ID3D10EffectScalarVariable::GetBoolArray([Out, Buffer] BOOL* pData,[None] int Offset,[None] int Count) public bool[] GetBoolArray(int offset, int count) { RawBool[] temp = new RawBool[count]; GetBoolArray(temp, offset, count); return Utilities.ConvertToBoolArray(temp); } } }