Наследование: Component
 void Init()
 {
     if (m_renderer == null) {
     m_renderer = gameObject.GetComponent<Renderer>();
     m_position = gameObject.transform.localPosition;
     }
 }
Пример #2
0
        private void Start()
        {
            _rigidbody = GetComponent<Rigidbody2D>();
            _renderer = GetComponent<SpriteRenderer>();

            _controller.Jump += Jump;
        }
Пример #3
0
 private void Awake()
 {
     myRenderer = GetComponentInChildren<Renderer> ();
     originalTexture = myRenderer.material.mainTexture;
     SetStartPosition (startPosition);
     InitMapObjectType();
 }
Пример #4
0
 public TextSize(TextMesh tm)
 {
     textMesh = tm;
     renderer = tm.renderer;
     dict = new Hashtable();
     getSpace();
 }
Пример #5
0
			void Awake()
			{
				this.grid = transform.parent.parent.GetComponent<Grid> ();
				renderer = GetComponent<Renderer> ();
				randomize = false; // to set baseColor
				renderer.material.color = baseColor;
			}
Пример #6
0
 void Start()
 {
     bout = transform.GetChild(0).GetComponent<Renderer>();
     centre = transform.GetChild(1).GetComponent<Renderer>();
     pointe = transform.GetChild(2).GetComponent<Renderer>();
     reset();
 }
		void Start(){
			if(cursorIndicatorMode!=_CursorIndicatorMode.None){
				if(indicatorBuildPoint!=null){
					indicatorBuildPoint=(GameObject)Instantiate(indicatorBuildPoint);
					indicatorBuildPoint.transform.localScale=new Vector3(gridSize, 1, gridSize);
					indicatorBuildPoint.transform.parent=transform;
					indicatorBuildPoint.SetActive(false);
					indicatorCursor.name="TileIndicator_BuildPoint";
					
					foreach(Transform child in indicatorBuildPoint.transform) 
						indicatorBuildPointRen=child.GetComponent<Renderer>();
				}
				
				if(indicatorCursor!=null){
					indicatorCursor=(GameObject)Instantiate(indicatorCursor);
					indicatorCursor.transform.localScale=new Vector3(gridSize, 1, gridSize);
					indicatorCursor.transform.parent=transform;
					indicatorCursor.SetActive(false);
					indicatorCursor.name="TileIndicator_Cursor";
					
					foreach(Transform child in indicatorCursor.transform) 
						indicatorCursorRen=child.GetComponent<Renderer>();
				}
			}
			
			InitiateSampleTowerList();
		}
Пример #8
0
		public void OnAssignMaterialModel (Material material, Renderer renderer) {
			if (importer == null) return;
			importer.assetPostprocessor = this;
			importer.assetImporter = this.assetImporter;
			importer.assetPath = this.assetPath;
			importer.AssetGraphOnAssignMaterialModel(material, renderer);
		}
Пример #9
0
		public static string ExportToString (Mesh mesh, Renderer renderer, bool uselhcoords = true, bool separateSubmeshes = true){
			Material[] mats = renderer.sharedMaterials;
			// Initiation
			StringBuilder sb = new StringBuilder();
			//Header
			sb.Append("o ").Append("Plane").Append("\n");
			foreach(Vector3 v in mesh.vertices) {
				sb.Append(string.Format("v {0:0.000000} {1:0.000000} {2:0.000000}\n",(uselhcoords?-v.x:v.x),v.y,v.z));
			}
			sb.Append("\n");
			foreach(Vector3 v in mesh.normals) {
				sb.Append(string.Format("vn {0:0.000000} {1:0.000000} {2:0.000000}\n",v.x,v.y,v.z));
			}
			sb.Append("\n");
			foreach(Vector3 v in mesh.uv) {
				sb.Append(string.Format("vt {0:0.000000} {1:0.000000}\n",v.x,v.y));
			}
			for (int material=0; material < mesh.subMeshCount; material ++) {
				sb.Append("\n");
				if (separateSubmeshes){
					sb.Append("g ").Append(mats[material].name).Append("\n");
				}
				sb.Append("usemtl ").Append(mats[material].name).Append("\n");
				sb.Append("usemap ").Append(mats[material].name).Append("\n");
				
				int[] triangles = mesh.GetTriangles(material);
				for (int i=0;i<triangles.Length;i+=3) {
					sb.Append(string.Format("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\n", 
					                        triangles[(uselhcoords?i+1:i)]+1, triangles[(uselhcoords?i:i+1)]+1, triangles[i+2]+1));
				}
			}
			return sb.ToString();
		}
Пример #10
0
		public MaterialCache(Renderer renderer)
		{
			if(renderer as SpriteRenderer)
			{
				return;
			}
			
			List<Material> l_materialList = new List<Material>();
			
			foreach(Material material in renderer.sharedMaterials)
			{
				Material materialInstance = null;
				
				if(material)
				{
					materialInstance = GameObject.Instantiate<Material>(material);
					materialInstance.hideFlags = HideFlags.DontSave;
					materialInstance.shader = Shader.Find("Sprites/Default");
				}
				
				l_materialList.Add(materialInstance);
			}
			
			m_Materials = l_materialList.ToArray();
			
			renderer.sharedMaterials = materials;
		}
 public static void SetupMaterialPropertyBlock(MaterialProperty materialProp, int changedMask, Renderer target)
 {
   MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
   target.GetPropertyBlock(materialPropertyBlock);
   materialProp.WriteToMaterialPropertyBlock(materialPropertyBlock, changedMask);
   target.SetPropertyBlock(materialPropertyBlock);
 }
        public static bool ApplyMaterialModificationToAnimationRecording(MaterialProperty materialProp, int changedMask, Renderer target, object oldValue)
        {
            switch (materialProp.type)
            {
                case MaterialProperty.PropType.Color:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (Color) oldValue);
                    return true;

                case MaterialProperty.PropType.Vector:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (Color) ((Vector4) oldValue));
                    return true;

                case MaterialProperty.PropType.Float:
                case MaterialProperty.PropType.Range:
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(materialProp, target, (float) oldValue);
                    return true;

                case MaterialProperty.PropType.Texture:
                {
                    if (!MaterialProperty.IsTextureOffsetAndScaleChangedMask(changedMask))
                    {
                        return false;
                    }
                    string name = materialProp.name + "_ST";
                    SetupMaterialPropertyBlock(materialProp, changedMask, target);
                    ApplyMaterialModificationToAnimationRecording(name, target, (Vector4) oldValue);
                    return true;
                }
            }
            return false;
        }
