• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Renderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Renderer的典型用法代码示例。如果您正苦于以下问题:C# Renderer类的具体用法?C# Renderer怎么用?C# Renderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Renderer类属于命名空间,在下文中一共展示了Renderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Terrain

 public Terrain(Device device, String texture, int pitch, Renderer renderer)
 {
     HeightMap = new System.Drawing.Bitmap(@"Data/Textures/"+texture);
     WaterShader = new WaterShader(device);
     TerrainShader = new TerrainShader(device);
     _width = HeightMap.Width-1;
     _height = HeightMap.Height-1;
     _pitch = pitch;
     _terrainTextures = new ShaderResourceView[4];
     _terrainTextures[0] = new Texture(device, "Sand.png").TextureResource;
     _terrainTextures[1] = new Texture(device, "Grass.png").TextureResource;
     _terrainTextures[2] = new Texture(device, "Ground.png").TextureResource;
     _terrainTextures[3] = new Texture(device, "Rock.png").TextureResource;
     _reflectionClippingPlane = new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
     _refractionClippingPlane = new Vector4(0.0f, -1.0f, 0.0f, 0.0f);
     _noClippingPlane = new Vector4(0.0f, 1.0f, 0.0f, 10000);
     _reflectionTexture = new RenderTexture(device, renderer.ScreenSize);
     _refractionTexture = new RenderTexture(device, renderer.ScreenSize);
     _renderer = renderer;
     _bitmap = new Bitmap(device,_refractionTexture.ShaderResourceView,renderer.ScreenSize, new Vector2I(100, 100), 0);
     _bitmap.Position = new Vector2I(renderer.ScreenSize.X - 100, 0);
     _bitmap2 = new Bitmap(device, _reflectionTexture.ShaderResourceView, renderer.ScreenSize, new Vector2I(100, 100), 0);
     _bitmap2.Position = new Vector2I(renderer.ScreenSize.X - 100, 120);
     _bumpMap = _renderer.TextureManager.Create("OceanWater.png");
     _skydome = new ObjModel(device, "skydome.obj", renderer.TextureManager.Create("Sky.png"));
     BuildBuffers(device);
     WaveTranslation = new Vector2(0,0);
 }
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:28,代码来源:Terrain.cs


示例2: Awake

	/// <summary>
	/// 
	/// </summary>
	void Awake()
	{

		m_Transform = transform;

		// the muzzleflash is meant to use the 'Particles/Additive'
		// (unity default) shader which has the 'TintColor' property
		m_Color = renderer.material.GetColor("_TintColor");
		m_Color.a = 0.0f;

		m_ForceShow = false;

		// if a light is present in the prefab we will cache and use it
		m_Light = light;
		if (m_Light != null)
		{
			m_LightIntensity = m_Light.intensity;
			m_Light.intensity = 0.0f;
		}

		m_Renderer = renderer;
		if (m_Renderer != null)
			m_Material = renderer.material;

	}
开发者ID:Barthuc,项目名称:ProjectLevelDesign,代码行数:28,代码来源:vp_MuzzleFlash.cs


示例3: Start

	// Use this for initialization
	void Start () 
	{
		index = 0;
		_renderer = GetComponent<Renderer> ();
		//renderer.enabled=true;

	}
开发者ID:Solobolt,项目名称:Aurora,代码行数:8,代码来源:ChangeMaterial.cs


示例4: EntersFog

 void EntersFog()
 {
     smoke = GameObject.Find ("Smoke");
     smokeRenderer = smoke.GetComponent<Renderer> ();
     smokeRenderer.enabled = true;
     player.purityEnabled = true;
 }
开发者ID:alexveillette,项目名称:castleof1000sins,代码行数:7,代码来源:WarpScript.cs


示例5: Start

 void Start()
 {
     rend = GetComponent<Renderer>();
     rend.enabled = true;
     hookStartPos = this.transform.position;
     lineStartPos = line.transform.position;
 }
开发者ID:gthoma17,项目名称:cosc457,代码行数:7,代码来源:fishCollider.cs


示例6: GetBounds

    public static Bounds GetBounds(Renderer r)
    {
        if (r is SkinnedMeshRenderer) {
            SkinnedMeshRenderer smr = r as SkinnedMeshRenderer;
            Mesh mesh = smr.sharedMesh;

            Vector3[] vertices = mesh.vertices;
            if (vertices.Length <= 0) {
                return r.bounds;
            }
            int idx = 0;
            Vector3 min, max;
            min = max = r.transform.TransformPoint (vertices [idx++]);

            for (int i = idx; i < vertices.Length; i++) {
                Vector3 v = vertices [i];
                Vector3 V = r.transform.TransformPoint (v);
                for (int n = 0; n < 3; n++) {
                    if (V [n] > max [n])
                        max [n] = V [n];
                    if (V [n] < min [n])
                        min [n] = V [n];
                }
            }

            Bounds b = new Bounds ();;
            b.SetMinMax (min, max);
            return b;

        } else {
            return r.bounds;
        }
    }
