public override void update(float time) { if (this.m_bDirty) { for (int i = 0; i < this.m_sGridSize.x + 1; i++) { for (int j = 0; j < this.m_sGridSize.y + 1; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); CCPoint cCPoint = new CCPoint(this.m_positionInPixels.x - (new CCPoint(_ccVertex3F.x, _ccVertex3F.y)).x, this.m_positionInPixels.y - (new CCPoint(_ccVertex3F.x, _ccVertex3F.y)).y); float mFRadius = CCPointExtension.ccpLength(cCPoint); if (mFRadius < this.m_fRadius) { mFRadius = this.m_fRadius - mFRadius; float single = mFRadius / this.m_fRadius; if (single == 0f) { single = 0.001f; } float single1 = (float)Math.Log((double)single) * this.m_fLensEffect; float single2 = (float)Math.Exp((double)single1) * this.m_fRadius; if (Math.Sqrt((double)(cCPoint.x * cCPoint.x + cCPoint.y * cCPoint.y)) > 0) { cCPoint = CCPointExtension.ccpNormalize(cCPoint); CCPoint cCPoint1 = CCPointExtension.ccpMult(cCPoint, single2); ccVertex3F _ccVertex3F1 = _ccVertex3F; _ccVertex3F1.z = _ccVertex3F1.z + CCPointExtension.ccpLength(cCPoint1) * this.m_fLensEffect; } } base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } this.m_bDirty = false; } }
public override void Update(float time) { int i, j; CCPoint c = m_positionInPixels; for (i = 0; i < (m_sGridSize.x + 1); ++i) { for (j = 0; j < (m_sGridSize.y + 1); ++j) { ccVertex3F v = originalVertex(new ccGridSize(i, j)); CCPoint avg = new CCPoint(i - (m_sGridSize.x / 2.0f), j - (m_sGridSize.y / 2.0f)); float r = (float)Math.Sqrt((avg.X * avg.X + avg.Y * avg.Y)); float amp = 0.1f * m_fAmplitude * m_fAmplitudeRate; float a = r * (float)Math.Cos((float)Math.PI / 2.0f + time * (float)Math.PI * m_nTwirls * 2) * amp; CCPoint d = new CCPoint(); d.X = (float)Math.Sin(a) * (v.y - c.Y) + (float)Math.Cos(a) * (v.x - c.X); d.Y = (float)Math.Cos(a) * (v.y - c.Y) - (float)Math.Sin(a) * (v.x - c.X); v.x = c.X + d.X; v.y = c.Y + d.Y; setVertex(new ccGridSize(i, j), v); } } }
public ccQuad3() { tl = new ccVertex3F(); tr = new ccVertex3F(); bl = new ccVertex3F(); br = new ccVertex3F(); }
public void placeTile(int x, int y, Tile t) { ccQuad3 _ccQuad3 = this.originalTile(x, y); if (_ccQuad3 == null) { return; } CCPoint step = this.m_pTarget.Grid.Step; ccVertex3F _ccVertex3F = _ccQuad3.bl; _ccVertex3F.x = _ccVertex3F.x + (float)((int)(t.position.x * step.x)); ccVertex3F _ccVertex3F1 = _ccQuad3.bl; _ccVertex3F1.y = _ccVertex3F1.y + (float)((int)(t.position.y * step.y)); ccVertex3F _ccVertex3F2 = _ccQuad3.br; _ccVertex3F2.x = _ccVertex3F2.x + (float)((int)(t.position.x * step.x)); ccVertex3F _ccVertex3F3 = _ccQuad3.br; _ccVertex3F3.y = _ccVertex3F3.y + (float)((int)(t.position.y * step.y)); ccVertex3F _ccVertex3F4 = _ccQuad3.tl; _ccVertex3F4.x = _ccVertex3F4.x + (float)((int)(t.position.x * step.x)); ccVertex3F _ccVertex3F5 = _ccQuad3.tl; _ccVertex3F5.y = _ccVertex3F5.y + (float)((int)(t.position.y * step.y)); ccVertex3F _ccVertex3F6 = _ccQuad3.tr; _ccVertex3F6.x = _ccVertex3F6.x + (float)((int)(t.position.x * step.x)); ccVertex3F _ccVertex3F7 = _ccQuad3.tr; _ccVertex3F7.y = _ccVertex3F7.y + (float)((int)(t.position.y * step.y)); this.setTile(x, y, _ccQuad3); }
public ccQuad3() { this.tl = new ccVertex3F(); this.tr = new ccVertex3F(); this.bl = new ccVertex3F(); this.br = new ccVertex3F(); }
public override void update(float time) { for (int i = 0; i < this.m_sGridSize.y; i++) { ccQuad3 _ccQuad3 = this.originalTile(0, i); if (_ccQuad3 == null) { return; } float single = 1f; if (i % 2 == 0) { single = -1f; } ccVertex3F mWinSize = _ccQuad3.bl; mWinSize.x = mWinSize.x + single * this.m_winSize.width * time; ccVertex3F _ccVertex3F = _ccQuad3.br; _ccVertex3F.x = _ccVertex3F.x + single * this.m_winSize.width * time; ccVertex3F mWinSize1 = _ccQuad3.tl; mWinSize1.x = mWinSize1.x + single * this.m_winSize.width * time; ccVertex3F _ccVertex3F1 = _ccQuad3.tr; _ccVertex3F1.x = _ccVertex3F1.x + single * this.m_winSize.width * time; this.setTile(new ccGridSize(0, i), _ccQuad3); } }
public virtual void transformTile(ccGridSize pos, float distance) { ccQuad3 _ccQuad3 = this.originalTile(pos); if (_ccQuad3 == null) { return; } CCPoint step = this.m_pTarget.Grid.Step; ccVertex3F _ccVertex3F = _ccQuad3.bl; _ccVertex3F.x = _ccVertex3F.x + step.x / 2f * (1f - distance); ccVertex3F _ccVertex3F1 = _ccQuad3.bl; _ccVertex3F1.y = _ccVertex3F1.y + step.y / 2f * (1f - distance); ccVertex3F _ccVertex3F2 = _ccQuad3.br; _ccVertex3F2.x = _ccVertex3F2.x - step.x / 2f * (1f - distance); ccVertex3F _ccVertex3F3 = _ccQuad3.br; _ccVertex3F3.y = _ccVertex3F3.y + step.y / 2f * (1f - distance); ccVertex3F _ccVertex3F4 = _ccQuad3.tl; _ccVertex3F4.x = _ccVertex3F4.x + step.x / 2f * (1f - distance); ccVertex3F _ccVertex3F5 = _ccQuad3.tl; _ccVertex3F5.y = _ccVertex3F5.y - step.y / 2f * (1f - distance); ccVertex3F _ccVertex3F6 = _ccQuad3.tr; _ccVertex3F6.x = _ccVertex3F6.x - step.x / 2f * (1f - distance); ccVertex3F _ccVertex3F7 = _ccQuad3.tr; _ccVertex3F7.y = _ccVertex3F7.y - step.y / 2f * (1f - distance); this.setTile(pos, _ccQuad3); }
public override void calculateVertexPoints() { float contentSizeInPixels = (float)this.m_pTexture.ContentSizeInPixels.width; float single = (float)this.m_pTexture.ContentSizeInPixels.height; float contentSizeInPixels1 = this.m_pTexture.ContentSizeInPixels.height; this.m_pVertices = new ccVertex3F[(this.m_sGridSize.x + 1) * (this.m_sGridSize.y + 1)]; this.m_pOriginalVertices = new ccVertex3F[(this.m_sGridSize.x + 1) * (this.m_sGridSize.y + 1)]; this.m_pTexCoordinates = new CCPoint[(this.m_sGridSize.x + 1) * (this.m_sGridSize.y + 1)]; this.m_pIndices = new short[this.m_sGridSize.x * this.m_sGridSize.y * 6]; ccVertex3F[] mPVertices = this.m_pVertices; CCPoint[] mPTexCoordinates = this.m_pTexCoordinates; short[] mPIndices = this.m_pIndices; for (int i = 0; i < this.m_sGridSize.x; i++) { for (int j = 0; j < this.m_sGridSize.y; j++) { int mSGridSize = j * this.m_sGridSize.x + i; float mObStep = (float)i * this.m_obStep.x; float mObStep1 = mObStep + this.m_obStep.x; float single1 = (float)j * this.m_obStep.y; float mObStep2 = single1 + this.m_obStep.y; int num = i * (this.m_sGridSize.y + 1) + j; int mSGridSize1 = (i + 1) * (this.m_sGridSize.y + 1) + j; int num1 = (i + 1) * (this.m_sGridSize.y + 1) + j + 1; int mSGridSize2 = i * (this.m_sGridSize.y + 1) + j + 1; short[] numArray = new short[] { (short)num, (short)mSGridSize2, (short)mSGridSize1, (short)mSGridSize1, (short)mSGridSize2, (short)num1 }; short[] numArray1 = numArray; Array.Copy(numArray1, 0, mPIndices, 6 * mSGridSize, (int)numArray1.Length); int[] numArray2 = new int[] { num, mSGridSize1, num1, mSGridSize2 }; ccVertex3F _ccVertex3F = new ccVertex3F(mObStep, single1, 0f); ccVertex3F _ccVertex3F1 = new ccVertex3F(mObStep1, single1, 0f); ccVertex3F _ccVertex3F2 = new ccVertex3F(mObStep1, mObStep2, 0f); ccVertex3F _ccVertex3F3 = new ccVertex3F(mObStep, mObStep2, 0f); ccVertex3F[] ccVertex3FArray = new ccVertex3F[] { _ccVertex3F, _ccVertex3F1, _ccVertex3F2, _ccVertex3F3 }; int[] numArray3 = new int[] { num, mSGridSize1, num1, mSGridSize2 }; CCPoint[] cCPoint = new CCPoint[] { new CCPoint(mObStep, single1), new CCPoint(mObStep1, single1), new CCPoint(mObStep1, mObStep2), new CCPoint(mObStep, mObStep2) }; CCPoint[] cCPointArray = cCPoint; for (int k = 0; k < 4; k++) { mPVertices[numArray2[k]] = new ccVertex3F(); mPVertices[numArray2[k]].x = ccVertex3FArray[k].x; mPVertices[numArray2[k]].y = ccVertex3FArray[k].y; mPVertices[numArray2[k]].z = ccVertex3FArray[k].z; mPTexCoordinates[numArray3[k]] = new CCPoint(); mPTexCoordinates[numArray3[k]].x = cCPointArray[k].x / contentSizeInPixels; if (!this.m_bIsTextureFlipped) { mPTexCoordinates[numArray3[k]].y = (contentSizeInPixels1 - cCPointArray[k].y) / single; } else { mPTexCoordinates[numArray3[k]].y = cCPointArray[k].y / single; } } } } Array.Copy(this.m_pVertices, this.m_pOriginalVertices, (this.m_sGridSize.x + 1) * (this.m_sGridSize.y + 1)); }
public void setVertex(ccGridSize pos, ccVertex3F vertex) { int num = pos.x * (this.m_sGridSize.y + 1) + pos.y; ccVertex3F[] mPVertices = this.m_pVertices; mPVertices[num].x = vertex.x; mPVertices[num].y = vertex.y; mPVertices[num].z = vertex.z; }
/// <summary> /// sets a new vertex at a given position /// </summary> public void setVertex(ccGridSize pos, ccVertex3F vertex) { int index = pos.x * (m_sGridSize.y + 1) + pos.y; ccVertex3F[] vertArray = m_pVertices; vertArray[index].x = vertex.x; vertArray[index].y = vertex.y; vertArray[index].z = vertex.z; }
public void setVertex(int px, int py, ccVertex3F vertex) { int num = px * (this.m_sGridSize.y + 1) + py; ccVertex3F[] mPVertices = this.m_pVertices; mPVertices[num].x = vertex.x; mPVertices[num].y = vertex.y; mPVertices[num].z = vertex.z; }
/// <summary> /// Update each tick /// Time is the percentage of the way through the duration /// </summary> public override void Update(float time) { float tt = Math.Max(0, time - 0.25f); float deltaAy = (tt * tt * 500); float ay = -100 - deltaAy; float deltaTheta = -(float)Math.PI / 2 * (float)Math.Sqrt(time); float theta = /*0.01f */ +(float)Math.PI / 2 + deltaTheta; float sinTheta = (float)Math.Sin(theta); float cosTheta = (float)Math.Cos(theta); for (int i = 0; i <= m_sGridSize.x; ++i) { for (int j = 0; j <= m_sGridSize.y; ++j) { // Get original vertex ccVertex3F p = originalVertex(new ccGridSize(i, j)); float R = (float)Math.Sqrt((p.x * p.x) + ((p.y - ay) * (p.y - ay))); float r = R * sinTheta; float alpha = (float)Math.Asin(p.x / R); float beta = alpha / sinTheta; float cosBeta = (float)Math.Cos(beta); // If beta > PI then we've wrapped around the cone // Reduce the radius to stop these points interfering with others if (beta <= Math.PI) { p.x = (r * (float)Math.Sin(beta)); } else { // Force X = 0 to stop wrapped // points p.x = 0; } p.y = (R + ay - (r * (1 - cosBeta) * sinTheta)); // We scale z here to avoid the animation being // too much bigger than the screen due to perspectve transform p.z = (r * (1 - cosBeta) * cosTheta) / 7;// "100" didn't work for // Stop z coord from dropping beneath underlying page in a transition // issue #751 if (p.z < 0.5f) { p.z = 0.5f; } // Set new coords setVertex(new ccGridSize(i, j), p); } } }
public void setVertex(int px, int py, ccVertex3F vertex) { int index = px * (m_sGridSize.y + 1) + py; ccVertex3F[] vertArray = m_pVertices; vertArray[index].x = vertex.x; vertArray[index].y = vertex.y; vertArray[index].z = vertex.z; //System.Diagnostics.Debug.WriteLine("setVertex: {0},{1} = {2},{3},{4}", px, py, vertex.x, vertex.y, vertex.z); }
public override void update(float time) { for (int i = 0; i < this.m_sGridSize.x + 1; i++) { for (int j = 0; j < this.m_sGridSize.y + 1; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); ccVertex3F _ccVertex3F1 = _ccVertex3F; _ccVertex3F1.z = _ccVertex3F1.z + (float)Math.Sin((double)(3.14159274f * time * (float)this.m_nWaves * 2f + (_ccVertex3F.y + _ccVertex3F.x) * 0.01f)) * this.m_fAmplitude * this.m_fAmplitudeRate; base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } }
/// <summary> /// returns the vertex at a given position /// </summary> public ccVertex3F vertex(ccGridSize pos) { int index = (pos.x * (m_sGridSize.y + 1) + pos.y); ccVertex3F[] vertArray = m_pVertices; ccVertex3F vert = new ccVertex3F() { x = vertArray[index].x, y = vertArray[index].y, z = vertArray[index].z }; return vert; }
public ccVertex3F originalVertex(int px, int py) { int index = (px * (m_sGridSize.y + 1) + py); ccVertex3F[] vertArray = m_pOriginalVertices; ccVertex3F vert = new ccVertex3F() { x = vertArray[index].x, y = vertArray[index].y, z = vertArray[index].z }; return vert; }
public ccVertex3F vertex(ccGridSize pos) { int num = pos.x * (this.m_sGridSize.y + 1) + pos.y; ccVertex3F[] mPVertices = this.m_pVertices; ccVertex3F _ccVertex3F = new ccVertex3F() { x = mPVertices[num].x, y = mPVertices[num].y, z = mPVertices[num].z }; return(_ccVertex3F); }
public ccVertex3F originalVertex(int px, int py) { int num = px * (this.m_sGridSize.y + 1) + py; ccVertex3F[] mPOriginalVertices = this.m_pOriginalVertices; ccVertex3F _ccVertex3F = new ccVertex3F() { x = mPOriginalVertices[num].x, y = mPOriginalVertices[num].y, z = mPOriginalVertices[num].z }; return(_ccVertex3F); }
public ccVertex3F originalVertex(int px, int py) { int index = (px * (m_sGridSize.y + 1) + py); ccVertex3F[] vertArray = m_pOriginalVertices; ccVertex3F vert = new ccVertex3F() { x = vertArray[index].x, y = vertArray[index].y, z = vertArray[index].z }; return(vert); }
/// <summary> /// returns the vertex at a given position /// </summary> public ccVertex3F vertex(ccGridSize pos) { int index = (pos.x * (m_sGridSize.y + 1) + pos.y); ccVertex3F[] vertArray = m_pVertices; ccVertex3F vert = new ccVertex3F() { x = vertArray[index].x, y = vertArray[index].y, z = vertArray[index].z }; return(vert); }
public override void Update(float time) { int i, j; for (i = 0; i < m_sGridSize.x + 1; ++i) { for (j = 0; j < m_sGridSize.y + 1; ++j) { ccVertex3F v = originalVertex(new ccGridSize(i, j)); v.z += ((float)Math.Sin((float)Math.PI * time * m_nWaves * 2 + (v.y + v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate); //CCLog("v.z offset is %f\n", ((float)Math.Sin((float)Math.PI * time * m_nWaves * 2 + (v.y + v.x) * .01f) * m_fAmplitude * m_fAmplitudeRate)); setVertex(new ccGridSize(i, j), v); } } }
public override void update(float time) { float single = time * 3.14159274f * (float)this.m_nWaves * 2f; float mFAmplitude = this.m_fAmplitude * this.m_fAmplitudeRate; for (int i = 1; i < this.m_sGridSize.x; i++) { for (int j = 1; j < this.m_sGridSize.y; j++) { ccVertex3F _ccVertex3F = base.originalVertex(i, j); _ccVertex3F.x = _ccVertex3F.x + (float)Math.Sin((double)(single + _ccVertex3F.x * 0.01f)) * mFAmplitude; _ccVertex3F.y = _ccVertex3F.y + (float)Math.Sin((double)(single + _ccVertex3F.y * 0.01f)) * mFAmplitude; base.setVertex(i, j, _ccVertex3F); } } }
public override void update(float time) { if (!this.m_bOnce) { for (int i = 0; i < this.m_sGridSize.x; i++) { for (int j = 0; j < this.m_sGridSize.y; j++) { ccQuad3 _ccQuad3 = this.originalTile(i, j); if (_ccQuad3 == null) { return; } Random random = new Random(); ccVertex3F _ccVertex3F = _ccQuad3.bl; _ccVertex3F.x = _ccVertex3F.x + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F1 = _ccQuad3.br; _ccVertex3F1.x = _ccVertex3F1.x + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F2 = _ccQuad3.tl; _ccVertex3F2.x = _ccVertex3F2.x + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F3 = _ccQuad3.tr; _ccVertex3F3.x = _ccVertex3F3.x + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F4 = _ccQuad3.bl; _ccVertex3F4.y = _ccVertex3F4.y + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F5 = _ccQuad3.br; _ccVertex3F5.y = _ccVertex3F5.y + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F6 = _ccQuad3.tl; _ccVertex3F6.y = _ccVertex3F6.y + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F7 = _ccQuad3.tr; _ccVertex3F7.y = _ccVertex3F7.y + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); if (this.m_bShatterZ) { ccVertex3F _ccVertex3F8 = _ccQuad3.bl; _ccVertex3F8.z = _ccVertex3F8.z + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F9 = _ccQuad3.br; _ccVertex3F9.z = _ccVertex3F9.z + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F10 = _ccQuad3.tl; _ccVertex3F10.z = _ccVertex3F10.z + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F11 = _ccQuad3.tr; _ccVertex3F11.z = _ccVertex3F11.z + (float)(random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); } this.setTile(i, j, _ccQuad3); } } this.m_bOnce = true; } }
public override void update(float time) { int i, j; float coeffA = time * (float)Math.PI * m_nWaves * 2f; float coeffB = m_fAmplitude * m_fAmplitudeRate; for (i = 1; i < m_sGridSize.x; ++i) { for (j = 1; j < m_sGridSize.y; ++j) { ccVertex3F v = originalVertex(i, j); v.x = (v.x + ((float)Math.Sin(coeffA + v.x * .01f) * coeffB)); v.y = (v.y + ((float)Math.Sin(coeffA + v.y * .01f) * coeffB)); setVertex(i, j, v); } } }
public override void update(float time) { for (int i = 0; i < this.m_sGridSize.x + 1; i++) { for (int j = 0; j < this.m_sGridSize.y + 1; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); if (this.m_bVertical) { _ccVertex3F.x = _ccVertex3F.x + (float)Math.Sin((double)(time * 3.14159274f * (float)this.m_nWaves * 2f + _ccVertex3F.y * 0.01f)) * this.m_fAmplitude * this.m_fAmplitudeRate; } if (this.m_bHorizontal) { _ccVertex3F.y = _ccVertex3F.y + (float)Math.Sin((double)(time * 3.14159274f * (float)this.m_nWaves * 2f + _ccVertex3F.x * 0.01f)) * this.m_fAmplitude * this.m_fAmplitudeRate; } base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } }
public override void update(float time) { float single = (float)Math.Sin((double)(3.14159274f * time * (float)this.m_nJumps * 2f)) * this.m_fAmplitude * this.m_fAmplitudeRate; float single1 = (float)(Math.Sin((double)(3.14159274f * (time * (float)this.m_nJumps * 2f + 1f))) * (double)this.m_fAmplitude * (double)this.m_fAmplitudeRate); ccGridSize _ccGridSize = new ccGridSize(); for (int i = 0; i < this.m_sGridSize.x; i++) { for (int j = 0; j < this.m_sGridSize.y; j++) { _ccGridSize.@set(i, j); ccQuad3 _ccQuad3 = this.originalTile(i, j); if (_ccQuad3 == null) { return; } if ((i + j) % 2 != 0) { ccVertex3F _ccVertex3F = _ccQuad3.bl; _ccVertex3F.z = _ccVertex3F.z + single1; ccVertex3F _ccVertex3F1 = _ccQuad3.br; _ccVertex3F1.z = _ccVertex3F1.z + single1; ccVertex3F _ccVertex3F2 = _ccQuad3.tl; _ccVertex3F2.z = _ccVertex3F2.z + single1; ccVertex3F _ccVertex3F3 = _ccQuad3.tr; _ccVertex3F3.z = _ccVertex3F3.z + single1; } else { ccVertex3F _ccVertex3F4 = _ccQuad3.bl; _ccVertex3F4.z = _ccVertex3F4.z + single; ccVertex3F _ccVertex3F5 = _ccQuad3.br; _ccVertex3F5.z = _ccVertex3F5.z + single; ccVertex3F _ccVertex3F6 = _ccQuad3.tl; _ccVertex3F6.z = _ccVertex3F6.z + single; ccVertex3F _ccVertex3F7 = _ccQuad3.tr; _ccVertex3F7.z = _ccVertex3F7.z + single; } this.setTile(i, j, _ccQuad3); } } }
public override void Update(float time) { if (m_bDirty) { int i, j; for (i = 0; i < m_sGridSize.x + 1; ++i) { for (j = 0; j < m_sGridSize.y + 1; ++j) { ccVertex3F v = originalVertex(new ccGridSize(i, j)); CCPoint vect = new CCPoint(m_positionInPixels.X - new CCPoint(v.x, v.y).X, m_positionInPixels.Y - new CCPoint(v.x, v.y).Y); float r = CCPointExtension.ccpLength(vect); if (r < m_fRadius) { r = m_fRadius - r; float pre_log = r / m_fRadius; if (pre_log == 0) { pre_log = 0.001f; } float l = (float)Math.Log(pre_log) * m_fLensEffect; float new_r = (float)Math.Exp(l) * m_fRadius; if (Math.Sqrt((vect.X * vect.X + vect.Y * vect.Y)) > 0) { vect = CCPointExtension.ccpNormalize(vect); CCPoint new_vect = CCPointExtension.ccpMult(vect, new_r);; v.z += CCPointExtension.ccpLength(new_vect) * m_fLensEffect; } } setVertex(new ccGridSize(i, j), v); } } m_bDirty = false; } }
public override void update(float time) { for (int i = 0; i < this.m_sGridSize.x + 1; i++) { for (int j = 0; j < this.m_sGridSize.y + 1; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); ccVertex3F _ccVertex3F1 = _ccVertex3F; _ccVertex3F1.x = _ccVertex3F1.x + (float)(this.random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); ccVertex3F _ccVertex3F2 = _ccVertex3F; _ccVertex3F2.y = _ccVertex3F2.y + (float)(this.random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); if (this.m_bShakeZ) { ccVertex3F _ccVertex3F3 = _ccVertex3F; _ccVertex3F3.z = _ccVertex3F3.z + (float)(this.random.Next() % (this.m_nRandrange * 2) - this.m_nRandrange); } base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } }
public override void Update(float time) { int i, j; for (i = 0; i < (m_sGridSize.x + 1); ++i) { for (j = 0; j < (m_sGridSize.y + 1); ++j) { ccVertex3F v = originalVertex(new ccGridSize(i, j)); v.x += (random.Next() % (m_nRandrange * 2)) - m_nRandrange; v.y += (random.Next() % (m_nRandrange * 2)) - m_nRandrange; if (m_bShakeZ) { v.z += (random.Next() % (m_nRandrange * 2)) - m_nRandrange; } setVertex(new ccGridSize(i, j), v); } } }
public override void update(float time) { for (int i = 0; i < this.m_sGridSize.x + 1; i++) { for (int j = 0; j < this.m_sGridSize.y + 1; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); CCPoint cCPoint = CCPointExtension.ccpSub(this.m_positionInPixels, new CCPoint(_ccVertex3F.x, _ccVertex3F.y)); float mFRadius = (float)Math.Sqrt((double)(cCPoint.x * cCPoint.x + cCPoint.y * cCPoint.y)); if (mFRadius < this.m_fRadius) { mFRadius = this.m_fRadius - mFRadius; float single = (float)Math.Pow((double)(mFRadius / this.m_fRadius), 2); ccVertex3F _ccVertex3F1 = _ccVertex3F; _ccVertex3F1.z = _ccVertex3F1.z + (float)Math.Sin((double)(time * 3.14159274f * (float)this.m_nWaves * 2f + mFRadius * 0.1f)) * this.m_fAmplitude * this.m_fAmplitudeRate * single; } base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } }
public override void update(float time) { int i, j; for (i = 0; i < (m_sGridSize.x + 1); ++i) { for (j = 0; j < (m_sGridSize.y + 1); ++j) { ccVertex3F v = originalVertex(new ccGridSize(i, j)); CCPoint vect = CCPointExtension.ccpSub(m_positionInPixels, new CCPoint(v.x, v.y)); float r = (float)Math.Sqrt((vect.x * vect.x + vect.y * vect.y)); if (r < m_fRadius) { r = m_fRadius - r; float rate = (float)Math.Pow(r / m_fRadius, 2); v.z += ((float)Math.Sin(time * (float)Math.PI * m_nWaves * 2 + r * 0.1f) * m_fAmplitude * m_fAmplitudeRate * rate); } setVertex(new ccGridSize(i, j), v); } } }
public override void update(float time) { float single = Math.Max(0f, time - 0.25f); float single1 = -100f - single * single * 500f; float single2 = -1.57079637f * (float)Math.Sqrt((double)time); float single3 = 1.57079637f + single2; float single4 = (float)Math.Sin((double)single3); float single5 = (float)Math.Cos((double)single3); for (int i = 0; i <= this.m_sGridSize.x; i++) { for (int j = 0; j <= this.m_sGridSize.y; j++) { ccVertex3F _ccVertex3F = base.originalVertex(new ccGridSize(i, j)); float single6 = (float)Math.Sqrt((double)(_ccVertex3F.x * _ccVertex3F.x + (_ccVertex3F.y - single1) * (_ccVertex3F.y - single1))); float single7 = single6 * single4; float single8 = (float)Math.Asin((double)(_ccVertex3F.x / single6)); float single9 = single8 / single4; float single10 = (float)Math.Cos((double)single9); if ((double)single9 > 3.14159265358979) { _ccVertex3F.x = 0f; } else { _ccVertex3F.x = single7 * (float)Math.Sin((double)single9); } _ccVertex3F.y = single6 + single1 - single7 * (1f - single10) * single4; _ccVertex3F.z = single7 * (1f - single10) * single5 / 7f; if (_ccVertex3F.z < 0.5f) { _ccVertex3F.z = 0.5f; } base.setVertex(new ccGridSize(i, j), _ccVertex3F); } } }
public override void update(float time) { float angle = (float)Math.PI * time; // 180 degrees float mz = (float)Math.Sin(angle); angle = angle / 2.0f; // x calculates degrees from 0 to 90 float mx = (float)Math.Cos(angle); ccVertex3F v0, v1, v; ccVertex3F diff = new ccVertex3F(); v0 = originalVertex(new ccGridSize(1, 1)); v1 = originalVertex(new ccGridSize(0, 0)); float x0 = v0.x; float x1 = v1.x; float x; ccGridSize a, b, c, d; if (x0 > x1) { // Normal Grid a = new ccGridSize(0, 0); b = new ccGridSize(0, 1); c = new ccGridSize(1, 0); d = new ccGridSize(1, 1); x = x0; } else { // Reversed Grid c = new ccGridSize(0, 0); d = new ccGridSize(0, 1); a = new ccGridSize(1, 0); b = new ccGridSize(1, 1); x = x1; } diff.x = (x - x * mx); diff.z = Math.Abs((float)Math.Floor((x * mz) / 4.0f)); // bottom-left v = originalVertex(a); v.x = diff.x; v.z += diff.z; setVertex(a, v); // upper-left v = originalVertex(b); v.x = diff.x; v.z += diff.z; setVertex(b, v); // bottom-right v = originalVertex(c); v.x -= diff.x; v.z -= diff.z; setVertex(c, v); // upper-right v = originalVertex(d); v.x -= diff.x; v.z -= diff.z; setVertex(d, v); }
/// <summary> /// sets a new vertex to a certain position of the grid /// </summary> /// <param name="pos"></param> /// <param name="vertex"></param> public void setVertex(ccGridSize pos, ccVertex3F vertex) { //CCGrid3D* g = (CCGrid3D*)m_pTarget->getGrid(); //g->setVertex(pos, vertex); throw new NotImplementedException(); }
public void setVertex(int px, int py, ccVertex3F vertex) { int index = px * (m_sGridSize.y + 1) + py; ccVertex3F[] vertArray = m_pVertices; vertArray[index].x = vertex.x; vertArray[index].y = vertex.y; vertArray[index].z = vertex.z; //System.Diagnostics.Debug.WriteLine("setVertex: {0},{1} = {2},{3},{4}", px, py, vertex.x, vertex.y, vertex.z); }
public override void calculateVertexPoints() { float width = (float)m_pTexture.ContentSizeInPixels.width; float height = (float)m_pTexture.ContentSizeInPixels.height; float imageH = m_pTexture.ContentSizeInPixels.height; m_pVertices = new ccVertex3F[(m_sGridSize.x + 1) * (m_sGridSize.y + 1)]; m_pOriginalVertices = new ccVertex3F[(m_sGridSize.x + 1) * (m_sGridSize.y + 1)]; m_pTexCoordinates = new CCPoint[(m_sGridSize.x + 1) * (m_sGridSize.y + 1)]; m_pIndices = new short[m_sGridSize.x * m_sGridSize.y * 6]; ccVertex3F[] vertArray = m_pVertices; CCPoint[] texArray = m_pTexCoordinates; short[] idxArray = m_pIndices; //int idx = -1; for (int x = 0; x < m_sGridSize.x; ++x) { for (int y = 0; y < m_sGridSize.y; ++y) { int idx = (y * m_sGridSize.x) + x; float x1 = x * m_obStep.x; float x2 = x1 + m_obStep.x; float y1 = y * m_obStep.y; float y2 = y1 + m_obStep.y; int a = x * (m_sGridSize.y + 1) + y; int b = (x + 1) * (m_sGridSize.y + 1) + y; int c = (x + 1) * (m_sGridSize.y + 1) + (y + 1); int d = x * (m_sGridSize.y + 1) + (y + 1); short[] tempidx = new short[6] { (short)a, (short)d, (short)b, (short)b, (short)d, (short)c }; Array.Copy(tempidx, 0, idxArray, 6 * idx, tempidx.Length); int[] l1 = new int[4] { a, b, c, d }; ccVertex3F e = new ccVertex3F(x1, y1, 0); ccVertex3F f = new ccVertex3F(x2, y1, 0); ccVertex3F g = new ccVertex3F(x2, y2, 0); ccVertex3F h = new ccVertex3F(x1, y2, 0); ccVertex3F[] l2 = new ccVertex3F[4] { e, f, g, h }; int[] tex1 = new int[4] { a, b, c, d }; CCPoint[] tex2 = new CCPoint[4] { new CCPoint(x1, y1), new CCPoint(x2, y1), new CCPoint(x2, y2), new CCPoint(x1, y2) }; for (int i = 0; i < 4; ++i) { vertArray[l1[i]] = new ccVertex3F(); vertArray[l1[i]].x = l2[i].x; vertArray[l1[i]].y = l2[i].y; vertArray[l1[i]].z = l2[i].z; texArray[tex1[i]] = new CCPoint(); texArray[tex1[i]].x = tex2[i].x / width; if (m_bIsTextureFlipped) { texArray[tex1[i]].y = tex2[i].y / height; } else { texArray[tex1[i]].y = (imageH - tex2[i].y) / height; } } } } Array.Copy(m_pVertices, m_pOriginalVertices, (m_sGridSize.x + 1) * (m_sGridSize.y + 1)); }
/// <summary> /// sets a new vertex at a given position /// </summary> public void setVertex(ccGridSize pos, ccVertex3F vertex) { int index = pos.x * (m_sGridSize.y + 1) + pos.y; ccVertex3F[] vertArray = m_pVertices; vertArray[index].x = vertex.x; vertArray[index].y = vertex.y; vertArray[index].z = vertex.z; }
/// <summary> /// sets a new vertex to a certain position of the grid /// </summary> public void setVertex(ccGridSize pos, ccVertex3F vertex) { CCGrid3D g = (CCGrid3D)m_pTarget.Grid; g.setVertex(pos, vertex); }
public ccVertex3F vertices; // 12 bytes #endregion Fields #region Constructors public ccV3F_C4B_T2F() { vertices = new ccVertex3F(); colors = new ccColor4B(); texCoords = new ccTex2F(); }
public static ccVertex3F vertex3(float x, float y, float z) { ccVertex3F c = new ccVertex3F(x, y, z); return c; }
public ccQuad3() { tl = new ccVertex3F(); tr = new ccVertex3F(); bl = new ccVertex3F(); br = new ccVertex3F(); }
public override void update(float time) { float angle = (float)Math.PI * time; // 180 degrees float mz = (float)Math.Sin(angle); angle = angle / 2.0f; // x calculates degrees from 0 to 90 float my = (float)Math.Cos(angle); ccVertex3F v0, v1, v; ccVertex3F diff = new ccVertex3F(); v0 = originalVertex(new ccGridSize(1, 1)); v1 = originalVertex(new ccGridSize(0, 0)); float y0 = v0.y; float y1 = v1.y; float y; ccGridSize a, b, c, d; if (y0 > y1) { // Normal Grid a = new ccGridSize(0, 0); b = new ccGridSize(0, 1); c = new ccGridSize(1, 0); d = new ccGridSize(1, 1); y = y0; } else { // Reversed Grid b = new ccGridSize(0, 0); a = new ccGridSize(0, 1); d = new ccGridSize(1, 0); c = new ccGridSize(1, 1); y = y1; } diff.y = y - y * my; diff.z = Math.Abs((float)Math.Floor((y * mz) / 4.0f)); // bottom-left v = originalVertex(a); v.y = diff.y; v.z += diff.z; setVertex(a, v); // upper-left v = originalVertex(b); v.y -= diff.y; v.z -= diff.z; setVertex(b, v); // bottom-right v = originalVertex(c); v.y = diff.y; v.z += diff.z; setVertex(c, v); // upper-right v = originalVertex(d); v.y -= diff.y; v.z -= diff.z; setVertex(d, v); }
public void setVertex(int i, int j, ccVertex3F vertex) { CCGrid3D g = (CCGrid3D)m_pTarget.Grid; g.setVertex(i, j, vertex); }