Пример #13
0
 void Start()
 {
     r = HandTarget.GetComponent<Renderer>();
     rbd = GetComponent<Rigidbody>();
     rbd.useGravity = false;
     tossModule = GetComponent<PlayerTossModule> ();
 }
 void Awake()
 {
     trans = GetComponent<Transform>();
     rend = GetComponent<Renderer>();
     col = GetComponent<Collider>();
     gc = GameController.Instance;
 }
Пример #15
0
		public static string ExportToString (Mesh mesh, ref Renderer renderer, bool uselhcoords = true){
#if UNITY_EDITOR
			EditorUtility.DisplayProgressBar("EJM Software FBX Exporter", "Writing header", 0f);
#endif
			string documenttext = "; FBX 6.1.0 project file\n; Copyright (C) 1997-2008 Autodesk Inc. and/or its licensors.\n; All rights reserved.\n; ----------------------------------------------------\n\n";
			documenttext += FBXHeaderExtensionNode ();
			documenttext += "\n\n; Object definitions\n;------------------------------------------------------------------\n\n";
			documenttext += DefinitionsNode (ref mesh, ref renderer).ToString();
			documenttext += "\n\n; Object properties\n;------------------------------------------------------------------\n\n";
			string skinmodelnodes = "", defnodes = "", posenode = "";
			if (renderer.GetType() == typeof(SkinnedMeshRenderer)){
#if UNITY_EDITOR
				EditorUtility.DisplayProgressBar("EJM Software FBX Exporter", "Parsing skinning data", 0.33f);
#endif
				SkinnedMeshRenderer skmr = renderer as SkinnedMeshRenderer;
				skinmodelnodes = SkinnedModelNodes(ref skmr);
				defnodes = DeformationNodes(ref mesh, ref skmr);
				posenode = PoseNode(ref mesh);
			}
#if UNITY_EDITOR
			EditorUtility.DisplayProgressBar("EJM Software FBX Exporter", "Writing mesh data", 0.66f);
#endif
			documenttext += ObjectsNode (ModelNodes (ref mesh, uselhcoords) + skinmodelnodes, MaterialNodes (ref renderer), TextureNodes(ref renderer), defnodes, posenode, GlobalSettingsNode ().ToString());
			documenttext += "\n\n; Object connections\n;------------------------------------------------------------------\n\n";
			documenttext += ConnectionsNode (ref mesh, ref renderer).ToString();
			documenttext += "\n\n;Version 5 settings\n;------------------------------------------------------------------\n\n";
			documenttext += Version5Node ();
#if UNITY_EDITOR
						EditorUtility.ClearProgressBar();
#endif
			return documenttext;
		}
Пример #16
0
        void Start()
        {
            if (m_renderer == null)
                m_renderer = gameObject.GetComponent<Renderer>();

            m_renderer.enabled = true;
        }
Пример #17
0
 protected virtual void Awake()
 {
     MeshRenderer = GetComponent<MeshRenderer>();
     Renderer = GetComponent<Renderer>();
     Collider = GetComponent<Collider>();
     ParticleSystem = GetComponent<ParticleSystem>();
 }
Пример #18
0
		public static void ExportToFile(Mesh mesh, Renderer renderer, string filename, bool uselhcoords = true) {
			if (string.IsNullOrEmpty (filename))
				return;
			using (StreamWriter sw = new StreamWriter(filename)) {
				sw.Write(ExportToString(mesh, ref renderer, uselhcoords));
			}
		}
Пример #19
0
 private void Awake()
 {
     this._alpha = 0.001f;
     this._renderer = base.GetComponent<Renderer>();
     this._block = new MaterialPropertyBlock();
     base.enabled = false;
 }
Пример #20
0
		public void RemoveRenderer(Renderer rend) {
			if(AffectedRenderers.Contains(rend)) {
				AffectedRenderers.Remove(rend);
				mset.SkyAnchor anchor = rend.GetComponent<mset.SkyAnchor>();
				if(anchor && anchor.CurrentApplicator == this) anchor.CurrentApplicator = null;
			}
		}
Пример #21
0
		//Directly applies sky to renderers within the bounds of this applicator or its Children
		//For editor use.
		public bool ApplyInside(Renderer rend) {
			if(this.TargetSky == null || !TriggerIsActive) return false;
			mset.SkyAnchor anchor = rend.gameObject.GetComponent<mset.SkyAnchor>();
			if( anchor ) {
				//TODO: is this necessary? this was never running before
				if( anchor.BindType == mset.SkyAnchor.AnchorBindType.TargetSky && anchor.AnchorSky == TargetSky ) {
					this.TargetSky.Apply(rend,0);
					anchor.Apply();
					return true;
				}
			}

			//TODO: a bounds check against fat, child-inclusive bounds here could early-out before recursion
			//recurse
			foreach(SkyApplicator childApp in Children) {
				if(childApp.ApplyInside(rend)) return true;
			}

			Vector3 rendCenter = rend.bounds.center;
			if( anchor ) anchor.GetCenter(ref rendCenter);
			rendCenter = transform.worldToLocalMatrix.MultiplyPoint(rendCenter);

			if( TriggerDimensions.Contains(rendCenter) ) {
				this.TargetSky.Apply(rend,0);
				return true;
			}
			return false;
		}
