本文整理汇总了C#中Rhino.ToFloatArray方法的典型用法代码示例。如果您正苦于以下问题:C# Rhino.ToFloatArray方法的具体用法?C# Rhino.ToFloatArray怎么用?C# Rhino.ToFloatArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino
的用法示例。
在下文中一共展示了Rhino.ToFloatArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalMaterialBitmapFromEvaluator
private static void InternalMaterialBitmapFromEvaluator(CyclesShader shader, RenderTexture renderTexture,
RenderMaterial.StandardChildSlots textureType, Rhino.Geometry.Transform rhinotfm, uint rId, TextureEvaluator actualEvaluator,
TextureProjectionMode projectionMode, TextureEnvironmentMappingMode envProjectionMode)
{
int pheight;
int pwidth;
try
{
int u, v, w;
renderTexture.PixelSize(out u, out v, out w);
pheight = u;
pwidth = v;
}
catch (Exception)
{
pheight = 1024;
pwidth = 1024;
}
if (pheight == 0 || pwidth == 0)
{
pheight = 1024;
pwidth = 1024;
}
Transform t = new Transform(
rhinotfm.ToFloatArray(true)
);
var isFloat = renderTexture.IsHdrCapable();
var isLinear = renderTexture.IsLinear();
if (isFloat)
{
var img = RetrieveFloatsImg(rId, pwidth, pheight, actualEvaluator, false, false, isLinear);
img.ApplyGamma(shader.Gamma);
switch (textureType)
{
case RenderMaterial.StandardChildSlots.Diffuse:
shader.DiffuseTexture.IsLinear = isLinear;
shader.DiffuseTexture.TexFloat = img.Data;
shader.DiffuseTexture.TexByte = null;
break;
case RenderMaterial.StandardChildSlots.Bump:
shader.BumpTexture.IsLinear = isLinear;
shader.BumpTexture.TexFloat = img.Data;
shader.BumpTexture.TexByte = null;
break;
case RenderMaterial.StandardChildSlots.Transparency:
shader.TransparencyTexture.IsLinear = isLinear;
shader.TransparencyTexture.TexFloat = img.Data;
shader.TransparencyTexture.TexByte = null;
break;
case RenderMaterial.StandardChildSlots.Environment:
shader.EnvironmentTexture.IsLinear = isLinear;
shader.EnvironmentTexture.TexFloat = img.Data;
shader.EnvironmentTexture.TexByte = null;
break;
}
}
else
{
var img = RetrieveBytesImg(rId, pwidth, pheight, actualEvaluator, false, false, isLinear);
img.ApplyGamma(shader.Gamma);
switch (textureType)
{
case RenderMaterial.StandardChildSlots.Diffuse:
shader.DiffuseTexture.IsLinear = isLinear;
shader.DiffuseTexture.TexFloat = null;
shader.DiffuseTexture.TexByte = img.Data;
break;
case RenderMaterial.StandardChildSlots.Bump:
shader.BumpTexture.IsLinear = isLinear;
shader.BumpTexture.TexFloat = null;
shader.BumpTexture.TexByte = img.Data;
break;
case RenderMaterial.StandardChildSlots.Transparency:
shader.TransparencyTexture.IsLinear = isLinear;
shader.TransparencyTexture.TexFloat = null;
shader.TransparencyTexture.TexByte = img.Data;
break;
case RenderMaterial.StandardChildSlots.Environment:
shader.EnvironmentTexture.IsLinear = isLinear;
shader.EnvironmentTexture.TexFloat = null;
shader.EnvironmentTexture.TexByte = img.Data;
break;
}
}
switch (textureType)
{
case RenderMaterial.StandardChildSlots.Diffuse:
shader.DiffuseTexture.TexWidth = pwidth;
shader.DiffuseTexture.TexHeight = pheight;
shader.DiffuseTexture.ProjectionMode = projectionMode;
shader.DiffuseTexture.EnvProjectionMode = envProjectionMode;
shader.DiffuseTexture.Transform = t;
shader.DiffuseTexture.Name = rId.ToString(CultureInfo.InvariantCulture);
break;
case RenderMaterial.StandardChildSlots.Bump:
shader.BumpTexture.TexWidth = pwidth;
//.........这里部分代码省略.........