当前位置: 首页>>代码示例>>C#>>正文


C# Renderer类代码示例

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


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


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