Пример #22
0
 public override void OnStart(PartModule.StartState state)
 {
     Flap = part.FindModelTransform(flapTransform);
     cachedRenderer = Flap.gameObject.GetComponent<Renderer>();
     if (FlapActive != false)
         ToggleFlaps();
 }
Пример #23
0
        protected override void UpdateMeshData(bool forceUpdate = false)
        {
            if (_meshRenderer == null || _meshFilter == null || IsPartOfStaticBatch)
                return;

            if (GameSpriteRenderer != null && (GameSpriteRenderer != _oldGameSpriteRenderer || forceUpdate ||
                (_oldUnitySprite != null && _oldUnitySprite.sprite != null && _oldUnitySprite.sprite != Sprite) ||
                (_oldCustomSprite != null && _oldCustomSprite.Sprite != null && _oldCustomSprite.Sprite != Sprite)))
            {
                _oldGameSpriteRenderer = GameSpriteRenderer;

                _oldCustomSprite = GameSpriteRenderer.GetComponent<CustomSprite>();
                if (_oldCustomSprite != null)
                {
                    Sprite = _oldCustomSprite.Sprite;
                }
                else
                {
                    _oldUnitySprite = GameSpriteRenderer.GetComponent<SpriteRenderer>();
                    if (_oldUnitySprite != null)
                        Sprite = _oldUnitySprite.sprite;
                }

                Material.EnableKeyword("NORMAL_TEXCOORD");
            }

            if (_oldSecondaryColor != AdditiveColor || forceUpdate)
            {
                UpdateSecondaryColor();
                _isMeshDirty = true;
                _oldSecondaryColor = AdditiveColor;
            }

            base.UpdateMeshData(forceUpdate);
        }
Пример #24
0
        private GameObject InstantiateDirectionIndicator(GameObject directionIndicator)
        {
            if (directionIndicator == null)
            {
                return null;
            }

            GameObject indicator = Instantiate(directionIndicator);

            // Set local variables for the indicator.
            directionIndicatorDefaultRotation = indicator.transform.rotation;
            directionIndicatorRenderer = indicator.GetComponent<Renderer>();

            // Start with the indicator disabled.
            directionIndicatorRenderer.enabled = false;

            // Remove any colliders and rigidbodies so the indicators do not interfere with Unity's physics system.
            foreach (Collider collider in indicator.GetComponents<Collider>())
            {
                Destroy(collider);
            }

            foreach (Rigidbody rigidBody in indicator.GetComponents<Rigidbody>())
            {
                Destroy(rigidBody);
            }

            Material indicatorMaterial = directionIndicatorRenderer.material;
            indicatorMaterial.color = DirectionIndicatorColor;
            indicatorMaterial.SetColor("_TintColor", DirectionIndicatorColor);

            return indicator;
        }
        /// <summary>
        /// Attaches this object to 'attachTarget' at 'point'
        /// </summary>
        /// <param name="point">Point to attach to.</param>
        /// <param name="attachTarget">Target object.</param>
        protected void AttachToTarget () {
            targetRenderer = attachTarget.GetComponent<Renderer>();
            targetBounds = targetRenderer.bounds;
            targetPosition = attachTarget.transform.position;

            float width = targetBounds.size.x;
            float height = targetBounds.size.y;
            float attachTargetX = targetPosition.x;
            float attachTargetY = targetPosition.y;
            //NOTE (aaron): Ideally this would be independent of anchor/pivot position, but I cannot find a way to abstract
            //the local relative position of this position within the object. Therefore, this currently only works for objects
            //with centered pivots.
            switch (attachPoint) {
                case AttachPoint.BottomLeft:
                    transform.position = new Vector3(attachTargetX - width / 2, attachTargetY - height / 2, 0);
                    break;
                case AttachPoint.BottomRight:
                    transform.position = new Vector3(attachTargetX + width / 2, attachTargetY - height / 2, 0);
                    break;
                case AttachPoint.TopLeft:
                    transform.position = new Vector3(attachTargetX - width / 2, attachTargetY + height / 2, 0);
                    break;
                case AttachPoint.TopRight:
                    transform.position = new Vector3(attachTargetX + width / 2, attachTargetY + height / 2, 0);
                    break;
                case AttachPoint.BottomCenter:
                    transform.position = new Vector3(attachTargetX, attachTargetY - height / 2, 0);
                    break;
                case AttachPoint.TopCenter:
                    transform.position = new Vector3(attachTargetX, attachTargetY + height / 2, 0);
                    break;
            }
        }
Пример #26
0
        void Start()
        {
            cubeRenderer = GetComponent<Renderer>();

            // Get the starting position of the object.
            targetPosition = transform.position;
        }
Пример #27
0
        private void Awake()
        {
            myRenderer = GetComponent<Renderer> ();
            myCollider = GetComponent<Collider> ();
            myTransform = GetComponent<Transform> ();

            SetInitState ();
        }
Пример #28
0
 public override void OnStart()
 {
     var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
     if (currentGameObject != prevGameObject) {
         renderer = currentGameObject.GetComponent<Renderer>();
         prevGameObject = currentGameObject;
     }
 }
Пример #29
0
        void Awake()
        {
            // Cache a reference to object's renderer
            m_Renderer = GetComponent<Renderer>();

            // Cache a reference to object's material and create an instance by doing so.
            m_Material = m_Renderer.material;
        }
