Ejemplo n.º 1
0
 //Updateはダメ ライフサイクル要参照
 private void FixedUpdate()
 {
     //UpdateZoneはリセット
     _customRenderTexture.ClearUpdateZones();
     //更新したいフレーム数を指定して更新
     _customRenderTexture.Update(_iterationPerFrame);
 }
    //--------------functions-----------------
    //placeprobe
    void placeProbe()
    {
        ProbeArray = new GameObject[ProbeNumber];
        int midcell = Cellsize / 2;

        Debug.Log("placeprobe");

        IndirectionProbeAtlas.ClearUpdateZones();
        CustomRenderTextureUpdateZone[] ProbeTexture = new CustomRenderTextureUpdateZone[ProbeNumber];

        for (int i = 0; i < ProbeNumber; i++)
        {
            int x = i / 16;
            int y = i % 16;
            //Debug.Log(i);

            ProbeArray[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);            //new GameObject();
            ProbeArray[i].transform.position = new Vector3((x * Cellsize) + midcell, 0, (y * Cellsize) + midcell);

            //setup atlas textures
            int halftile = AtlasTileSize / 2;
            int xt       = (x * AtlasTileSize) + halftile;
            int yt       = (y * AtlasTileSize) + halftile;
            ProbeTexture[i].updateZoneSize   = new Vector3(AtlasTileSize, AtlasTileSize, 0);
            ProbeTexture[i].updateZoneCenter = new Vector3(xt, yt, 0);
        }
        IndirectionProbeAtlas.SetUpdateZones(ProbeTexture);
    }
Ejemplo n.º 3
0
    // enum LMGBtexture{
    //  albedo = 0,
    //  worldNormal = 1,
    //  worldPosition = 2,
    //  shadowMasking = 3
    // }
    #endregion

    //--------------functions-----------------
    void placeProbe()
    {
        //set slots parameters
        ProbeArray = new GameObject[ProbeNumber];
        int midcell = Cellsize / 2;

        //texture zones data
        IndirectionProbeAtlas.ClearUpdateZones();
        CustomRenderTextureUpdateZone[] ProbeTexture = new CustomRenderTextureUpdateZone[ProbeNumber];

        for (int i = 0; i < ProbeNumber; i++)
        {
            int x = i / 16;
            int y = i % 16;

            //create slots primitive
            ProbeArray[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);            //new GameObject();
            ProbeArray[i].transform.position = new Vector3((x * Cellsize) + midcell, 0, (y * Cellsize) + midcell);
            ProbeArray[i].SetActive(false);

            //create atlas textures zones
            int halftile = AtlasTileSize / 2;
            int xt       = (x * AtlasTileSize) + halftile;
            int yt       = (y * AtlasTileSize) + halftile;
            ProbeTexture[i].updateZoneSize   = new Vector3(AtlasTileSize, AtlasTileSize, 0);
            ProbeTexture[i].updateZoneCenter = new Vector3(xt, yt, 0);
        }
        //initialize the texture zones
        IndirectionProbeAtlas.SetUpdateZones(ProbeTexture);
    }
Ejemplo n.º 4
0
    void Update()
    {
        texture.ClearUpdateZones();

        DetectCollision();

        if (hitList.Count > 0)
        {
            CustomRenderTextureUpdateZone[] crtuz = GenerateZonePack(hitList);
            texture.SetUpdateZones(crtuz);
            texture.material.SetFloat("_ArrayLength", directions.Count);
            texture.material.SetVectorArray("_Array", directions);
            texture.Update(iterationPerFrame);
        }
        else
        {
            texture.SetUpdateZones(new CustomRenderTextureUpdateZone[] { defaultZone });
            if (runUpdate)
            {
                texture.Update(iterationPerFrame);
            }
        }


        hitList.Clear();
        amplitudes.Clear();
        directions.Clear();
    }
Ejemplo n.º 5
0
    void Update()
    {
        if (handleInput)
        {
            CreatePoints();
        }

        if (null == mCrTexture || mWaveMat == null)
        {
            return;
        }

        mCrTexture.ClearUpdateZones();
        if (pointQueue.Count > 0)
        {
            var point = pointQueue.Dequeue();
            mWaveMat.SetVector("_ClickPoint", new Vector4(point.x, point.y, 0, 0));
            mCrTexture.SetUpdateZones(updateZones);
            if (point == lastPoint)
            {
                mCrTexture.Update();
            }

            lastPoint = point;
        }
        else
        {
            mCrTexture.Update();
        }
    }
Ejemplo n.º 6
0
 private void Update()
 {
     //クリック時のUpdateZoneがクリック後も適応された状態にならないように一度消去する
     _customRenderTexture.ClearUpdateZones();
     UpdateZonesClickArea();
     //更新したいフレーム数を指定して更新
     _customRenderTexture.Update(iterationPerFrame);
 }
