public static void paintSingleVertexOnHit( Transform transform, RaycastHit hit, Color color, float strength) { Vector3[] vertices = ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().get_vertices(); int[] triangles = ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().get_triangles(); Color[] colors = ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().get_colors(); int triangleIndex = ((RaycastHit) ref hit).get_triangleIndex(); float num1 = float.PositiveInfinity; int index1 = 0; for (int index2 = 0; index2 < 3; index2 += 3) { float num2 = Vector3.Distance(transform.TransformPoint(vertices[triangles[triangleIndex * 3 + index2]]), ((RaycastHit) ref hit).get_point()); if ((double)num2 < (double)num1) { index1 = triangles[triangleIndex * 3 + index2]; num1 = num2; } } Color color1 = VTP.VertexColorLerp(colors[index1], color, strength); colors[index1] = color1; ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().set_colors(colors); }
public LimitedTimeMovement(VTP path, float enabledFor, Action done, ICancellee cT, ParametricInfo pi, Pred?condition = null) { this.vtp = path; this.enabledFor = enabledFor; this.done = done; this.cT = cT; this.pi = pi; this.condition = condition; }
public Movement(Vector2 loc, Vector2 dir) { cos_rot = dir.x; sin_rot = dir.y; vtp = VTPRepo.NoVTP; flipX = flipY = 1; rootPos = loc; this.angle = M.AtanD(dir); }
private Movement(VTP vtp, Vector2 rootPos, float c, float s, float fx, float fy) { cos_rot = c; sin_rot = s; this.rootPos = rootPos; this.vtp = vtp; this.flipX = fx; this.flipY = fy; this.angle = M.Atan2D(s, c); }
/// <summary> /// Create a velocity configuration. /// </summary> /// <param name="path">Movement descriptor</param> /// <param name="parentLoc">Global location of parent. Set to zero if using a transform parent</param> /// <param name="localLoc">Location of this relative to parent. Only distinguished from parent for applying modifiers.</param> public Movement(VTP path, Vector2 parentLoc, V2RV2 localLoc) { angle = localLoc.angle; cos_rot = M.CosDeg(localLoc.angle); sin_rot = M.SinDeg(localLoc.angle); vtp = path; flipX = 1; flipY = 1; this.rootPos = parentLoc + localLoc.TrueLocation; }
private void Start() { //unneeded now //init rendertexture setupRenderTex(); //create VideoCacheData this is the unity 'instance'. this should only ever be created once per movie, in Start. VideoInstance = createVideoTexture(); //store this instance in manager for videoLoaded/videoEnded callbacks VTP.addInstance(this); //set the path to the movie, then call this. load(); }
// private void Awake() { //makes sure that callbacks are setup VTP.init(); destroyed = false; videoInstance = IntPtr.Zero; if (!VTP.checkIfVTPSupported()) { this.enabled = false; return; } VideoInstance = createVideoTexture(); }
static public void init() { if (!VTP.initialized) //only call this once { VTP.initialized = true; if (checkIfVTPSupported()) { Application.runInBackground = true; //init the callbacks... VTP.InitCallbacks(videoLoaded, videoEnded, CreateTextureFromVideoTextureCache); VTP.createNullTexture(); setUseFastPathTextureCopying(useFastPathTextureCopying); } } }
public static void paintFaceVerticesOnHit( Transform transform, RaycastHit hit, Color color, float strength) { int[] triangles = ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().get_triangles(); Color[] colors = ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().get_colors(); int triangleIndex = ((RaycastHit) ref hit).get_triangleIndex(); for (int index1 = 0; index1 < 3; ++index1) { int index2 = triangles[triangleIndex * 3 + index1]; Color color1 = VTP.VertexColorLerp(colors[index2], color, strength); colors[index2] = color1; } ((MeshFilter)((Component)transform).GetComponent <MeshFilter>()).get_sharedMesh().set_colors(colors); }
static public void init() { if (!VTP.initialized) { Debug.Log("initializing Video Texture Pro 2.0."); VTP.initialized = true; Application.runInBackground = true; #if UNITY_EDITOR VTP.initCallbacks(); #elif UNITY_IPHONE VTP.initCallbacksIOS(); #else VTP.initCallbacks(); #endif VTP.createNullTexture(); } // else // Debug.Log ("not initializing! already init'd"); }
private void Start() { if (!VTP.checkIfVTPSupported()) { return; } if (!VideoTextureCacheContext.instance && !destroyed && Camera.main != null && Camera.main.gameObject != null) { Camera.main.gameObject.AddComponent <VideoTextureCacheContext>(); } //init rendertexture setupRenderTex(); //create VideoCacheData this is the unity 'instance'. this should only ever be created once per movie, in Start. // VideoInstance = createVideoTexture(); //store this instance in manager for videoLoaded/videoEnded callbacks VTP.addInstance(this); //set the path to the movie, then call this. load(); }
private void ExecuteTheDestroy() { VTP.removeInstance(this); //v2.1.9 update: this has to happen BEFORE destroyVideoObject or it won't get removed properly from the array. destroyVideoObject(); }
//called before the GameObject is destroyed. private void OnDestroy() { destroyVideoObject(); VTP.removeInstance(this); }
// private void Awake() { //makes sure that callbacks are setup // if(Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) VTP.init(); }
public Movement(VTP path) : this(path, Vector2.zero, V2RV2.Zero) { }
public Movement(VTP vtp, Vector2 rootPos, float ang) : this(vtp, rootPos, M.CosDeg(ang), M.SinDeg(ang), 1, 1) { }