Пример #30
0
		public void AddRenderer(Renderer rend) {
			mset.SkyAnchor anchor = rend.GetComponent<mset.SkyAnchor>();
			if(anchor != null) {
				if(anchor.CurrentApplicator != null) anchor.CurrentApplicator.RemoveRenderer(rend);
				anchor.CurrentApplicator = this;
			}
			AffectedRenderers.Add(rend);
		}
    static int QPYX_get_reflectionProbeUsage_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Rendering.ReflectionProbeUsage QPYX_ret_YXQP = QPYX_obj_YXQP.reflectionProbeUsage;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index reflectionProbeUsage on a nil value"));
        }
    }
    static int QPYX_get_probeAnchor_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Transform QPYX_ret_YXQP = QPYX_obj_YXQP.probeAnchor;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index probeAnchor on a nil value"));
        }
    }
 internal extern static float GetLightmapLODLevelScale(UnityEngine.Renderer renderer);
Пример #34
0
    void _CreateGeometry()
    {
        numShadows = shadows.Count;
        if (numShadows > 0)
        {
            gameObject.layer = shadows[0].gameObject.layer;
        }


        int count = shadows.Count * 4;

        _mesh = _GetMesh();

        if (_filter == null)
        {
            _filter = GetComponent <MeshFilter>();
        }
        if (_filter == null)
        {
            _filter = gameObject.AddComponent <MeshFilter>();
        }
        if (_ren == null)
        {
            _ren = gameObject.GetComponent <MeshRenderer>();
        }
        if (_ren == null)
        {
            _ren          = gameObject.AddComponent <MeshRenderer>();
            _ren.material = shadowMaterial;
        }

        if (count < 65000)
        {
            int vidx, index;
            int indexCount = (count >> 1) * 3;
            if (_indices == null || _indices.Length != indexCount)
            {
                _indices = new int[indexCount];
            }

            bool doResize    = false;          // resize in blocks instead of every frame
            int  currentSize = 0;
            if (_verts != null)
            {
                currentSize = _verts.Length;
            }
            if (count > currentSize || count < currentSize - blockGrowSize)
            {
                doResize = true;
                count    = (UnityEngine.Mathf.FloorToInt(count / blockGrowSize) + 1) * blockGrowSize;
            }

            if (doResize)
            {
                _verts  = new UnityEngine.Vector3[count];
                _uvs    = new UnityEngine.Vector2[count];
                _norms  = new UnityEngine.Vector3[count];
                _colors = new UnityEngine.Color[count];
            }

            vidx = index = 0;
            for (int i = 0; i < shadows.Count; i++)
            {
                FS_ShadowSimple s = shadows[i];

                _verts[vidx]     = s.corners[0];
                _verts[vidx + 1] = s.corners[1];
                _verts[vidx + 2] = s.corners[2];
                _verts[vidx + 3] = s.corners[3];

                _indices[index]     = vidx;
                _indices[index + 1] = vidx + 1;
                _indices[index + 2] = vidx + 2;
                _indices[index + 3] = vidx + 2;
                _indices[index + 4] = vidx + 3;
                _indices[index + 5] = vidx;

                _uvs[vidx].x     = s.uvs.x;
                _uvs[vidx].y     = s.uvs.y;
                _uvs[vidx + 1].x = s.uvs.x + s.uvs.width;
                _uvs[vidx + 1].y = s.uvs.y;
                _uvs[vidx + 2].x = s.uvs.x + s.uvs.width;
                _uvs[vidx + 2].y = s.uvs.y + s.uvs.height;
                _uvs[vidx + 3].x = s.uvs.x;
                _uvs[vidx + 3].y = s.uvs.y + s.uvs.height;

                _norms[vidx]     = s.normal;
                _norms[vidx + 1] = s.normal;
                _norms[vidx + 2] = s.normal;
                _norms[vidx + 3] = s.normal;

                _colors[vidx]     = s.color;
                _colors[vidx + 1] = s.color;
                _colors[vidx + 2] = s.color;
                _colors[vidx + 3] = s.color;

                index += 6;
                vidx  += 4;
            }

#if UNITY_3_4
            _mesh.Clear();
#elif UNITY_3_5
            _mesh.Clear();
#else
            if (doResize)
            {
                _mesh.Clear(false);
            }
            else
            {
                _mesh.Clear(true);
            }
#endif
            // Set the mesh values
            _mesh.Clear();
            _mesh.name = "shadow mesh";

            _mesh.vertices = _verts;
            _mesh.uv       = _uvs;
            _mesh.normals  = _norms;
            _mesh.colors   = _colors;

            _mesh.triangles = _indices;
            _mesh.RecalculateBounds();
            _filter.mesh = _mesh;
            if (!isStatic)
            {
                shadows.Clear();
            }
        }
        else
        {
            if (_filter.mesh != null)
            {
                _filter.mesh.Clear();
            }
            Debug.LogError("Too many shadows. limit is " + (65000 / 4));
        }
    }
