예제 #1
0
        protected void Start()
        {
            this.function = this.GetComponentInChildren <IFunctionProvider>()?.Function;
            LogTool.LogAssertIsTrue(this.function != null, "Cannot find function");

            this.matrial = new DisposableMaterial(new Material(Shader.Find("Diffuse")));
            this.matrial.Data.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);

            var meshFiter  = this.gameObject.FindOrAddTypeInComponentsAndChildren <MeshFilter>();
            var meshRender = this.gameObject.FindOrAddTypeInComponentsAndChildren <MeshRenderer>();

            meshRender.material = this.matrial;


            var mesh = FunctionTool.GenerateFunctionMesh(this.function);

            meshFiter.mesh = mesh;
        }
        public JsonResult Edit(DisposableMaterial model)
        {
            var apiResult = new APIResult();

            try
            {
                DisposableMaterialBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
예제 #3
0
        protected void InitRender()
        {
            if (this.nodeMesh == null)
            {
                var go = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                this.nodeMesh = go.GetComponent <MeshFilter>().mesh;
                go.DestoryObj();
            }
            if (this.edgeMesh == null)
            {
                this.edgeMesh = this.GenerateEdgeMesh();
            }


            this.edgeMaterial = new DisposableMaterial(this.edgeShader);
            this.nodeMaterial = new DisposableMaterial(this.nodeShader);

            this.SetupIndirectBuffer(this.data.edgeIndirectBuffer, this.edgeMesh, this.data.edgeCount);
            this.SetupIndirectBuffer(this.data.nodeIndirectBuffer, this.nodeMesh, this.data.nodeCount);
        }