Пример #1
0
    public void createProjectedDynamicDecal(Vector3 position, Quaternion rotation, Vector3 scale, Material mat, int layer, bool isCubeMap)
    {
        SceneData sd = gameObject.GetComponent <SceneData>();

        if (sd == null)
        {
            Debug.Log("Error in function createProjectedDynamicDecal(), SceneData not found. No action taken");
            return;
        }

        GameObject obj = new GameObject();

        obj.name = "ProjectedDynamicDecal";
        obj.tag  = "ProjectedStaticDecal";
        ProjectedStaticDecal decal = obj.AddComponent <ProjectedStaticDecal>();

        obj.transform.position   = position;
        obj.transform.rotation   = rotation;
        obj.transform.localScale = scale;

        decal.material = mat;
        decal.layer    = layer;
        decal.cubeMap  = isCubeMap;

        decal.create(sd);
        pddList.Add(decal);

        pddBatcher.addDecal(decal);

        decal.updateMesh();

        pddBatcher.updateBatch();
    }
Пример #2
0
    public void createProjectedStaticDecal(string dname, SceneData sd)
    {
        GameObject obj = new GameObject();

        if (dname == "")
        {
            obj.name = "Default Projected Decal";
        }
        else
        {
            obj.name = dname;
            dname    = "";
        }
        obj.tag = "ProjectedStaticDecal";
        obj.AddComponent(typeof(ProjectedStaticDecal));
        obj.transform.parent = sd.transform;

        ProjectedStaticDecal decal = obj.GetComponent <ProjectedStaticDecal>();

        decal.create(sd);
        psdList.Add(decal);

        // add to batch
        psdBatcher.addDecal(decal);
    }