Пример #35
0
    List <UnityEngine.GameObject> GetFilteredList()
    {
        List <UnityEngine.GameObject> newMomObjs = new List <UnityEngine.GameObject>();
        MB2_MeshBakerRoot             mom        = (MB2_MeshBakerRoot)target;

        if (mom == null)
        {
            Debug.LogError("Must select a target MeshBaker to add objects to");
            return(newMomObjs);
        }
        UnityEngine.GameObject dontAddMe = null;
        UnityEngine.Renderer   r         = MB_Utility.GetRenderer(mom.gameObject);
        if (r != null)          //make sure that this MeshBaker object is not in list
        {
            dontAddMe = r.gameObject;
        }

        int numInSelection      = 0;
        int numStaticExcluded   = 0;
        int numEnabledExcluded  = 0;
        int numLightmapExcluded = 0;
        int numOBuvExcluded     = 0;

        UnityEngine.GameObject[] gos = Selection.gameObjects;
        if (gos.Length == 0)
        {
            Debug.LogWarning("No objects selected in hierarchy view. Nothing added.");
        }

        for (int i = 0; i < gos.Length; i++)
        {
            UnityEngine.GameObject go  = gos[i];
            UnityEngine.Renderer[] mrs = go.GetComponentsInChildren <UnityEngine.Renderer>();
            for (int j = 0; j < mrs.Length; j++)
            {
                if (mrs[j] is MeshRenderer || mrs[j] is SkinnedMeshRenderer)
                {
                    if (mrs[j].GetComponent <TextMesh>() != null)
                    {
                        continue;                         //don't add TextMeshes
                    }
                    numInSelection++;
                    if (!newMomObjs.Contains(mrs[j].gameObject))
                    {
                        bool addMe = true;
                        if (!mrs[j].gameObject.isStatic && onlyStaticObjects)
                        {
                            numStaticExcluded++;
                            addMe = false;
                        }

                        if (!mrs[j].enabled && onlyEnabledObjects)
                        {
                            numEnabledExcluded++;
                            addMe = false;
                        }

                        if (lightmapIndex != -2)
                        {
                            if (mrs[j].lightmapIndex != lightmapIndex)
                            {
                                numLightmapExcluded++;
                                addMe = false;
                            }
                        }

                        Mesh mm = MB_Utility.GetMesh(mrs[j].gameObject);
                        if (mm != null)
                        {
                            Rect dummy = new Rect();
                            if (MB_Utility.hasOutOfBoundsUVs(mm, ref dummy) && excludeMeshesWithOBuvs)
                            {
                                if (shaderMat != null)
                                {
                                    numOBuvExcluded++;
                                    addMe = false;
                                }
                            }
                            else
                            {
                                Debug.LogWarning("UnityEngine.Object " + mrs[j].gameObject.name + " uses uvs that are outside the range (0,1)" +
                                                 "this object can only be combined with other objects that use the exact same set of source textures (one image in each atlas)" +
                                                 " unless fix out of bounds UVs is used");
                            }
                        }

                        if (shaderMat != null)
                        {
                            Material[] nMats      = mrs[j].sharedMaterials;
                            bool       usesShader = false;
                            foreach (Material nMat in nMats)
                            {
                                if (nMat != null && nMat.shader == shaderMat.shader)
                                {
                                    usesShader = true;
                                }
                            }
                            if (!usesShader)
                            {
                                addMe = false;
                            }
                        }

                        if (mat != null)
                        {
                            Material[] nMats   = mrs[j].sharedMaterials;
                            bool       usesMat = false;
                            foreach (Material nMat in nMats)
                            {
                                if (nMat == mat)
                                {
                                    usesMat = true;
                                }
                            }
                            if (!usesMat)
                            {
                                addMe = false;
                            }
                        }

                        if (addMe && mrs[j].gameObject != dontAddMe)
                        {
                            if (!newMomObjs.Contains(mrs[j].gameObject))
                            {
                                newMomObjs.Add(mrs[j].gameObject);
                            }
                        }
                    }
                }
            }
        }
        Debug.Log("Total objects in selection " + numInSelection);
        if (numStaticExcluded > 0)
        {
            Debug.Log(numStaticExcluded + " objects were excluded because they were not static");
        }
        if (numEnabledExcluded > 0)
        {
            Debug.Log(numEnabledExcluded + " objects were excluded because they were disabled");
        }
        if (numOBuvExcluded > 0)
        {
            Debug.Log(numOBuvExcluded + " objects were excluded because they had out of bounds uvs");
        }
        if (numLightmapExcluded > 0)
        {
            Debug.Log(numLightmapExcluded + " objects did not match lightmap filter.");
        }
        return(newMomObjs);
    }
Пример #36
0
 public override void OnEnable() => Component = gameObject.GetComponent <UnityEngine.Renderer>();
    static int QPYX_set_sortingLayerName_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
            QPYX_obj_YXQP.sortingLayerName = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index sortingLayerName on a nil value"));
        }
    }
    static int QPYX_set_reflectionProbeUsage_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Rendering.ReflectionProbeUsage QPYX_arg0_YXQP = (UnityEngine.Rendering.ReflectionProbeUsage)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.Rendering.ReflectionProbeUsage));
            QPYX_obj_YXQP.reflectionProbeUsage = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index reflectionProbeUsage on a nil value"));
        }
    }
