// Use this for initialization void Start() { var wroldPos = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height + Random.Range(100.0f, 200.0f), -Camera.main.transform.position.z)); RotationPos.y = wroldPos.y; StartCreateRainTime = Random.Range(2.0f, 4.0f); RadiusMoveSpeed = Random.Range(0.5f, 0.7f); RotationSpeed = Random.Range(0.5f, 0.7f); StopAppearancePosY = Random.Range(Screen.height / 2, Screen.height / 2 + 200); AppearanceSpeed = Random.Range(1, 3); RainCreate = GetComponent <RainCreator>(); TreeObject = GameObject.Find("TreeManager"); }
void OnRenderObject() { RainCreator rc = GetComponent <RainCreator>(); computeShaderBuffer = rc.outputBuffer2; RainRenderer rr = GetComponent <RainRenderer>(); material.SetPass(0); material.SetBuffer("buf_Points", computeShaderBuffer); material.SetColor("_Color", splatColor); material.SetTexture("_SplatSprite", splatTexture); material.SetVector("_Size", splatSize); material.SetVector("_RainSize", rr.dropSize); material.SetVector("_WorldPos", transform.position); // fragment shader discard // geom shader discard Graphics.DrawProcedural(MeshTopology.Points, computeShaderBuffer.count); }
void OnRenderObject() { rc = GetComponent <RainCreator>(); if (rc != null && rc.getIsRunning()) { computeShaderBuffer = rc.outputBuffer1; } if (computeShaderBuffer != null && rc.getIsRunning()) { material.SetPass(0); material.SetBuffer("buf_Points", computeShaderBuffer); material.SetColor("_Color", dropColor); material.SetTexture("_DropSprite", dropTexture); material.SetVector("_Size", dropSize); material.SetVector("_WorldPos", transform.position); material.SetInt("_RainDropsCount", rc.getRainDropsCount()); Graphics.DrawProcedural(MeshTopology.Points, computeShaderBuffer.count); } //if (splat) //{ // material.shader = splatShader; // material.SetPass(0); // material.SetBuffer("buf_Points", computeShaderBuffer); // material.SetColor("_Color", splatColor); // material.SetTexture("_SplatSprite", splatTexture); // material.SetVector("_Size", splatSize); // material.SetVector("_WorldPos", transform.position); // // fragment shader discard // // geom shader discard // Graphics.DrawProcedural(MeshTopology.Points, computeShaderBuffer.count); //} }