void Start()
    {
        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                Ray currentRay = Camera.main.ViewportPointToRay(new Vector3((float)i / width, (float)j / height, Camera.main.nearClipPlane));

                RaycastHit hitInfo;

                bool didHit = Physics.Raycast(currentRay, out hitInfo);

                if (didHit)
                {
                    ShaderScript currentShader = hitInfo.transform.GetComponent <ShaderScript>();
                    canvas.SetPixel(i, j, currentShader.calcColor(hitInfo, 0));
                }
                else
                {
                    canvas.SetPixel(i, j, Color.black);
                }
            }
        }
        canvas.Apply();
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        sc0 = Cube0.GetComponent <ShaderScript>();
        sc1 = Cube1.GetComponent <ShaderScript>();
        sc2 = Cube2.GetComponent <ShaderScript>();
        sc3 = Cube3.GetComponent <ShaderScript>();
        sc4 = Cube4.GetComponent <ShaderScript>();
        sc5 = Cube5.GetComponent <ShaderScript>();
        sc6 = Cube6.GetComponent <ShaderScript>();
        sc7 = Cube7.GetComponent <ShaderScript>();


        sc0.wave = new float[64];
        sc1.wave = new float[64];
        sc2.wave = new float[64];
        sc3.wave = new float[64];
        sc4.wave = new float[64];
        sc5.wave = new float[64];
        sc6.wave = new float[64];
        sc7.wave = new float[64];

        bs0.wave = new float[64];
        bs1.wave = new float[64];
        bs2.wave = new float[64];
        bs3.wave = new float[64];
        bs4.wave = new float[64];
        bs5.wave = new float[64];
        bs6.wave = new float[64];
        bs7.wave = new float[64];

        audio = GetComponent <AudioSource>();
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        //iterate through pixels
        for (int i = 0; i < width; ++i)
        {
            for (int j = 0; j < height; ++j)
            {
                Ray currentPixelRay = Camera.main.ViewportPointToRay(
                    new Vector3((float)i / width,
                                (float)j / height,
                                Camera.main.nearClipPlane));

                RaycastHit hitInfo;
                bool       hit = Physics.Raycast(currentPixelRay, out hitInfo);

                if (hit)
                {
                    ShaderScript shader = hitInfo.transform.GetComponent <ShaderScript>();

                    if (shader != null)
                    {
                        tex.SetPixel(i, j, shader.calcColor(hitInfo));
                    }
                    else
                    {
                        tex.SetPixel(i, j, Color.cyan);
                    }
                }
            }
        }



        tex.Apply();
    }
Пример #4
0
    public void SetUp(ShaderScript shaderScript)
    {
        shaderNormal       = shaderScript.shaderNormal;
        shaderGrey         = shaderScript.shaderGrey;
        shaderSparklyBig   = shaderScript.shaderSparklyBig;
        shaderSparklySmall = shaderScript.shaderSparklySmall;
        mainColor          = shaderScript.mainColor;
        pointLight         = shaderScript.pointLight;
        grey = shaderScript.grey;

        renderer = this.gameObject.GetComponent <MeshRenderer>();
        setShader_normal();

        ready = true;
    }
Пример #5
0
        public HelpWindow()
        {
            InitializeComponent();

            string helpText;

            WooScript helpScript = new WooScript();

            helpText = helpScript.GetHelpText();

            string distanceHelpText;

            distanceHelpText = ShaderScript.GetHelpText();
            helpText        += System.Environment.NewLine + "Shader Functions : " + System.Environment.NewLine + distanceHelpText;

            textBox1.Text = helpText;
        }
Пример #6
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = this;

            _SettingsLocation = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\WooFractal\\Settings.xml";
            _AppSettings      = AppSettings.Load(_SettingsLocation);
            _WootracerOptions = _AppSettings._WootracerOptions;

            // initialise post process settings
            _PostProcess = new PostProcess();

            // starting camera settings
            _WootracerOptions = new WootracerOptions();
            InitialiseCamera();

            // initialise the scene
            InitialiseScene();

            // initialise the script objects
            InitialiseScript();

            InitialiseTestScene();

            ShaderScript.ReadDistanceSchema();

            BuildFractalList();

            BuildOptionsList();

            BuildColourList();

//            FractalSettings fractalSettings = LoadFractal("scratch");
//            _FractalIterations = fractalSettings._FractalIterations;
//          _FractalColours = fractalSettings._FractalColours;
//        _RenderOptions = fractalSettings._RenderOptions;
        }