Пример #39
0
    static public void FastSetter(this UnityEngine.Renderer o, string propertyName, object value)
    {
        switch (propertyName)
        {
        case "enabled":
            o.enabled = (System.Boolean)value; return;

        case "shadowCastingMode":
            o.shadowCastingMode = (UnityEngine.Rendering.ShadowCastingMode)value; return;

        case "receiveShadows":
            o.receiveShadows = (System.Boolean)value; return;

        case "material":
            o.material = (UnityEngine.Material)value; return;

        case "sharedMaterial":
            o.sharedMaterial = (UnityEngine.Material)value; return;

        case "materials":
            o.materials = (UnityEngine.Material[])value; return;

        case "sharedMaterials":
            o.sharedMaterials = (UnityEngine.Material[])value; return;

        case "lightmapIndex":
            o.lightmapIndex = (System.Int32)value; return;

        case "realtimeLightmapIndex":
            o.realtimeLightmapIndex = (System.Int32)value; return;

        case "lightmapScaleOffset":
            o.lightmapScaleOffset = (UnityEngine.Vector4)value; return;

        case "motionVectors":
            o.motionVectors = (System.Boolean)value; return;

        case "realtimeLightmapScaleOffset":
            o.realtimeLightmapScaleOffset = (UnityEngine.Vector4)value; return;

        case "lightProbeUsage":
            o.lightProbeUsage = (UnityEngine.Rendering.LightProbeUsage)value; return;

        case "lightProbeProxyVolumeOverride":
            o.lightProbeProxyVolumeOverride = (UnityEngine.GameObject)value; return;

        case "probeAnchor":
            o.probeAnchor = (UnityEngine.Transform)value; return;

        case "reflectionProbeUsage":
            o.reflectionProbeUsage = (UnityEngine.Rendering.ReflectionProbeUsage)value; return;

        case "sortingLayerName":
            o.sortingLayerName = (System.String)value; return;

        case "sortingLayerID":
            o.sortingLayerID = (System.Int32)value; return;

        case "sortingOrder":
            o.sortingOrder = (System.Int32)value; return;

        case "tag":
            o.tag = (System.String)value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.Renderer no Setter Found : " + propertyName);
    }
    static int QPYX_get_sortingLayerID_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            int QPYX_ret_YXQP = QPYX_obj_YXQP.sortingLayerID;
            LuaDLL.lua_pushinteger(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index sortingLayerID on a nil value"));
        }
    }
    static int QPYX_get_isPartOfStaticBatch_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            bool QPYX_ret_YXQP = QPYX_obj_YXQP.isPartOfStaticBatch;
            LuaDLL.lua_pushboolean(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index isPartOfStaticBatch on a nil value"));
        }
    }
    static int QPYX_get_lightmapScaleOffset_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Vector4 QPYX_ret_YXQP = QPYX_obj_YXQP.lightmapScaleOffset;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index lightmapScaleOffset on a nil value"));
        }
    }
    static int QPYX_get_localToWorldMatrix_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Matrix4x4 QPYX_ret_YXQP = QPYX_obj_YXQP.localToWorldMatrix;
            ToLua.PushValue(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index localToWorldMatrix on a nil value"));
        }
    }
    static int QPYX_get_motionVectorGenerationMode_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.MotionVectorGenerationMode QPYX_ret_YXQP = QPYX_obj_YXQP.motionVectorGenerationMode;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index motionVectorGenerationMode on a nil value"));
        }
    }
Пример #45
0
 public static bool IsVisibleFrom(this UnityEngine.Renderer renderer, Camera camera)
 {
     Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
     return(GeometryUtility.TestPlanesAABB(planes, renderer.bounds));
 }
    static int QPYX_set_allowOcclusionWhenDynamic_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            bool QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2);
            QPYX_obj_YXQP.allowOcclusionWhenDynamic = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index allowOcclusionWhenDynamic on a nil value"));
        }
    }
