本文整理汇总了C#中Sprite.Init方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Init方法的具体用法?C# Sprite.Init怎么用?C# Sprite.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw()
{
PrivateRendererContext.EnableDepthTest(false);
if (InputSlots[0].SlotTexture == null)
return;
if (InputSlots[1].SlotTexture.Width != OutputTexture.Width || InputSlots[1].SlotTexture.Height != OutputTexture.Height)
{
OutputTexture.Resize(InputSlots[1].SlotTexture.Width, InputSlots[1].SlotTexture.Height);
}
PrivateRendererContext.Clear(Math.Color4.Black);
Sprite spr = new Sprite();
spr.Init(InputSlots[0].SlotTexture);
NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("Texture1"), 0);
NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("Texture2"), 1);
NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("TextureViewPosition1"), 2);
NodeEffect.PixelProgram.SetUniform(NodeEffect.PixelProgram.GetUniformLocation("TextureViewPosition2"), 3);
spr.CustomEffect = true;
PrivateRendererContext.DrawSpriteAbsolute(spr);
PrivateRendererContext.EnableDepthTest(true);
}
示例2: Draw
public override void Draw()
{
PrivateRendererContext.EnableDepthTest(false);
PrivateRendererContext.Clear(Math.Color4.Black);
if (InputSlots[0].SlotTexture != null && InputSlots[0].SlotTexture.Created)
{
Sprite spr = new Sprite();
spr.Init(InputSlots[0].SlotTexture);
spr.AbsolutePosition = new FreezingArcher.Math.Vector2(0, 0);
spr.CustomEffect = false;
PrivateRendererContext.DrawSpriteAbsolute(spr);
OutputTexture = InputSlots [0].SlotTexture;
}
PrivateRendererContext.EnableDepthTest(true);
if (EnableUI)
PrivateRendererContext.Canvas.RenderCanvas();
}
示例3: ShadeScene
private void ShadeScene()
{
Sprite spr = new Sprite();
spr.Init(FrameBufferColorTexture);
spr.CustomEffect = true;
FrameBufferDepthTexture.Bind(2);
FrameBufferNormalTexture.Bind(3);
FrameBufferSpecularTexture.Bind(4);
NoNodeEffect.BindPipeline();
NoNodeEffect.PixelProgram.SetUniform(TextureDiffuseLocation, 1);
NoNodeEffect.PixelProgram.SetUniform(TexturePositionLocation, 2);
NoNodeEffect.PixelProgram.SetUniform(TextureNomalLocation, 3);
NoNodeEffect.PixelProgram.SetUniform(TextureSpecularLocation, 4);
NoNodeEffect.PixelProgram.SetUniform(DistanceFogIntensityLocation, Scene.DistanceFogIntensity);
NoNodeEffect.PixelProgram.SetUniform(DistanceFogColorLocation, Scene.DistanceFogColor);
if (Scene != null && Scene.CameraManager.ActiveCamera != null)
NoNodeEffect.PixelProgram.SetUniform(CameraPositionLocation, Scene.CameraManager.ActiveCamera.Position);
//Setup lights
NoNodeEffect.PixelProgram.SetUniform(AmbientIntensityLocation, Scene.AmbientIntensity);
NoNodeEffect.PixelProgram.SetUniform(AmbientColorLocation, Scene.AmbientColor);
List<Light> Lights = (Scene != null) ? Scene.Lights : null;
int i = 0;
if (Lights != null)
{
for (i = 0; i < Lights.Count; i++)
{
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].TypeLocation, (int)Lights[i].Type);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].OnLocation, Lights[i].On ? 1 : 0);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].LightColorLocation, Lights[i].Color);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].DirectionalLightDirectionLocation, Lights[i].DirectionalLightDirection);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].PointLightPositionLocation, Lights[i].PointLightPosition);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].PointLightConstantAttLocation, Lights[i].PointLightConstantAttenuation);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].PointLightLinearAttLocation, Lights[i].PointLightLinearAttenuation);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].PointLightExpAttLocation, Lights[i].PointLightExponentialAttenuation);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].SpotLightConeAngleLocation, Lights[i].SpotLightConeAngle);
NoNodeEffect.PixelProgram.SetUniform(LightLocations[i].SpotLightConeCosineLocation, Lights[i].SpotLightConeCosine);
}
}
for (; i < LightLocations.Length; i++)
NoNodeEffect.PixelProgram.SetUniform (LightLocations [i].OnLocation, 0);
PrivateRendererContext.DrawSpriteAbsolute(spr, 1);
NoNodeEffect.UnbindPipeline();
}