//更新参数接口 public void UpdatePlanePara() { //Debug.Log(firstMode); if (PlaneMaterial != null) { //侧窗 if (windowsswitch.go1.gameObject.activeSelf == true) { sideWindowPositionArray[0] = new Vector4(x, y, z, 0.0f); sideWindowWidthArray[0] = 1; sideWindowHeightArray[0] = 1; sideWindowsCount = 1; } else { sideWindowsCount = 0; } PlaneMaterial.SetVectorArray("_WindowPositionArray", sideWindowPositionArray); //Debug.Log(sideWindowPositionArray[0]); PlaneMaterial.SetFloatArray("_WindowWidthArray", sideWindowWidthArray); //Debug.Log(sideWindowWidthArray[0]); PlaneMaterial.SetFloatArray("_WindowHeightArray", sideWindowHeightArray); //Debug.Log(sideWindowHeightArray[0]); PlaneMaterial.SetInt("_WindowsCount", sideWindowsCount); // Debug.Log(sideWindowsCount); //黑板灯 if (firstMode) { LampCount = lights.childCount; Debug.Log("绘制"); for (int i = 0; i < boardLights.Count; i++) { if (boardLights[i].enabled) { LampAngleArray[i] = boardLights[i].transform.forward.normalized; LampPositionArray[i] = boardLights[i].transform.position; LampIntensity[i] = 1000 * boardLights[i].intensity / LightOutput.OutdoorIllumination; LampSpotAngle[i] = boardLights[i].transform.GetComponent <Light>().spotAngle; } } //LampCount = ceilingLight.Count + boardLights.Count; } else { LampCount = 0; Debug.Log("不绘制"); } PlaneMaterial.SetVectorArray("_LampAngleArray", LampAngleArray); Debug.Log(LampAngleArray[0]); PlaneMaterial.SetVectorArray("_LampPositionArray", LampPositionArray); PlaneMaterial.SetFloatArray("_LampIntensity", LampIntensity); //传入的变量是spotlight的intensity乘以了一个系数 PlaneMaterial.SetFloatArray("_LampSpotAngle", LampSpotAngle); PlaneMaterial.SetInt("_LampCount", LampCount); PlaneMaterial.SetInt("_FixedAxis", 1); } openedLight = 0; for (int i = 0; i < boardLights.Count; i++) { if (boardLights[i].enabled) { ++openedLight; } } UpdateLabels(); dataOutput.UpdateData(); }