Пример #47
0
    void listMaterialsInScene(bool generateMeshBakers)
    {
        Dictionary <UnityEngine.Shader, List <_GameObjectAndWarning> > shader2GameObjects = new Dictionary <UnityEngine.Shader, List <_GameObjectAndWarning> >();

        UnityEngine.Renderer[] rs = (UnityEngine.Renderer[])FindObjectsOfType(typeof(UnityEngine.Renderer));
//		Profile.StartProfile("listMaterialsInScene1");
        for (int i = 0; i < rs.Length; i++)
        {
            UnityEngine.Renderer r = rs[i];
            if (r is MeshRenderer || r is SkinnedMeshRenderer)
            {
                if (r.GetComponent <TextMesh>() != null)
                {
                    continue;                     //don't add TextMeshes
                }
                Material[] mms = r.sharedMaterials;
                List <_GameObjectAndWarning> gos;

                foreach (Material mm in mms)
                {
                    if (mm != null)
                    {
                        string warn = "";
                        if (shader2GameObjects.ContainsKey(mm.shader))
                        {
                            gos = shader2GameObjects[mm.shader];
                        }
                        else
                        {
                            gos = new List <_GameObjectAndWarning>();
                            shader2GameObjects.Add(mm.shader, gos);
                        }
                        //todo add warning for texture scaling
                        if (r.sharedMaterials.Length > 1)
                        {
                            warn += " [Uses multiple materials] ";
                        }

                        if (gos.Find(x => x.go == r.gameObject) == null)
                        {
                            gos.Add(new _GameObjectAndWarning(r.gameObject, warn, generate_LightmapOption));
                        }
                    }
                }
            }
        }

        foreach (UnityEngine.Shader m in shader2GameObjects.Keys)
        {
            int totalVerts = 0;
            List <_GameObjectAndWarning> gos = shader2GameObjects[m];
            for (int i = 0; i < gos.Count; i++)
            {
                Mesh mm     = MB_Utility.GetMesh(gos[i].go);
                int  nVerts = 0;
                if (mm != null)
                {
                    nVerts += mm.vertexCount;
                    Rect dummy = new Rect();
                    if (MB_Utility.hasOutOfBoundsUVs(mm, ref dummy))
                    {
                        int w = (int)dummy.width;
                        int h = (int)dummy.height;
                        gos[i].outOfBoundsUVs = true;
                        gos[i].warning       += " [WARNING: has uvs outside the range (0,1) tex is tiled " + w + "x" + h + " times]";
                    }
                    if (MB_Utility.doSubmeshesShareVertsOrTris(mm) != 0)
                    {
                        gos[i].submeshesOverlap = true;
                        gos[i].warning         += " [WARNING: Submeshes share verts or triangles. 'Multiple Combined Materials' feature may not work.]";
                    }
                }
                totalVerts += nVerts;
                UnityEngine.Renderer mr = gos[i].go.GetComponent <UnityEngine.Renderer>();
                if (!MB_Utility.validateOBuvsMultiMaterial(mr.sharedMaterials))
                {
                    gos[i].warning += " [WARNING: UnityEngine.Object uses same material on multiple submeshes. This may produce poor results when used with multiple materials or fix out of bounds uvs.]";
                }
            }
        }
        Dictionary <_GameObjectAndWarning, List <_GameObjectAndWarning> > gs2bakeGroupMap = new Dictionary <_GameObjectAndWarning, List <_GameObjectAndWarning> >();
        List <_GameObjectAndWarning> objsNotAddedToBaker = new List <_GameObjectAndWarning>();

        sortIntoBakeGroups2(generateMeshBakers, shader2GameObjects, gs2bakeGroupMap, objsNotAddedToBaker);

        if (generateMeshBakers)
        {
            createBakers(gs2bakeGroupMap, objsNotAddedToBaker);
            //Debug.Log( generateSceneAnalysisReport(gs2bakeGroupMap, objsNotAddedToBaker) );
        }
        else
        {
            Debug.Log(generateSceneAnalysisReport(gs2bakeGroupMap, objsNotAddedToBaker));
        }
    }
    static int QPYX_set_lightProbeProxyVolumeOverride_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.GameObject QPYX_arg0_YXQP = (UnityEngine.GameObject)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.GameObject));
            QPYX_obj_YXQP.lightProbeProxyVolumeOverride = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index lightProbeProxyVolumeOverride on a nil value"));
        }
    }
    public void DrawGUI(MB2_MeshBakerCommon target)
    {
        if (meshBaker == null)
        {
            _init(target);
        }

        meshBaker.Update();

        showInstructions = EditorGUILayout.Foldout(showInstructions, "Instructions:");
        if (showInstructions)
        {
            EditorGUILayout.HelpBox("1. Bake combined material(s).\n\n" +
                                    "2. If necessary set the 'Material Bake Results' field.\n\n" +
                                    "3. Add scene objects or prefabs to combine or check 'Same As UnityEngine.Texture Baker'. For best results these should use the same shader as result material.\n\n" +
                                    "4. Select options and 'Bake'.\n\n" +
                                    "6. Look at warnings/errors in console. Decide if action needs to be taken.\n\n" +
                                    "7. (optional) Disable renderers in source objects.", UnityEditor.MessageType.None);

            EditorGUILayout.Separator();
        }

        MB2_MeshBakerCommon mom = (MB2_MeshBakerCommon)target;

        EditorGUILayout.PropertyField(textureBakeResults, textureBakeResultsGUIContent);
        if (textureBakeResults.objectReferenceValue != null)
        {
            showContainsReport = EditorGUILayout.Foldout(showContainsReport, "Shaders & Materials Contained");
            if (showContainsReport)
            {
                EditorGUILayout.HelpBox(((MB2_TextureBakeResults)textureBakeResults.objectReferenceValue).GetDescription(), MessageType.Info);
            }
        }

        EditorGUILayout.LabelField("Objects To Be Combined", EditorStyles.boldLabel);
        if (mom.GetComponent <MB2_TextureBaker>() != null)
        {
            EditorGUILayout.PropertyField(useObjsToMeshFromTexBaker, useTextureBakerObjsGUIContent);
        }
        else
        {
            useObjsToMeshFromTexBaker.boolValue = false;
        }

        if (!mom.useObjsToMeshFromTexBaker)
        {
            if (GUILayout.Button(openToolsWindowLabelContent))
            {
                MB_MeshBakerEditorWindow mmWin = (MB_MeshBakerEditorWindow)EditorWindow.GetWindow(typeof(MB_MeshBakerEditorWindow));
                mmWin.target = (MB2_MeshBakerRoot)target;
            }
            EditorGUILayout.PropertyField(objsToMesh, objectsToCombineGUIContent, true);
        }

        EditorGUILayout.LabelField("Output", EditorStyles.boldLabel);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(doNorm, doNormGUIContent);
        EditorGUILayout.PropertyField(doTan, doTanGUIContent);
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(doUV, doUVGUIContent);
        EditorGUILayout.PropertyField(doUV1, doUV1GUIContent);
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.PropertyField(doCol, doColGUIContent);

        if (mom.lightmapOption == MB2_LightmapOptions.generate_new_UV2_layout)
        {
            EditorGUILayout.HelpBox("Generating new lightmap UVs can split vertices which can push the number of vertices over the 64k limit.", MessageType.Warning);
        }
        EditorGUILayout.PropertyField(lightmappingOption, lightmappingOptionGUIContent);

        EditorGUILayout.PropertyField(outputOptions, outputOptoinsGUIContent);
        EditorGUILayout.PropertyField(renderType, renderTypeGUIContent);
        if (mom.outputOption == MB2_OutputOptions.bakeIntoSceneObject)
        {
            mom.resultSceneObject = (UnityEngine.GameObject)EditorGUILayout.ObjectField("Combined Mesh UnityEngine.Object", mom.resultSceneObject, typeof(UnityEngine.GameObject), true);
        }
        else if (mom.outputOption == MB2_OutputOptions.bakeIntoPrefab)
        {
            mom.resultPrefab = (UnityEngine.GameObject)EditorGUILayout.ObjectField("Combined Mesh Prefab", mom.resultPrefab, typeof(UnityEngine.GameObject), true);
        }

        if (GUILayout.Button("Bake"))
        {
            bake(mom);
        }

        string enableRenderersLabel;
        bool   disableRendererInSource = false;

        if (mom.objsToMesh.Count > 0)
        {
            UnityEngine.Renderer r = MB_Utility.GetRenderer(mom.objsToMesh[0]);
            if (r != null && r.enabled)
            {
                disableRendererInSource = true;
            }
        }
        if (disableRendererInSource)
        {
            enableRenderersLabel = "Disable Renderers On Combined Objects";
        }
        else
        {
            enableRenderersLabel = "Enable Renderers On Combined Objects";
        }
        if (GUILayout.Button(enableRenderersLabel))
        {
            mom.EnableDisableSourceObjectRenderers(!disableRendererInSource);
        }

        meshBaker.ApplyModifiedProperties();
        meshBaker.SetIsDifferentCacheDirty();
    }
    static int QPYX_set_probeAnchor_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Transform QPYX_arg0_YXQP = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L_YXQP, 2);
            QPYX_obj_YXQP.probeAnchor = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index probeAnchor on a nil value"));
        }
    }
