public void Initialize() { loaded = true; glControl.CreateControl(); HeadPoints.Initialize(HeadPointsCount); HeadPoints.RenderCamera = camera; HeadPoints.GenerateSphere(0.3f, 5, 5); idleShader = new ShaderController("idle.vs", "idle.fs"); idleShader.SetUniformLocation("u_UseTexture"); idleShader.SetUniformLocation("u_Color"); idleShader.SetUniformLocation("u_Texture"); idleShader.SetUniformLocation("u_BrushMap"); idleShader.SetUniformLocation("u_TransparentMap"); idleShader.SetUniformLocation("u_World"); idleShader.SetUniformLocation("u_WorldView"); idleShader.SetUniformLocation("u_ViewProjection"); idleShader.SetUniformLocation("u_LightDirection"); blendShader = new ShaderController("blending.vs", "blending.fs"); blendShader.SetUniformLocation("u_Texture"); blendShader.SetUniformLocation("u_BaseTexture"); blendShader.SetUniformLocation("u_BlendDirectionX"); LoadModel(ProgramCore.DefaultIsSmile); SetupViewport(glControl); windowInfo = Utilities.CreateWindowsWindowInfo(renderPanel.Handle); graphicsContext = new GraphicsContext(GraphicsMode.Default, windowInfo); renderPanel.Resize += (sender, args) => graphicsContext.Update(windowInfo); glControl.Context.MakeCurrent(glControl.WindowInfo); RenderTimer.Start(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerPos = GameObject.FindGameObjectWithTag("Player").transform; shaderController = player.GetComponent <ShaderController>(); lightPos = this.transform; }
private bool DrawToTexture(ShaderController shader, int textureId) { //GL.BindTexture(TextureTarget.Texture2D, oldTextureId); DrawQuad(1f, 1f, 1f, 1f); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Enable(EnableCap.Blend); shader.Begin(); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, headTextureId); shader.UpdateUniform("u_Texture", 0); GL.ActiveTexture(TextureUnit.Texture1); GL.BindTexture(TextureTarget.Texture2D, textureId); shader.UpdateUniform("u_BaseTexture", 1); shader.UpdateUniform("u_BlendDirectionX", HeadMesh.HeadAngle >= 0 ? 1.0f : -1.0f); HeadMesh.DrawToTexture(textureId); shader.End(); GL.Disable(EnableCap.Blend); return(true); }
protected virtual void PerformPlay(ShaderController shaderController, float intensityMultiplier) { shaderController.RevertToInitialValueAfterEnd = RevertToInitialValueAfterEnd; if (Mode == Modes.OneTime) { shaderController.OneTimeDuration = FeedbackDuration; shaderController.OneTimeAmplitude = OneTimeAmplitude; shaderController.OneTimeCurve = OneTimeCurve; if (NormalPlayDirection) { shaderController.OneTimeRemapMin = OneTimeRemapMin * intensityMultiplier; shaderController.OneTimeRemapMax = OneTimeRemapMax * intensityMultiplier; } else { shaderController.OneTimeRemapMin = OneTimeRemapMax * intensityMultiplier; shaderController.OneTimeRemapMax = OneTimeRemapMin * intensityMultiplier; } shaderController.OneTime(); } if (Mode == Modes.ToDestination) { shaderController.ToColor = ToDestinationColor; shaderController.ToDestinationCurve = ToDestinationCurve; shaderController.ToDestinationDuration = FeedbackDuration; shaderController.ToDestinationValue = ToDestinationValue; shaderController.ToDestination(); } }
void Start() { objRend = new List <Renderer>(); enemyList = new List <GameObject>(); sphereCast = new SphereCast(); player = GameObject.FindGameObjectWithTag("Player"); spawns = GameObject.FindGameObjectsWithTag("Spawner").ToList(); sphereCast = player.GetComponent <SphereCast>(); //enemyRender = GameObject.FindGameObjectWithTag("Inimigo"); //objMesh = GameObject.FindGameObjectWithTag("HideObj"); //objRend = objMesh.GetComponent<Renderer>(); //obsList = GameObject.FindGameObjectsWithTag("Toten").ToList(); enemyList = GameObject.FindGameObjectsWithTag("Inimigo").ToList(); totenRend = GetComponent <Renderer>(); totenRend.material.shader = Shader.Find("Toon/Lit Dissolve DoubleTex"); shaderController = player.GetComponent <ShaderController>(); for (int i = 0; i < spawns.Count; i++) { handText = spawns[i].GetComponent <HandleTextFile>(); } //if (SaveLoadGame.instance.deuLoad == true) //{ // obsList[tottenAtual].GetComponent<Renderer>().material = material[1]; //} //for (int j = 0; j < enemyList.Count; j++) //{ // matEnemy = enemyList[j].GetComponent<EnemyMatCtrl>(); //} //for (int j = 0; j < obsList.Count; j++) //{ // obsList[j].GetComponent<Renderer>().sharedMaterial = material[0]; //} //for (int j = 0; j < enemyList.Count; i++) //{ // enemyRender = enemyList[j] //} //rendEnemy = GetComponent<Renderer>(); //rendEnemy.material.shader = Shader.Find("Toon/Lit Dissolve"); //rend = GetComponent<Renderer>(); //rend.material.shader = Shader.Find("Toon/Lit Dissolve Appear"); }
public FractalWindow(RectangleF Rect) : base(Rect) { Controller = new ShaderController((int)Rect.Width, (int)Rect.Height); Controller.fractalWindow = this; Controller.camera3D = new Camera3d(new Vector3(0, 3, -3) * 200, Rect, this); //Controller.projectionMatrix = Matrix4.CreateOrthographicOffCenter(0, Rect.Width, Rect.Height, 0, 1f, -1f); //Controller.projectionMatrix = ; ScrollEvent += Scroll; DragEvent += Drag; }
protected virtual void PerformReset(ShaderController shaderController) { shaderController.OneTimeDuration = _oneTimeDurationStorage; shaderController.OneTimeAmplitude = _oneTimeAmplitudeStorage; shaderController.OneTimeCurve = _oneTimeCurveStorage; shaderController.OneTimeRemapMin = _oneTimeRemapMinStorage; shaderController.OneTimeRemapMax = _oneTimeRemapMaxStorage; shaderController.ToDestinationCurve = _toDestinationCurveStorage; shaderController.ToDestinationDuration = _toDestinationDurationStorage; shaderController.ToDestinationValue = _toDestinationValueStorage; shaderController.RevertToInitialValueAfterEnd = _revertToInitialValueAfterEndStorage; }
public void Draw(ShaderController shader) { if (!IsVisible) { return; } var useTextures = Vector3.Zero; var useTexture = ProgramCore.MainForm.ctrlRenderControl.UseTexture; GL.ActiveTexture(TextureUnit.Texture1); GL.BindTexture(TextureTarget.Texture2D, Material.TransparentTexture); shader.UpdateUniform("u_TransparentMap", 1); useTextures.Y = Material.TransparentTexture; //shader.UpdateUniform("u_UseTransparent", (float)Material.TransparentTexture); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, Material.Texture); shader.UpdateUniform("u_Texture", 0); if (useTexture) // заказ старичка. что типа проги не отрабатывают текстуры (которые 3д печать) и надо со всего убрать { shader.UpdateUniform("u_Color", Material.DiffuseColor); useTextures.X = Material.Texture; } //shader.UpdateUniform("u_UseTexture", useTexture ? (float)Material.Texture : 0); shader.UpdateUniform("u_UseTexture", useTextures); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.NormalArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.EnableClientState(ArrayCap.ColorArray); GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBuffer); GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndexBuffer); GL.VertexPointer(3, VertexPointerType.Float, Vertex.Stride, new IntPtr(0)); GL.NormalPointer(NormalPointerType.Float, Vertex.Stride, new IntPtr(Vector3.SizeInBytes)); GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.Stride, new IntPtr(2 * Vector3.SizeInBytes)); GL.ColorPointer(4, ColorPointerType.Float, Vertex.Stride, new IntPtr(2 * Vector3.SizeInBytes + Vector2.SizeInBytes)); GL.DrawRangeElements(PrimitiveType.Triangles, 0, NumIndices, NumIndices, DrawElementsType.UnsignedInt, new IntPtr(0)); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.NormalArray); GL.DisableClientState(ArrayCap.TextureCoordArray); GL.DisableClientState(ArrayCap.ColorArray); }
//// Use this for initialization void Start() { //jogador = GetComponent<Jogador>(); handleList = new List <GameObject>(); handle = GameObject.FindGameObjectWithTag("Spawner"); handleList = GameObject.FindGameObjectsWithTag("Spawner").ToList(); shaderCtrl = GetComponent <ShaderController>(); for (int i = 0; i < handleList.Count; i++) { handText = handleList[i].GetComponent <HandleTextFile>(); } }
private void HandleActivationGroup(GameObject go, ActivationController myAC, ShaderController mySC) { mySC.shouldColor = false; mySC.shouldVertex = false; mySC.shouldDissolve = false; mySC.shouldSize = false; switch (myAC.myGroup) { case ActivationController.Group.Zero: masterObjectList[0].Add(go); break; case ActivationController.Group.One: masterObjectList[1].Add(go); break; case ActivationController.Group.Two: masterObjectList[2].Add(go); break; case ActivationController.Group.Three: masterObjectList[3].Add(go); break; case ActivationController.Group.Four: masterObjectList[4].Add(go); break; case ActivationController.Group.Five: masterObjectList[5].Add(go); break; case ActivationController.Group.Six: masterObjectList[6].Add(go); break; case ActivationController.Group.Seven: masterObjectList[7].Add(go); break; case ActivationController.Group.Eight: masterObjectList[8].Add(go); break; case ActivationController.Group.Nine: masterObjectList[9].Add(go); break; } }
// Start is called before the first frame update void Start() { //Debug.Log(onset_array); //rend = GetComponent<Renderer>(); LoadGameData(); audioSource = GetComponent <AudioSource>(); for (int i = 0; i < 10; i++) { masterObjectList.Add(new List <GameObject>()); } Debug.Log(masterObjectList); GameObject[] allObjects = UnityEngine.Object.FindObjectsOfType <GameObject>(); foreach (GameObject go in allObjects) { ActivationController myAC = go.GetComponent <ActivationController>(); ShaderController mySC = go.GetComponent <ShaderController>(); if (go.tag == "Tree" && myAC) { HandleTreeActivationGroup(go, myAC); continue; } if (myAC && mySC && go.activeInHierarchy) { HandleActivationGroup(go, myAC, mySC); } } Debug.Log("GROUP ZER0:"); foreach (GameObject go in masterObjectList[0]) { Debug.Log(go); } Debug.Log("GROUP One:"); foreach (GameObject go in masterObjectList[1]) { Debug.Log(go); } //Debug.Log("GROUP Two:"); //foreach (GameObject go in masterObjectList[2]) // Debug.Log(go); }
protected override void LoadContent() { blockTexture2 = Game.Content.Load <Texture2D>("Textures/block_2"); blockTexture = Game.Content.Load <Texture2D>("Textures/block"); gemTexture = Game.Content.Load <Texture2D>("Textures/gem"); shader = new ShaderController(Game.GraphicsDevice, this); shader.Initialize(); sound = Game.Content.Load <SoundEffect>("Sound/gem"); spriteBatch = new SpriteBatch(GraphicsDevice); background.LoadContent(Game.Content); font = Game.Content.Load <SpriteFont>("Fonts/gameFont"); healthTexture = Game.Content.Load <Texture2D>("Textures/health"); enemyRunTexture = Game.Content.Load <Texture2D>("Enemy/run"); enemyIdleTexture = Game.Content.Load <Texture2D>("Enemy/idle"); }
// Use this for initialization void Start() { totenList = new List <GameObject>(); //totenList = new List<GameObject>(); rend = new List <Renderer>(); player = GameObject.FindGameObjectWithTag("Player"); objects = GameObject.FindGameObjectWithTag("Toten"); controllMat = objects.GetComponent <ControllMaterial>(); totenList = GameObject.FindGameObjectsWithTag("Toten").ToList(); //totenList = GameObject.FindGameObjectsWithTag("Toten").ToList(); //rend = obsHideList.GetComponent<Renderer>(); shaderController = player.GetComponent <ShaderController>(); //rend. sharedMaterial = material[0]; }
// Use this for initialization void Start() { sphereCast = new SphereCast(); spawmList = GameObject.FindGameObjectsWithTag("Spawner").ToList(); listFonts = GameObject.FindGameObjectsWithTag("LifePoint").ToList(); //lifeFountain = fountain.GetComponentInChildren<LifeFountain>(); shaderCtrl = this.gameObject.GetComponent <ShaderController>(); Player = GameObject.FindGameObjectWithTag("Player"); mover = GetComponent <CharacterController>(); camController = cam.gameObject.GetComponent <CameraController>(); healthBar = gameObject.GetComponent <HealthBarPlayer>(); sphereCast = Player.GetComponent <SphereCast>(); for (int i = 0; i < listFonts.Count; i++) { lifeFountain = listFonts[i].GetComponent <LifeFountain>(); } }
public void Draw(ShaderController shader) { if (!IsVisible) { return; } GL.ActiveTexture(TextureUnit.Texture1); GL.BindTexture(TextureTarget.Texture2D, Material.TransparentTexture); shader.UpdateUniform("u_TransparentMap", 1); shader.UpdateUniform("u_UseTransparent", (float)Material.TransparentTexture); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, Material.Texture); shader.UpdateUniform("u_Texture", 0); shader.UpdateUniform("u_Color", Material.DiffuseColor); shader.UpdateUniform("u_UseTexture", (float)Material.Texture); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.NormalArray); GL.EnableClientState(ArrayCap.TextureCoordArray); GL.EnableClientState(ArrayCap.ColorArray); GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBuffer); GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndexBuffer); GL.VertexPointer(3, VertexPointerType.Float, Vertex.Stride, new IntPtr(0)); GL.NormalPointer(NormalPointerType.Float, Vertex.Stride, new IntPtr(Vector3.SizeInBytes)); GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.Stride, new IntPtr(2 * Vector3.SizeInBytes)); GL.ColorPointer(4, ColorPointerType.Float, Vertex.Stride, new IntPtr(2 * Vector3.SizeInBytes + Vector2.SizeInBytes)); GL.DrawRangeElements(PrimitiveType.Triangles, 0, NumIndices, NumIndices, DrawElementsType.UnsignedInt, new IntPtr(0)); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.NormalArray); GL.DisableClientState(ArrayCap.TextureCoordArray); GL.DisableClientState(ArrayCap.ColorArray); }
void Start() { firstPos = transform.position; //GameManager.isReborn += ResetPos; shaderCtrlObj = GameObject.FindGameObjectWithTag("ShaderController"); goal = GameObject.FindGameObjectWithTag("Goal"); shaderCtrl = (ShaderController)shaderCtrlObj.GetComponent(typeof(ShaderController)); m_camera = GetComponent <Camera>(); m_camera.backgroundColor = new Color(.266f, .286f, .282f, 1); player = FindObjectOfType <FirstPersonController> (); rotationPoint = new Vector3(0, 0, 0); // for(int i = 0; i < colorsArray.Length; i++) { // colorsArray[i] = Color.HSVToRGB(.2f, 0.9f, .8f);; // } //transform.position = (transform.position - rotationPoint).normalized * radius + rotationPoint; }
public Bitmap RenderToTexture(int textureId, int textureWidth, int textureHeight, ShaderController shader, bool useAlpha = false) { graphicsContext.MakeCurrent(windowInfo); renderPanel.Size = new Size(textureWidth, textureHeight); GL.Viewport(0, 0, textureWidth, textureHeight); GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.MatrixMode(MatrixMode.Projection); GL.PushMatrix(); GL.LoadIdentity(); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Enable(EnableCap.Texture2D); GL.DepthMask(false); DrawToTexture(shader, textureId); GL.DepthMask(true); GL.BindTexture(TextureTarget.Texture2D, 0); GL.MatrixMode(MatrixMode.Projection); GL.PopMatrix(); var result = GrabScreenshot(string.Empty, textureWidth, textureHeight, useAlpha); glControl.Context.MakeCurrent(glControl.WindowInfo); SetupViewport(glControl); return(result); }
void Start() { m_shaderController = this.GetComponent <ShaderController>(); }
void OnGUI() { shaderController = FindObjectOfType(typeof(ShaderController)) as ShaderController; GUI.Label(new Rect(10, 40, 1000, 20), "Press Q to enable sliders - (NOTE: Each slider affects every forcefield at the same time"); if(shaderController.customInput) { rimPowerSlider = GUI.HorizontalSlider(new Rect(25,125,150,30), rimPowerSlider, 0.0F, 2.0F); GUI.Label(new Rect(200, 120, 1000, 20), "Rim Power"); GUI.Label(new Rect(400, 120, 1000, 20), "" + rimPowerSlider); innerOuterSlider = GUI.HorizontalSlider(new Rect(25,155,150,30), innerOuterSlider, 0.0F, 1F); GUI.Label(new Rect(200, 150, 1000, 20), "Inner / Outer Glow"); GUI.Label(new Rect(400, 150, 1000, 20), "" + innerOuterSlider); rimWidthSlider = GUI.HorizontalSlider(new Rect(25,185,150,30), rimWidthSlider, 0.0F, 0.99F); GUI.Label(new Rect(200, 180, 1000, 20), "Rim Width"); GUI.Label(new Rect(400, 180, 1000, 20), "" + rimWidthSlider); bumpSlider = GUI.HorizontalSlider(new Rect(25,215,150,30), bumpSlider, 1.0F, 20.0F); GUI.Label(new Rect(200, 210, 1000, 20), "Bump Scale"); GUI.Label(new Rect(400, 210, 1000, 20), "" + bumpSlider); refracPowSlider = GUI.HorizontalSlider(new Rect(25,245,150,30), refracPowSlider, 0.0F, 2.0F); GUI.Label(new Rect(200, 240, 1000, 20), "Refraction Power"); GUI.Label(new Rect(400, 240, 1000, 20), "" + refracPowSlider); refractionHardnessSlider = GUI.HorizontalSlider(new Rect(25,275,150,30), refractionHardnessSlider, 0.0F, 1.0F); GUI.Label(new Rect(200, 270, 1000, 20), "Refraction Hardness"); GUI.Label(new Rect(400, 270, 1000, 20), "" + refractionHardnessSlider); refractionReflectSlider = GUI.HorizontalSlider(new Rect(25,305,150,30), refractionReflectSlider, 0.0F, 1.0F); GUI.Label(new Rect(200, 300, 1000, 20), "Refraction Reflection"); GUI.Label(new Rect(400, 300, 1000, 20), "" + refractionReflectSlider); rotateSlider = GUI.HorizontalSlider(new Rect(25,335,150,30), rotateSlider, 0.0F, 5.0F); GUI.Label(new Rect(200, 330, 1000, 20), "Texture Rotation Speed"); GUI.Label(new Rect(400, 330, 1000, 20), "" + rotateSlider); sliceSlider = GUI.HorizontalSlider(new Rect(25,365,150,30), sliceSlider, 0.0F, 1.0F); GUI.Label(new Rect(200, 360, 1000, 20), "Slice"); GUI.Label(new Rect(400, 360, 1000, 20), "" + sliceSlider); colorSlider.r = GUI.HorizontalSlider(new Rect(25,405,150,10), colorSlider.r, 0.0F, 1.0F); //Label with Red Color GUI.Label(new Rect(200, 400, 1000, 20), "Red Color"); GUI.Label(new Rect(400, 400, 1000, 20), "" + colorSlider.r); colorSlider.g = GUI.HorizontalSlider(new Rect(25,425,150,10), colorSlider.g, 0.0F, 1.0F); //Label with Green Color GUI.Label(new Rect(200, 420, 1000, 20), "Green Color"); GUI.Label(new Rect(400, 420, 1000, 20), "" + colorSlider.g); colorSlider.b = GUI.HorizontalSlider(new Rect(25,445,150,10), colorSlider.b, 0.0F, 1.0F); //Label with Blue Color GUI.Label(new Rect(200, 440, 1000, 20), "Blue Color"); GUI.Label(new Rect(400, 440, 1000, 20), "" + colorSlider.b); colorSlider.a = GUI.HorizontalSlider(new Rect(25,465,150,10), colorSlider.a, 0.0F, 1.0F); //Label with Blue Color GUI.Label(new Rect(200, 460, 1000, 20), "Alpha"); GUI.Label(new Rect(400, 460, 1000, 20), "" + colorSlider.a); rimColorSlider.r = GUI.HorizontalSlider(new Rect(25,505,150,10), rimColorSlider.r, 0.0F, 1.0F); //Label with Red Color GUI.Label(new Rect(200, 500, 1000, 20), "Rim Red Color"); GUI.Label(new Rect(400, 500, 1000, 20), "" + rimColorSlider.r); rimColorSlider.g = GUI.HorizontalSlider(new Rect(25,525,150,10), rimColorSlider.g, 0.0F, 1.0F); //Label with Green Color GUI.Label(new Rect(200, 520, 1000, 20), "Rim Green Color"); GUI.Label(new Rect(400, 520, 1000, 20), "" + rimColorSlider.g); rimColorSlider.b = GUI.HorizontalSlider(new Rect(25,545,150,10), rimColorSlider.b, 0.0F, 1.0F); //Label with Blue Color GUI.Label(new Rect(200, 540, 1000, 20), "Rim Blue Color"); GUI.Label(new Rect(400, 540, 1000, 20), "" + rimColorSlider.b); } }
// Start is called before the first frame update void Start() { controller = GetComponent <ShaderController>(); controller.Initialize(GetComponent <Image>()); }