/****************************************************************************
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 RenderComponent : Component
{
private RenderComponent(DummyClass__ dummyObj)
{
}
protected RenderComponent()
{
}
///
/// 获得渲染相关组件的第i个材质的资源名
///
/// 渲染相关组件的材质索引
/// 返回的资源名称
public string GetMaterialID(int index)
{
return ICall_RenderComponent_GetMaterialID(this, index);
}
///
/// 获得渲染相关组件的第i个材质的材质实例
///
/// 渲染相关组件的材质索引
/// 返回的材质实例
public MaterialInstance GetMaterialInstance(int index)
{
return ICall_RenderComponent_GetMaterialInstance(this, index);
}
///
/// 设置材质资源到指定的材质索引
///
/// 渲染相关组件的材质索引
/// 要设置的资源路径
public void SetMaterialID(int index, String pMonoStr)
{
ICall_RenderComponent_SetMaterialID(this, index, pMonoStr, false);
}
///
/// 设置材质资源到指定的材质索引
///
/// 渲染相关组件的材质索引
/// 要设置的资源路径
/// 是否要拷贝材质,默认是使用内存中的同一份材质
public void SetMaterialID(int index, String pMonoStr, bool bCopy)
{
ICall_RenderComponent_SetMaterialID(this, index, pMonoStr, bCopy);
}
///
/// 设置材质实例到指定的材质索引
///
/// 渲染相关组件的材质索引
/// 要设置的材质实例
/// 是否要拷贝材质,默认是使用内存中的同一份材质
public void SetMaterialInstance(int index, MaterialInstance pMonoObj)
{
ICall_RenderComponent_SetMaterialInstance(this, index, pMonoObj, false);
}
///
/// 设置材质实例到指定的材质索引
///
/// 渲染相关组件的材质索引
/// 要设置的材质实例
/// 是否要拷贝材质,默认是使用内存中的同一份材质
public void SetMaterialInstance(int index, MaterialInstance pMonoObj, bool bCopy)
{
ICall_RenderComponent_SetMaterialInstance(this, index, pMonoObj, bCopy);
}
///
/// 获得渲染相关组件的第i个材质的着色器名称
///
/// 渲染相关组件的材质索引
/// 返回相应材质的着色器名称
public String GetShaderID(int index)
{
return ICall_RenderComponent_GetShaderID(this, index);
}
///
/// 设置渲染相关组件的第i个材质的着色器
///
/// 渲染相关组件的材质索引
/// 要设置的着色器名称
public void SetShaderID(int index, String sSharderId)
{
ICall_RenderComponent_SetShaderID(this, index, sSharderId);
}
///
/// 设置渲染相关组件的第i个材质的指定贴图参数的资源路径
///
/// 渲染相关组件的材质索引
/// 材质的贴图参数名称
/// 要设置的贴图资源路径
/// 默认的0表示同步加载,1表示异步加载
public void SetTexture(int index, String sParamName, String sTexId, int iPriority)
{
ICall_RenderComponent_SetTexture(this, index, sParamName, sTexId, iPriority);
}
///
/// 设置渲染相关组件的第i个材质的指定渲染到纹理参数的参数实例
///
/// 渲染相关组件的材质索引
/// 材质的渲染到纹理参数名称
/// 要设置的渲染到纹理实例
public void SetTexture(int index, String sParamName, RenderToTexture rtt)
{
ICall_RenderComponent_SetTextureRTT(this, index, sParamName, rtt);
}
///
/// 设置渲染相关组件的第i个材质的指定浮点参数的值
///
/// 渲染相关组件的材质索引
/// 材质的浮点参数名称
/// 要设置的浮点数参数值
public void SetShaderConstantParam(int index, String sParamName, float val)
{
ICall_RenderComponent_SetShaderConstantParam(this, index, sParamName, val);
}
///
/// 设置渲染相关组件的第i个材质的指定向量参数的向量值
///
/// 渲染相关组件的材质索引
/// 材质的向量参数名称
/// 要设置的向量参数值
public void SetShaderConstantParam(int index, String sParamName, ref Vector4 val)
{
ICall_RenderComponent_SetShaderConstantParamF4(this, index, sParamName, ref val);
}
///
/// 获得渲染相关组件的着色器数量
///
/// 返回组件的着色器数量
public uint GetShaderCount()
{
return ICall_RenderComponent_GetShaderCount(this);
}
///
/// 获得渲染相关组件的材质数量
///
/// 返回组件的材质数量
public uint GetMaterialCount()
{
return ICall_RenderComponent_GetShaderCount(this);
}
///
/// 获得渲染相关组件的子网格个数
///
/// 返回子网格的个数
public uint GetSubMeshCount()
{
return ICall_RenderComponent_GetShaderCount(this);
}
///
/// 设置渲染相关组件是否可见
///
/// 设置是否可见
public void SetVisible(bool bVis)
{
ICall_RenderComponent_SetVisible(this, bVis);
}
///
/// 获取渲染相关组件是否可见
///
/// 返回true则可见,反之
public bool IsVisible()
{
return ICall_RenderComponent_IsVisible(this);
}
///
/// 单独渲染组件
///
/// 单独渲染组件使用的材质
public void StandaloneRender(MaterialInstance customMaterial)
{
ICall_RenderComponent_StandaloneRender(this, customMaterial);
}
}
}