Ejemplo n.º 7
0
    void Update()
    {
        //Graphics.Blit(aTexture, rTex,m,-1);
        //m.SetTexture("_HeightMap",rTex);

        _texture.ClearUpdateZones();
        UpdateZones();
        _texture.Update(2);
    }
Ejemplo n.º 8
0
    private void FixedUpdate()
    {
        texture.ClearUpdateZones();
        updateZones.Add(defaultZone);
        UpdateMouseClickZones();
        UpdateZones();
        updateZones.Clear();

        texture.Update(iterationPerFrame);
    }
Ejemplo n.º 9
0
 void Update()
 {
     _texture.ClearUpdateZones();
     UpdateZones();
     //UpdateZones(Input.mousePosition);
     _texture.Update(1);
     _normalTexture.Update(1);
     _causticTexture.Update(1);
     _texture.Update(1);
 }
 void Update()
 {
     texture.ClearUpdateZones();
     UpdateZones();
     texture.Update(iterationPerFrame);
     myTexture2D = TextureToTexture2D(texture);
     if (Input.GetKeyDown(KeyCode.Space))
     {
         texture.Initialize();
     }
 }
Ejemplo n.º 11
0
    // Update is called once per frame
    void UpdateTexture()
    {
        if (m_CustomRenderTexture != null)
        {
            //m_ClearTimer += Time.deltaTime;
            //if(m_ClearTimer > m_ClearFrequency)
            //{
            //m_ClearTimer = 0.0f;
            //m_ClearColorIndex = (m_ClearColorIndex + 1 ) % 3;
            m_CustomRenderTexture.initializationColor = m_ClearColors[m_ClearColorIndex];

            if (m_CustomRenderTexture.initializationTexture == null)
            {
                m_CustomRenderTexture.initializationTexture = m_ClearTexture;
            }
            else
            {
                m_CustomRenderTexture.initializationTexture = null;
            }


            if (m_ClearColorIndex == 0 || m_ClearColorIndex == 2)
            {
                m_CustomRenderTexture.ClearUpdateZones();
            }

            m_CustomRenderTexture.material.SetFloat("_CheckerSize", m_CheckerSizes[m_ClearColorIndex]);
            m_CustomRenderTexture.Initialize();

            if (m_ClearColorIndex == 2)
            {
                m_CustomRenderTexture.material.SetFloat("_Alpha", 0.1f);
                m_CustomRenderTexture.updateMode = CustomRenderTextureUpdateMode.OnDemand;
                m_CustomRenderTexture.Update(10);
            }
            else
            {
                m_CustomRenderTexture.material.SetFloat("_Alpha", 0.005f);
                m_CustomRenderTexture.updateMode = CustomRenderTextureUpdateMode.Realtime;
            }
            //	}

            //if (m_ClearColorIndex == 1)
            //{
            //	m_UpdateZones[0].rotation = (m_UpdateZones[0].rotation + m_RotationSpeed * Time.deltaTime) % 360.0f;
            //	m_UpdateZones[1].rotation = (m_UpdateZones[1].rotation + m_RotationSpeed * Time.deltaTime) % 360.0f;
            //m_UpdateZones[0].rotation = (m_UpdateZones[0].rotation + m_RotationSpeed * factor) % 360.0f;
            // m_UpdateZones[1].rotation = (m_UpdateZones[1].rotation + m_RotationSpeed * factor) % 360.0f;
            //   m_CustomRenderTexture.SetUpdateZones(m_UpdateZones);
            //}
        }
    }
Ejemplo n.º 12
0
    public static int ClearUpdateZones(IntPtr l)
    {
        int result;

        try
        {
            CustomRenderTexture customRenderTexture = (CustomRenderTexture)LuaObject.checkSelf(l);
            customRenderTexture.ClearUpdateZones();
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Ejemplo n.º 13
0
    void Start()
    {
        center = new Vector3(5f, 0f, 5f);
        texture.initializationColor = Color.clear;
        texture.Initialize();
        texture.ClearUpdateZones();
        p.x = target.position.x * 0.1f * texture.width;
        p.y = target.position.z * 0.1f * texture.height;
        material.SetVector("_WorldPos", p);

        var defaultZone = new CustomRenderTextureUpdateZone();

        defaultZone.needSwap         = true;
        defaultZone.passIndex        = 0;
        defaultZone.rotation         = 0f;
        defaultZone.updateZoneCenter = new Vector2(0.5f, 0.5f);
        defaultZone.updateZoneSize   = new Vector2(1f, 1f);

        texture.SetUpdateZones(new CustomRenderTextureUpdateZone[] { defaultZone });
    }
Ejemplo n.º 14
0
 void Update()
 {
     _texture.ClearUpdateZones();
     _texture.Update(5);
 }
Ejemplo n.º 15
0
 void FixedUpdate()
 {
     texture.ClearUpdateZones();
     UpdateZones();
     texture.Update(iterationPerFrame);
 }
Ejemplo n.º 16
0
 void Update()
 {
     texture.ClearUpdateZones();
     UpdateZones();
     texture.Update(countPreFrame);
 }