Пример #51
0
 public void BeginRender(UnityEngine.Camera camera, UnityEngine.Renderer renderer, int width, int height)
 {
     BeginRender(camera, renderer, width, height, false);
 }
    static int QPYX_set_realtimeLightmapIndex_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            int QPYX_arg0_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 2);
            QPYX_obj_YXQP.realtimeLightmapIndex = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index realtimeLightmapIndex on a nil value"));
        }
    }
    static int QPYX_set_realtimeLightmapScaleOffset_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Vector4 QPYX_arg0_YXQP = ToLua.ToVector4(L_YXQP, 2);
            QPYX_obj_YXQP.realtimeLightmapScaleOffset = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index realtimeLightmapScaleOffset on a nil value"));
        }
    }
    static int QPYX_set_sharedMaterials_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Material[] QPYX_arg0_YXQP = ToLua.CheckObjectArray <UnityEngine.Material>(L_YXQP, 2);
            QPYX_obj_YXQP.sharedMaterials = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index sharedMaterials on a nil value"));
        }
    }
    static int QPYX_get_sharedMaterials_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.Material[] QPYX_ret_YXQP = QPYX_obj_YXQP.sharedMaterials;
            ToLua.Push(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index sharedMaterials on a nil value"));
        }
    }
    static int QPYX_get_lightProbeProxyVolumeOverride_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.GameObject QPYX_ret_YXQP = QPYX_obj_YXQP.lightProbeProxyVolumeOverride;
            ToLua.PushSealed(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index lightProbeProxyVolumeOverride on a nil value"));
        }
    }
    static int QPYX_set_receiveShadows_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            bool QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2);
            QPYX_obj_YXQP.receiveShadows = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index receiveShadows on a nil value"));
        }
    }
    static int QPYX_set_motionVectorGenerationMode_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            UnityEngine.MotionVectorGenerationMode QPYX_arg0_YXQP = (UnityEngine.MotionVectorGenerationMode)ToLua.CheckObject(L_YXQP, 2, typeof(UnityEngine.MotionVectorGenerationMode));
            QPYX_obj_YXQP.motionVectorGenerationMode = QPYX_arg0_YXQP;
            return(0);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index motionVectorGenerationMode on a nil value"));
        }
    }
    static int QPYX_get_realtimeLightmapIndex_YXQP(IntPtr L_YXQP)
    {
        object QPYX_o_YXQP = null;

        try
        {
            QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1);                        UnityEngine.Renderer QPYX_obj_YXQP = (UnityEngine.Renderer)QPYX_o_YXQP;
            int QPYX_ret_YXQP = QPYX_obj_YXQP.realtimeLightmapIndex;
            LuaDLL.lua_pushinteger(L_YXQP, QPYX_ret_YXQP);
            return(1);
        }
        catch (Exception QPYX_e_YXQP)            {
            return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index realtimeLightmapIndex on a nil value"));
        }
    }
Пример #60
0
    static public object FastGetter(this UnityEngine.Renderer o, string propertyName)
    {
        switch (propertyName)
        {
        case "isPartOfStaticBatch":
            return(o.isPartOfStaticBatch);

        case "worldToLocalMatrix":
            return(o.worldToLocalMatrix);

        case "localToWorldMatrix":
            return(o.localToWorldMatrix);

        case "enabled":
            return(o.enabled);

        case "shadowCastingMode":
            return(o.shadowCastingMode);

        case "receiveShadows":
            return(o.receiveShadows);

        case "material":
            return(o.material);

        case "sharedMaterial":
            return(o.sharedMaterial);

        case "materials":
            return(o.materials);

        case "sharedMaterials":
            return(o.sharedMaterials);

        case "bounds":
            return(o.bounds);

        case "lightmapIndex":
            return(o.lightmapIndex);

        case "realtimeLightmapIndex":
            return(o.realtimeLightmapIndex);

        case "lightmapScaleOffset":
            return(o.lightmapScaleOffset);

        case "motionVectors":
            return(o.motionVectors);

        case "realtimeLightmapScaleOffset":
            return(o.realtimeLightmapScaleOffset);

        case "isVisible":
            return(o.isVisible);

        case "lightProbeUsage":
            return(o.lightProbeUsage);

        case "lightProbeProxyVolumeOverride":
            return(o.lightProbeProxyVolumeOverride);

        case "probeAnchor":
            return(o.probeAnchor);

        case "reflectionProbeUsage":
            return(o.reflectionProbeUsage);

        case "sortingLayerName":
            return(o.sortingLayerName);

        case "sortingLayerID":
            return(o.sortingLayerID);

        case "sortingOrder":
            return(o.sortingOrder);

        case "transform":
            return(o.transform);

        case "gameObject":
            return(o.gameObject);

        case "tag":
            return(o.tag);
        }
        LBoot.LogUtil.Error("UnityEngine.Renderer no Getter Found : " + propertyName);
        return(null);
    }