开发者ID:shinobushiva,项目名称:Unity-Utils,代码行数:33,代码来源:Helper.cs


示例7: Start

    void Start()
    {
        rend = GetComponentInChildren<Renderer>();
        //skammekrog = false;

        //mouse = GameObject.Find("CylinderMouse");
    }
开发者ID:Bitja,项目名称:MPS,代码行数:7,代码来源:GradiantLamp.cs


示例8: Start

    //    private Item m_item;
    private void Start()
    {
        m_sphereCollider = this.GetComponent<SphereCollider>();
        m_renderer = this.GetComponent<Renderer>();

        //m_item = new Item(itemName, itemDesc, itemID, itemType);
    }
开发者ID:Patchthesock,项目名称:RoosClues,代码行数:8,代码来源:ItemControl.cs


示例9: Start

    // Use this for initialization
    void Start()
    {
        quad = transform.Find("Quad");
        quadRenderer = quad.renderer;

        UvProjector.ProjectUvs(new Transform[]{quad}, cameraAnchor, Camera.main);
    }
开发者ID:parahunter,项目名称:unity-teaching-example,代码行数:8,代码来源:SlideFlexible.cs


示例10: Awake

 void Awake()
 {
     s_moneycalc = money.GetComponent<moneycalc>();
     renderer = gameObject.GetComponent<Renderer>();
     go_GUI = GameObject.Find("GUI");
     s_selecttower = go_GUI.GetComponent<selecttower>();
 }
开发者ID:Y009,项目名称:IXX1410---Tarkvara---projekt,代码行数:7,代码来源:Buildplace.cs


示例11: TextRenderer

        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        /// <param name="width">The width of the backing store in pixels.</param>
        /// <param name="height">The height of the backing store in pixels.</param>
        /// <param name="renderer">GWEN renderer.</param>
        public TextRenderer(int width, int height, Renderer.OpenTK renderer)
        {
            if (width <= 0)
                throw new ArgumentOutOfRangeException("width");
            if (height <= 0)
                throw new ArgumentOutOfRangeException("height");
            if (GraphicsContext.CurrentContext == null)
                throw new InvalidOperationException("No GraphicsContext is current on the calling thread.");

            bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            gfx = Graphics.FromImage(bmp);

            // NOTE:    TextRenderingHint.AntiAliasGridFit looks sharper and in most cases better
            //          but it comes with a some problems.
            //
            //          1.  Graphic.MeasureString and format.MeasureCharacterRanges 
            //              seem to return wrong values because of this.
            //
            //          2.  While typing the kerning changes in random places in the sentence.
            // 
            //          Until 1st problem is fixed we should use TextRenderingHint.AntiAlias...  :-(

            gfx.TextRenderingHint = TextRenderingHint.AntiAlias;
            gfx.Clear(Color.Transparent);
            texture = new Texture(renderer) {Width = width, Height = height};
        }
开发者ID:Robmaister,项目名称:gwen-dotnet,代码行数:32,代码来源:TextRenderer.cs


示例12: positionObjectWithRendererBoundsData

    //for moving object based on gaze coordinates from tracker
    //based on resolution of window
    //receives object, renderer, bounds script, and data script
    //returns vector3 position in world coordinates
    public Vector3 positionObjectWithRendererBoundsData(GameObject theObject, Renderer theRenderer, Bounds theBounds, GazeDataManager theData) {
        //verify the gaze data
        if (theData.gazeCoords != null) {
            //convert gaze coords to screen coords
            Point2D screenCoords = DataUtilities.gazePointToWindowPoint(theData.gazeCoords);

            //convert window coords to viewport coords
            Point2D viewCoords = DataUtilities.windowPointToViewPoint(screenCoords);
            Vector3 viewVector = new Vector3((float)viewCoords.X, (float)(viewCoords.Y), 0);

            //check bounds
            //use the object with the outermost bounds and a renderer to make the check
            Vector3 boundsVector = theBounds.checkBoundsForRenderer(theRenderer, viewVector);

            //convert viewport vector to world position vector
            Vector3 worldPos = Camera.main.ViewportToWorldPoint(boundsVector);
            worldPos.z = theObject.transform.position.z; //maintain z position for object

            //return new world position
            return worldPos;

        }
        //error
        else {
            //Debug.Log("[GazeMove] Null gaze data, " + theObject.name + " cannot be positioned");
            return Vector3.zero;
        }
    } //end function
开发者ID:Ar2rZ,项目名称:tetbeams,代码行数:32,代码来源:GazeMove.cs


示例13: SetBright

 public void SetBright(Renderer[] brightItem,int brightIndex)
 {
     for (int i=0; i<7; i++) {
         ((Renderer)brightItem.GetValue (i)).material.color = new Color(((Renderer)brightItem.GetValue (i)).material.color.r,((Renderer)brightItem.GetValue (i)).material.color.g,((Renderer)brightItem.GetValue (i)).material.color.b,.5f);
     }
     ((Renderer)brightItem.GetValue (brightIndex-1)).material.color = new Color(((Renderer)brightItem.GetValue (brightIndex-1)).material.color.r,((Renderer)brightItem.GetValue (brightIndex-1)).material.color.g,((Renderer)brightItem.GetValue (brightIndex-1)).material.color.b,1f);
 }
