public ShaderObjectVariable(ShaderObjectType type, string name, IEnumerable<KeyValuePair<string, string>> specialParameters) : base(name, specialParameters) { if (type == null) throw new ArgumentNullException("type"); this.type = type; }
public ShaderObject(ShaderObjectType objectType) { m_ObjectType = objectType; m_Id = GL.CreateShaderObject(objectType); if (m_Id == 0) { throw new UserFriendlyException(String.Format("GL.CreateShaderObject({0}) returned a zero result", objectType.ToString()), "Could not create a shader"); } }
public ShaderObject(ShaderObjectType type, object value, string tag) { Type = type; Value = value; Tag = tag; }
public static int CreateShaderObject(ShaderObjectType shaderType) { return(Delegates.CreateShaderObjectARB(shaderType)); }
void UpdateNormalisedCalibration() { var Calibration = TheNormalisedCalibration; var Mat = CalibrationMaterial; bool ShowCalibration = false; System.Action <Vector2, int, ShaderObjectType> SetObjectPos = (Pos2, Index, Type) => { var Pos4 = new Vector4(Pos2.x, Pos2.y, (float)Type, 0); var Uniform = Shader_ObjectUniformPrefix + Index; Mat.SetVector(Uniform, Pos4); }; System.Action <Vector2, int, ShaderObjectType> SetCalibrationPos = (Pos2, Index, Type) => { var Pos4 = new Vector4(Pos2.x, Pos2.y, (float)Type, 0); var Uniform = Shader_CalibrationUniformPrefix + Index; Mat.SetVector(Uniform, Pos4); }; // set calibration shader stuff { var CalibTypes = new ShaderObjectType[4]; int EditingIndex = -1; if (Calibration.PendingCalibrationParams != null) { ShowCalibration = true; EditingIndex = Calibration.PendingCalibrationParams.GetEditingIndex(); } else if (Calibration.CalibrationParams != null) { EditingIndex = 4; } else { ShowCalibration = true; } for (int i = 0; i < CalibTypes.Length; i++) { if (i < EditingIndex) { CalibTypes[i] = ShaderObjectType.TYPE_ACTIVE; } else if (i == EditingIndex) { CalibTypes[i] = ShaderObjectType.TYPE_EDITING; } else { CalibTypes[i] = ShaderObjectType.TYPE_INACTIVE; } } var LocalPositons = TFloorCalibration.GetEditingLocalPositions(); for (int i = 0; i < LocalPositons.Length; i++) { SetCalibrationPos(LocalPositons[i], i, CalibTypes[i]); } } if (TrackObjects != null) { bool AnyActive = false; bool AnyGrip = false; for (int ObjectIndex = 0; ObjectIndex < TrackObjects.Length; ObjectIndex++) { try { var Object = TrackObjects[ObjectIndex].transform; var Active = Object.gameObject.activeInHierarchy; AnyGrip |= TrackObjects[ObjectIndex].GripDown; AnyActive |= Active; var WorldPos = Object.position; var FloorPos = Calibration.GetNormalisedPosition2D(WorldPos); var Type = Active ? ShaderObjectType.TYPE_ACTIVE : ShaderObjectType.TYPE_INACTIVE; SetObjectPos(FloorPos, ObjectIndex, Type); } catch (System.Exception) { } } ShowCalibration = ShowCalibration || AnyGrip || (!AnyActive); } var ri = GetComponent <UnityEngine.UI.RawImage>(); ri.enabled = ShowCalibration || AlwaysVisible; }
public ShaderObject(ShaderObjectType objectType, string source) : this(objectType) { SetSource(source); Compile(); }