本文整理汇总了C#中Shader类的典型用法代码示例。如果您正苦于以下问题:C# Shader类的具体用法?C# Shader怎么用?C# Shader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Shader类属于命名空间,在下文中一共展示了Shader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Awake
private void Awake()
{
shaderino = Shader.Find("Custom/Autofade");
DontDestroyOnLoad(this);
m_Instance = this;
m_Material = new Material(shaderino);
}
开发者ID:PiotrMi,项目名称:GlobaleMarmelade,代码行数:7,代码来源:Autofade.cs
示例2: Start
void Start()
{
_velCam = GameObject.FindGameObjectWithTag("VelocityCamera").GetComponent<VelocityCamera>();
_defaultShader = renderer.material.shader;
if(_velCam != null)
_velCam.AddToRenderList(this);
}
开发者ID:Deams51,项目名称:JerkEngine,代码行数:7,代码来源:VelocityObject.cs
示例3: Mesh
/// <summary>
/// Create a new mesh for the given client using shader as the default shader
/// </summary>
/// <param name="client"></param>
/// <param name="shader"></param>
public Mesh(Client client, Shader shader)
{
Client = client;
Shader = shader;
Id = CSycles.scene_add_mesh(Client.Id, Client.Scene.Id, Client.Scene.GetShaderSceneId(shader));
}
开发者ID:jesterKing,项目名称:CCSycles,代码行数:12,代码来源:Mesh.cs
示例4: CheckShaderAndCreateMaterial
// Unity StandardAssets.ImageEffect
protected Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
{
if (!s)
{
Debug.Log("Missing shader in " + ToString());
enabled = false;
return null;
}
if (s.isSupported && m2Create && m2Create.shader == s)
return m2Create;
/*
if (!s.isSupported)
{
NotSupported();
Debug.Log("The shader " + s.ToString() + " on effect " + ToString() + " is not supported on this platform!");
return null;
}
*/
m2Create = new Material(s);
// createdMaterials.Add(m2Create);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
开发者ID:Polytrash,项目名称:Unity_script,代码行数:26,代码来源:Dithering.cs
示例5: ParticleSimulator
public ParticleSimulator()
{
rand = new Random();
randomTextures = new Texture2D[3];
int randSize = 64;
float[] randData = new float[randSize * randSize];
for (int i = 0; i < randomTextures.Length; i++)
{
randomTextures[i] = new Texture2D(GFX.Device, randSize, randSize, 1, TextureUsage.None, SurfaceFormat.Single);
for (int j = 0; j < randData.Length; j++)
{
randData[j] = (float)(rand.NextDouble() * 2.0 - 1.0);
}
randomTextures[i].SetData<float>(randData);
}
updatePhysicsShader = new Shader();
updatePhysicsShader.VSTarget = 2;
updatePhysicsShader.PSTarget = 3;
updatePhysicsShader.CompileFromFiles("Shaders/Simulation/ParticlePhysicsP.hlsl", "Shaders/Simulation/ParticlesV.hlsl");
updateColorShader = new Shader();
updateColorShader.VSTarget = 2;
updateColorShader.PSTarget = 3;
updateColorShader.CompileFromFiles("Shaders/Simulation/ParticleColorsP.hlsl", "Shaders/Simulation/ParticlesV.hlsl");
updateSizeShader = new Shader();
updateSizeShader.VSTarget = 2;
updateSizeShader.PSTarget = 3;
updateSizeShader.CompileFromFiles("Shaders/Simulation/ParticleSizeP.hlsl", "Shaders/Simulation/ParticlesV.hlsl");
}
开发者ID:MattVitelli,项目名称:IslandAdventure,代码行数:31,代码来源:ParticleSimulator.cs
示例6: onFlightStart
protected override void onFlightStart()
{
ping = gameObject.AddComponent<AudioSource>();
WWW www = new WWW("file://" + KSPUtil.ApplicationRootPath.Replace("\\", "/") + "Parts/mumech_MuonDetector/ping.wav");
if ((ping != null) && (www != null))
{
ping.clip = www.GetAudioClip(false);
ping.volume = 0;
ping.Stop();
}
disk = transform.Find("model/disk");
if (disk != null)
{
MIN_PING_DIST = 150000;
MIN_PING_TIME = 0.2;
MAX_PING_TIME = 15;
led = transform.Find("model/led");
originalLensShader = led.renderer.material.shader;
pingLight = led.gameObject.AddComponent<Light>();
pingLight.type = LightType.Point;
pingLight.renderMode = LightRenderMode.ForcePixel;
pingLight.shadows = LightShadows.None;
pingLight.range = 1;
pingLight.enabled = false;
}
RenderingManager.AddToPostDrawQueue(3, new Callback(drawGUI));
}
开发者ID:Majiir,项目名称:MuMechLib,代码行数:30,代码来源:MuonDetector.cs
示例7: UpdateColors
public void UpdateColors(Color[] colors)
{
Color newLowColor = colors[0];
Color newMediumColor = colors[1];
Color newHighColor = colors[2];
if (m_Materials == null || m_Materials.Length == 0 ||
m_Materials[0].GetColor("_TintColor") != newLowColor ||
m_Materials[1].GetColor("_TintColor") != newMediumColor ||
m_Materials[2].GetColor("_TintColor") != newHighColor)
{
m_Shader = Shader.Find("Heatmaps/Particles/AlphaBlend");
m_Materials = new Material[3];
m_Materials[0] = new Material(m_Shader);
m_Materials[0].SetColor("_TintColor", newLowColor);
m_Materials[1] = new Material(m_Shader);
m_Materials[1].SetColor("_TintColor", newMediumColor);
m_Materials[2] = new Material(m_Shader);
m_Materials[2].SetColor("_TintColor", newHighColor);
m_RenderState = k_UpdateMaterials;
}
}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:26,代码来源:HeatmapMeshRenderer.cs
示例8: Model
public Model(int triangles, VertexArray mesh)
: base()
{
this.mesh = mesh;
this.triangles = triangles;
this.shader = ShaderLibrary.Get("basic");
}
开发者ID:johanhenriksson,项目名称:univ,代码行数:7,代码来源:Model.cs
示例9: Initialize
public static void Initialize(){
OutlineEnemy = Resources.Load<Material>("Materials/OutlineEnemy");
OutlineEnemyLock = Resources.Load<Material>("Materials/OutlineEnemyLock");
OutlineAlly = Resources.Load<Material>("Materials/OutlineAlly");
OutlineTarget = Resources.Load<Material>("Materials/OutlineTarget");
OutlineShader = OutlineTarget.shader;
}
开发者ID:dcsmitty,项目名称:UCRPG,代码行数:7,代码来源:Materials.cs
示例10: Start
public override void Start()
{
base.Start(); // Make sure to call this first
mShader = Shader.Find("Transparent/Diffuse");
mLargeItemSlotTransform = new Vector3(1.782f, .1f, -0.151f);
mLargeItemSlotScale = new Vector3(0.4f, 1f, 0.6f);
mSmallItemSlotTransform = new Vector3(-3.35f, .1f, 2.20f);
mSmallItemSlotScale = new Vector3(0.20f, 1f, 0.35f);
if (Inventory.Instance == null)
{
BuildOk = false;
//Debug.LogError("Inventory is null from UIInventoryDisplay()");
}
else
{
BuildOk = SetupPlanes();
}
if (BuildOk == false )
{
Debug.LogError("UIInventoryDisplay not set up properly.");
}
}
开发者ID:RollForReflex,项目名称:YouDunnit--Prototype,代码行数:26,代码来源:UIInventoryDisplay.cs
示例11: Start
// Use this for initialization
void Start()
{
trans = gameObject.GetComponent<Transform> ();
shad = gameObject.GetComponent<Shader> ();
rend = gameObject.GetComponent<Renderer> ();
source = gameObject.GetComponent<AudioSource> ();
}
开发者ID:whileLooper,项目名称:AudioGroup,代码行数:8,代码来源:EventControl.cs
示例12: setupMatrices
protected override void setupMatrices(ref ViewInfo curView, ref Shader shader, ref Mesh curMesh)
{
base.setupMatrices(ref curView, ref shader, ref curMesh);
shader.insertUniform(Shader.Uniform.rotation_matrix2, ref orientation2);
shader.insertUniform(Shader.Uniform.model_matrix2, ref modelMatrix2);
}
开发者ID:Richy19,项目名称:ultraSandbox,代码行数:7,代码来源:Pos2Model.cs
示例13: OnLoad
protected override void OnLoad(EventArgs e)
{
ColladaXML daeReader = new ColladaXML("collada_schema_1_4.xsd");
Console.WriteLine("Parsing File...");
daeReader.Parse(Paths.ModelPath + "face.dae");
mesh = daeReader.Mesh.Elements[2];
mesh.CreateGPUBuffers();
GL.ClearColor(Color4.Wheat);
GL.Enable(EnableCap.CullFace);
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Lequal);
GL.CullFace(CullFaceMode.Back);
shader = new Shader("hello-gl.v.glsl", "hello-gl.f.glsl");
GL.GenBuffers(1, out buf);
GL.BindBuffer(BufferTarget.ArrayBuffer, buf);
GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(mesh.VertexBuffer.Length * sizeof(float)), mesh.VertexBuffer, BufferUsageHint.StaticDraw);
GL.GenBuffers(2, out buf2);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, buf2);
GL.BufferData(BufferTarget.ElementArrayBuffer, new IntPtr(mesh.IndexBuffer.Length * sizeof(ushort)), mesh.IndexBuffer, BufferUsageHint.StaticDraw);
CreateShaders();
mouseX = X + (Width / 2);
mouseY = Y + (Height / 2);
CursorVisible = false;
OpenTK.Input.Mouse.SetPosition((double)mouseX, (double)mouseY);
lastState = OpenTK.Input.Mouse.GetState();
CursorVisible = false;
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
base.OnLoad (e);
}
开发者ID:slicedpan,项目名称:tkglengine,代码行数:35,代码来源:TestWindow.cs
示例14: TerrainGenerator
public TerrainGenerator()
{
histogramShader = new Shader();
histogramShader.CompileFromFiles("Shaders/Procedural/Histogram2D.hlsl", "Shaders/PostProcess/GenericV.hlsl");
interpolateShader = new Shader();
interpolateShader.CompileFromFiles("Shaders/Procedural/Interpolate2D.hlsl", "Shaders/Procedural/GenericTransformV.hlsl");
peakShader = new Shader();
peakShader.CompileFromFiles("Shaders/Procedural/PeakP.hlsl", "Shaders/Procedural/GenericTransformV.hlsl");
gradientShader = new Shader();
gradientShader.CompileFromFiles("Shaders/Procedural/Gradient2DP.hlsl", "Shaders/PostProcess/GenericV.hlsl");
terraceShader = new Shader();
terraceShader.CompileFromFiles("Shaders/Procedural/TerraceP.hlsl", "Shaders/PostProcess/GenericV.hlsl");
basicShader = new Shader();
basicShader.CompileFromFiles("Shaders/PostProcess/GenericP.hlsl", "Shaders/PostProcess/GenericV.hlsl");
varianceShader = new Shader();
varianceShader.CompileFromFiles("Shaders/Procedural/Variance2DP.hlsl", "Shaders/PostProcess/GenericV.hlsl");
whiteTexture = new Texture2D(GFX.Device, 1, 1, 1, TextureUsage.None, SurfaceFormat.Color);
Color[] whiteData = new Color[1] { Color.White };
whiteTexture.SetData<Color>(whiteData);
}
开发者ID:MattVitelli,项目名称:Nosferatu,代码行数:27,代码来源:TerrainGenerator.cs
示例15: Create
//TODO: NEED REFINE SHOW & HIDE, FADEOUT-IN
public static Plane Create(string name, Shader shader, Texture texture)
{
GameObject planeObject = new GameObject(name);
Plane retPlane = planeObject.AddComponent<Plane>();
retPlane.Init(shader, texture);
return retPlane;
}
开发者ID:vdoom,项目名称:Shoter,代码行数:8,代码来源:Plane.cs
示例16: Start
// Use this for initialization
void Start()
{
transShader = Shader.Find ("Transparent/Cutout/Diffuse");
trans = new Color (0, 0, 0, 0);
trees = FindObjectsOfType<Tree> ();
}
开发者ID:shinobushiva,项目名称:Unity-CalendarUI,代码行数:8,代码来源:TreeColorChanger.cs
示例17: Init
public void Init(Shader shader, Texture texture)
{
if (shader == null)
{
shader = Shader.Find("submarine/Planes/Normal");
}
if (shader == null)
{
shader = Shader.Find("Unlit/Texture");
}
base.Init(shader);
Renderer rdr = gameObject.GetComponent<MeshRenderer>();
if (rdr.sharedMaterial != null)
{
if (texture != null)
{
rdr.sharedMaterial.mainTexture = texture;
ReinitMesh();
}
//todo: need default texture
//else
//{
//}
}
}
开发者ID:vdoom,项目名称:Shoter,代码行数:27,代码来源:Plane.cs
示例18: CreateShaderFromFile
protected override void CreateShaderFromFile(string name, string vertShader, string fragShader)
{
Shader shader = new Shader();
shader.Name = name;
//Initialize the OpenGL Program
shader.ProgramId = GL.CreateProgram();
int vertShaderId, fragShaderId;
LoadShader(vertShader, ShaderType.VertexShader, shader.ProgramId, out vertShaderId);
LoadShader(fragShader, ShaderType.FragmentShader, shader.ProgramId, out fragShaderId);
//Deincriment the reference count on the shaders so that they
//don't exist until the context is destroyed.
GL.DeleteShader(vertShaderId);
GL.DeleteShader(fragShaderId);
GL.BindAttribLocation(shader.ProgramId, (int)ShaderAttributeIds.Position, "vertexPos");
GL.BindAttribLocation(shader.ProgramId, (int)ShaderAttributeIds.Color, "inColor");
GL.BindAttribLocation(shader.ProgramId, (int)ShaderAttributeIds.TexCoord, "vertexUV");
//Link shaders
GL.LinkProgram(shader.ProgramId);
shader.UniformMVP = GL.GetUniformLocation(shader.ProgramId, "modelview");
shader.UniformColor = GL.GetUniformLocation(shader.ProgramId, "inColor");
if (GL.GetError() != ErrorCode.NoError)
Console.WriteLine(GL.GetProgramInfoLog(shader.ProgramId));
_shaders.Add(name, shader);
}
开发者ID:CryZe,项目名称:WindEditor,代码行数:32,代码来源:J3DRenderer.cs
示例19: EquipFXUILogicManager
public EquipFXUILogicManager()
{
AssetCacheMgr.GetUIResource("FlowLightShaderWithTwirl.shader", (obj) => { m_shaderFlowLight = (Shader)obj; });
AssetCacheMgr.GetUIResource("PlayerShader.shader", (obj) => { m_playerShader = (Shader)obj; });
foreach (var item in EquipSpecialEffectData.dataMap)
{
if (item.Value.group == 1)
{
++JewelFXNum;
}
else if (item.Value.group == 2)
{
++EquipFXNum;
}
else if (item.Value.group == 3)
{
++StrenthFXNum;
}
}
Mogo.Util.EventDispatcher.AddEventListener<int, int>("EquipFXUIActiveBtnUp", OnActiveBtnUp);
Mogo.Util.EventDispatcher.AddEventListener<byte,byte>("ActiveSepciaclEffectsResp", OnActiveFXResp);
}
开发者ID:lbddk,项目名称:ahzs-client,代码行数:25,代码来源:EquipFXUILogicManager.cs
示例20: AddShaderToProgram
public bool AddShaderToProgram(Shader addMe)
{
if (!addMe.IsLoaded())//sejker nie je nacitany
return false;
GL.AttachShader(ProgramHandle, addMe.GetShaderHandle());
return true;
}
开发者ID:xmatakt,项目名称:bakalarka,代码行数:7,代码来源:ShaderProgram.cs
注:本文中的Shader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论