开发者ID:yanghyunjin,项目名称:IoTAR,代码行数:7,代码来源:Palette.cs


示例14: Start

	// Use this for initialization
	void Start () {
		_renderer = GetComponent<Renderer>();
		_renderer.material.shader = Shader.Find("MK/MKGlow/Transparent/DiffuseRim");



	}
开发者ID:kutan74,项目名称:Pull-ios,代码行数:8,代码来源:ShieldValues.cs


示例15: Start

    // Use this for initialization
    void Start()
    {
        rend = GetComponent<Renderer> ();

        clipRange = rend.material.GetFloat ("_ClipRange");
        range = rend.material.GetVector ("_Range").x;
    }
开发者ID:Monetai,项目名称:TANKandTANK,代码行数:8,代码来源:Explosion.cs


示例16: Start

 // Use this for initialization
 void Start()
 {
     rend = GetComponent<Renderer>();
     pl = GameObject.FindGameObjectWithTag("Player");
     Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<Collider2D>());
     Physics2D.IgnoreCollision(GetComponent<Collider2D>(), pl.GetComponent<CircleCollider2D>());
 }
开发者ID:crazymeeshu,项目名称:scriptcaster,代码行数:8,代码来源:spout.cs


示例17: Awake

	void Awake()
	{
		mytransform = transform;
		myrenderer = GetComponent<Renderer>();
		size = Vector2.one * 0.25f;
		gameObject.active = false;
	}
开发者ID:TrojanFighter,项目名称:U3D-DesignerBehaviorTest1,代码行数:7,代码来源:Ef_blood.cs


示例18: Start

	void Start()
	{
		instance = this;
		popRend = GameObject.Find ("ControlPadPop2").GetComponent<Renderer>();

		//lev 1
		if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstLightLevel)
		{
			transform.position = offScreen;
			popRend.material.mainTexture = Resources.Load("PopTextures/HighFivePop") as Texture;
		}
		/*
		//lev 2
		else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstTriggerLevel)
		{
			transform.position = triggerLev;
			popRend.material.mainTexture = Resources.Load("PopTextures/SwitchPop") as Texture;
		}
		//lev 3
		else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstZapLevel)
		{
			transform.position = zapLev;
			popRend.material.mainTexture = Resources.Load("PopTextures/ControlePadZap") as Texture;
		}
		//lev 4
		else if(LevelFinishedController.instance.getLevel() == FloorInstructions.instance.firstDecoyLevel)
		{
			transform.position = decoyLev;
			popRend.material.mainTexture = Resources.Load("PopTextures/ControlePadDecoy") as Texture;
		}
		*/
	}
开发者ID:HoneyTribe,项目名称:Labirynth,代码行数:32,代码来源:PopTriggerContainer2.cs


示例19: Draw

        public override void Draw(Renderer renderer)
        {
            if (!isVisible) return;
            if (AnimatedTexture == null)
            {
                base.Draw(renderer);
                return;
            }

            Main.renderer.Draw(bg, new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y),
                Color.White * 0.95f * globalopacity);
            if (IsIn(InputEngine.curMouse.X,InputEngine.curMouse.Y) && !IsFading)
            {
                if (Utilities.Tools.IsRunningOnMono())
                {
                    Main.renderer.Draw(mono_fbo, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight), Color.White);
                }
                else
                {
                    DrawStencilView();
                    Main.renderer.BeginUnscaled();
                }
            }
            else
            {
                Main.renderer.Draw(CurTexture, new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y),
                    new Color(255, 255, 175) * textopacity * globalopacity);
            }
        }
开发者ID:XZelnar,项目名称:MicroWorld,代码行数:29,代码来源:MenuAnimatedButton.cs


示例20: Start

    void Start()
    {
        player = GetComponent<Player>();
		audioSource = GetComponent<AudioSource>();
		quadRenderer = GetComponentInChildren<Renderer>();
		startColor = quadRenderer.material.color;

        victoryText.text = "";
        health = 100;
     	
		if(winCount == null) {
			winCount = new int[2];
			winCount[0] = 0;
			winCount[1] = 0;
		}

        deadNow = false;
        if (winCount[player.number] > 0)
        {

            winCountText.text = winCount[player.number].ToString();
            winCountText.text += winCount[player.number] == 1 ? " WIN" : " WINS";
            winCountText.gameObject.SetActive(true);
        }
        Debug.Log("Player " + player.number + "win count = " + winCount[player.number]);
    }
开发者ID:gamesketches,项目名称:ButtonMashClumpPrototype,代码行数:26,代码来源:PlayerHealth.cs



注:本文中的Renderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Rendering类代码示例发布时间:2022-05-24
下一篇:
C# RenderTextureFormat类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap