/**************************************************************************** Copyright (c) 2011-2013,WebJet Business Division,CYOU http://www.genesis-3d.com.cn 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 System; using System.Runtime.CompilerServices; using ScriptRuntime; namespace ScriptRuntime { /// /// 材质实例 /// public partial class MaterialInstance : Base { private MaterialInstance(DummyClass__ dummyObj) { } private MaterialInstance() { //ICall_Material_Bind(this); } ~MaterialInstance() { ICall_Material_Release(this); } /// /// 为材质中的纹理参数设置纹理 /// /// 材质中的纹理参数名称 /// 要设置的纹理 public void SetTexture(String paramName, Texture texture) { ICall_Material_SetTexture(this, paramName, texture.GetTextureHandlePtr()); } /// /// 为材质中的纹理参数设置纹理资源路径 /// /// 材质中的纹理参数名称 /// 要设置的纹理资源路径 public void SetTexture(String paramName, String id) { ICall_Material_SetTextureResource(this, paramName, id, 0); } /// /// 为材质中的纹理参数设置纹理资源路径 /// /// 材质中的纹理参数名称 /// 要设置的纹理资源路径 /// 默认的0表示同步加载,1表示异步加载 public void SetTexture(String paramName, String id, int priority) { ICall_Material_SetTextureResource(this, paramName, id, priority); } /// /// 为材质中的浮点参数设值 /// /// 材质中的浮点参数名称 /// 要设置的浮点数值 public void SetValue(String paramName, float value) { ICall_Material_SetValueFloat(this, paramName, value); } /// /// 为材质中的向量参数设置向量值 /// /// 材质的向量参数名称 /// 要设置的向量参数值 public void SetValue(String paramName, Vector4 value) { ICall_Material_SetValueVector4(this, paramName, ref value); } /// /// 为材质中的矩阵参数设置矩阵值 /// /// 材质中的矩阵参数名称 /// 要设置的矩阵参数值 public void SetValue(String paramName, ref Matrix44 value) { ICall_Material_SetValueMatrix44(this, paramName, ref value); } /// /// 设置着色器中的全局矩阵参数,比如摄像机变换矩阵 /// /// 着色器中的全局矩阵参数类型 /// 要设置的矩阵的值 public static void SetGlobalValue(GlobalShaderMatrix index,ref Matrix44 value) { ICall_Material_SetGlobalMatrix(index, ref value); } /// /// 设置着色器中的全局向量参数,比如环境光 /// /// 着色器中的全局向量参数类型 /// 要设置的向量的值 public static void SetGlobalValue(GlobalShaderVector index,ref Vector4 value) { ICall_Material_SetGlobalVector(index, ref value); } } }