derek7

Members
  • Content count

    818
  • Joined

  • Last visited

Community Reputation

100 Neutral

About derek7

  • Rank
    Banned
  1. wow gold

    I found I can sell wow gold to make real money. I wanna farm to make wow gold. I wanna found a American to coorerating. who are interesting?
  2. someFunction { ......... call1(); somecalc(); call2(); ......... } I draw the 3 line to a function because it often call in many app. dothing() { call1(); somecalc(); call2(); } but somecalc() is used somewhere and it cost time much. so somecalc() is called more than once.it suffer performance lost. how to refactor these code with good code sturctrue and performance. i do this way: somcalc() first call. and pass the value to dothing(). but i seem bad
  3. 1. "The compiler treats all code occurring before the .h file as precompiled" what does it mean? it from msdn about precompiled file. 2./Yufilename I found some app just use /Yufilename and /Fp ,without /Yc ,so where does the precompiled file created? by the way /Ycfilename - "The compiler compiles all code up to and including the .h file specified in filename. " I think it should be "The compiler compiles all code up to and included the .h file specified in filename. " right?
  4. if I use a IsDlgButtonChecked all is ok. but I use postmessage(hdlg,bm_getcheck,0,0) the return always is bst_checked, if you use sendmessage(hdlg,bm_getcheck,0,0) the return always is bst_unchecked. and on both situation the button does not reponse the mouse click. the focus is not change right .
  5. Quote:Original post by starman_2049 Ok, so it looks like the problem is that I do my DirectSound stuff and then my loader thread ends/exits and that causes everything I just queued up to terminate. If I put a "while(1);" at the end of the thread then all is ok, however I need some better way to handle this... I have the same problem , just call play() and terminate .the sound will not play. how to solve it? i use sleep() but it seem not good.
  6. 1. This has one very important implication: DirectSound cannot set the format of the hardware's DMA buffer. For your application, this means that the hardware format is based on the data you actually play. If you play a 44 kHz file, Kmixer will mix all data up to 44 kHz and ensure that the hardware is running at 44 kHz. but I can use IDirectSoundBuffer8::SetFormat to set primary buffer.am I right? 2. I see microsoft sample that create primary buffer and setFormat and release it immediately.why do it? the primary buffer is not gloable? 3. does sound buffer creation not affect performance? I see some sample create buffer once in initialse(), and some create buffer every time on play. I guess it is better load all sound resource on initalize() and create buffer list so during running of game ,buffer creation do not need ,just play sound is ok. right?
  7. how to do this

    Quote:Original post by PhilMorton Do your collision detection per-vertex instead of per-object. Implement distance constraints between each vertex as described in this paper- http://www.teknikus.dk/tj/gdc2001.htm However, this game that you link to doesnt actually seem to deform the sphere in real time in response to the terrain, it just looks like pre-generated animations to me. if you continue to play,the sphere is more big,it seem it realtime deformed
  8. http://www.locoroco.com/index.html?locale=en_GB the actor is a deformable sphere.it is deformed according to terrain. how to do it? some clue ,idea and links are welcome.
  9. D3DXCheckVersion

    background : I download Nvidia SDK and it provide some sample in it. I compile a Glow sample,all is ok. but run it, it pop a error:Incorrect version of Direct3D and/or D3DX. how to fix it?
  10. what does it do? msdn say:it detect lib version is dll version. but if lib version is not dll version. lib will not find the the corresponding dll. what hell does D3DXCheckVersion do?
  11. D3DXVECTOR3 * D3DXVec3TransformCoordArray( D3DXVECTOR3* pOut, UINT OutStride, CONST D3DXVECTOR3* pV, UINT VStride, CONST D3DXMATRIX* pM, UINT n ); what does outstride and vstride mean? it mean it can do vertexbuffer(contain D3DXVECTOR3 pos ,D3DXVECTOR2 tex etc...) and set stride to sizeof(vertexstruct),doesn't it? but why is pOut D3DXVECTOR3* ? if it can do a vertexbuffer and finally it ouput a D3DXVECTOR array? or must I cast pOut to vertexstruct?
  12. class A { const maxcnt; int m_log[maxcnt]; A():maxcnt(100) }; compile not pass it. why? if I use global variable const maxcnt ,all is ok. what is different?
  13. cast problem

    see the snippet Decal::Decal(const Vector3D& center, const Vector3D& normal, const Vector3D& tangent, float width, float height, float depth) { decalCenter = center; decalNormal = normal; // Calculate boundary planes float d = DotProduct(center, tangent); question : center and normal is Vector3D and DotProduct()take a Vector4D for parameter. can Vector4D automaticly convert to Vector3D? compile say no error.
  14. see the snippet Decal::Decal(const Vector3D& center, const Vector3D& normal, const Vector3D& tangent, float width, float height, float depth) { decalCenter = center; decalNormal = normal; Vector3D binormal = CrossProduct(normal, tangent); // Calculate boundary planes float d = DotProduct(center, tangent); .................. inline float DotProduct(const Vector4D& p, const Vector3D& q) { return .0f; //return (p.x * q.x + p.y * q.y + p.z * q.z + p.w); } #pragma once #include "Vector3.h" class Vector4D { public: float x; float y; float z; float w; Vector4D() {} Vector4D(const Vector3D& v, float u) { x = v.x; y = v.y; z = v.z; w = u; } Vector4D(float r, float s, float t, float u) { x = r; y = s; z = t; w = u; } Vector4D(const Vector3D& v) { x = v.x; y = v.y; z = v.z; w = 0.0F; } Vector4D(const Point3D& p) { x = p.x; y = p.y; z = p.z; w = 1.0F; } Vector4D(const Vector2D& v) { x = v.x; y = v.y; z = 0.0F; w = 0.0F; } Vector4D(const Point2D& p) { x = p.x; y = p.y; z = 0.0F; w = 1.0F; } Vector4D& Set(const Vector3D &v, float u) { x = v.x; y = v.y; z = v.z; w = u; return (*this); } Vector4D& Set(float r, float s, float t, float u) { x = r; y = s; z = t; w = u; return (*this); } float& operator [](long k) { return ((&x)[k]); } const float& operator [](long k) const { return ((&x)[k]); } Vector3D& GetVector3D(void) { return (*reinterpret_cast<Vector3D *>(this)); } const Vector3D& GetVector3D(void) const { return (*reinterpret_cast<const Vector3D *>(this)); } Point3D& GetPoint3D(void) { return (*reinterpret_cast<Point3D *>(this)); } const Point3D& GetPoint3D(void) const { return (*reinterpret_cast<const Point3D *>(this)); } Vector4D& operator =(const Vector3D& v) { x = v.x; y = v.y; z = v.z; w = 0.0F; return (*this); } Vector4D& operator =(const Point3D& p) { x = p.x; y = p.y; z = p.z; w = 1.0F; return (*this); } Vector4D& operator =(const Vector2D& v) { x = v.x; y = v.y; z = 0.0F; w = 0.0F; return (*this); } Vector4D& operator =(const Point2D& p) { x = p.x; y = p.y; z = 0.0F; w = 1.0F; return (*this); } Vector4D& operator +=(const Vector4D& v) { x += v.x; y += v.y; z += v.z; w += v.w; return (*this); } Vector4D& operator +=(const Vector3D& v) { x += v.x; y += v.y; z += v.z; return (*this); } Vector4D& operator +=(const Vector2D& v) { x += v.x; y += v.y; return (*this); } Vector4D& operator -=(const Vector4D& v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return (*this); } Vector4D& operator -=(const Vector3D& v) { x -= v.x; y -= v.y; z -= v.z; return (*this); } Vector4D& operator -=(const Vector2D& v) { x -= v.x; y -= v.y; return (*this); } Vector4D& operator *=(float t) { x *= t; y *= t; z *= t; w *= t; return (*this); } Vector4D& operator /=(float t) { float f = 1.0F / t; x *= f; y *= f; z *= f; w *= f; return (*this); } Vector4D& operator &=(const Vector4D& v) { x *= v.x; y *= v.y; z *= v.z; w *= v.w; return (*this); } Vector4D operator -(void) const { return (Vector4D(-x, -y, -z, -w)); } Vector4D operator +(const Vector4D& v) const { return (Vector4D(x + v.x, y + v.y, z + v.z, w + v.w)); } Vector4D operator +(const Vector3D& v) const { return (Vector4D(x + v.x, y + v.y, z + v.z, w)); } Vector4D operator +(const Vector2D& v) const { return (Vector4D(x + v.x, y + v.y, z, w)); } Vector4D operator -(const Vector4D& v) const { return (Vector4D(x - v.x, y - v.y, z - v.z, w - v.w)); } Vector4D operator -(const Vector3D& v) const { return (Vector4D(x - v.x, y - v.y, z - v.z, w)); } Vector4D operator -(const Vector2D& v) const { return (Vector4D(x - v.x, y - v.y, z, w)); } Vector4D operator *(float t) const { return (Vector4D(x * t, y * t, z * t, w * t)); } Vector4D operator /(float t) const { float f = 1.0F / t; return (Vector4D(x * f, y * f, z * f, w * f)); } float operator *(const Vector4D& v) const { return (x * v.x + y * v.y + z * v.z + w * v.w); } float operator *(const Vector3D& v) const { return (x * v.x + y * v.y + z * v.z); } float operator *(const Point3D& p) const { return (x * p.x + y * p.y + z * p.z + w); } float operator *(const Vector2D& v) const { return (x * v.x + y * v.y); } float operator *(const Point2D& p) const { return (x * p.x + y * p.y + w); } Vector3D operator %(const Vector3D& v) const { return (Vector3D(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x)); } Vector4D operator &(const Vector4D& v) const { return (Vector4D(x * v.x, y * v.y, z * v.z, w * v.w)); } bool operator ==(const Vector4D& v) const { return ((x == v.x) && (y == v.y) && (z == v.z) && (w == v.w)); } bool operator !=(const Vector4D& v) const { return ((x != v.x) || (y != v.y) || (z != v.z) || (w != v.w)); } Vector4D& Normalize(void) { return (*this /= sqrtf(x * x + y * y + z * z + w * w)); } Vector4D& RotateAboutX(float angle); Vector4D& RotateAboutY(float angle); Vector4D& RotateAboutZ(float angle); Vector4D& RotateAboutAxis(float angle, const Vector3D& axis); }; inline Vector4D operator +(const Vector3D& v1, const Vector4D& v2) { return (Vector4D(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z, v2.w)); } inline Vector4D operator +(const Vector2D& v1, const Vector4D& v2) { return (Vector4D(v1.x + v2.x, v1.y + v2.y, v2.z, v2.w)); } inline Vector4D operator -(const Vector3D& v1, const Vector4D& v2) { return (Vector4D(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z, -v2.w)); } inline Vector4D operator -(const Vector2D& v1, const Vector4D& v2) { return (Vector4D(v1.x - v2.x, v1.y - v2.y, -v2.z, -v2.w)); } inline Vector4D operator *(float t, const Vector4D& v) { return (Vector4D(t * v.x, t * v.y, t * v.z, t * v.w)); } inline float operator *(const Vector3D& v1, const Vector4D& v2) { return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z); } inline float operator *(const Point3D& v1, const Vector4D& v2) { return (v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v2.w); } inline float operator *(const Vector2D& v1, const Vector4D& v2) { return (v1.x * v2.x + v1.y * v2.y); } inline float operator *(const Point2D& v1, const Vector4D& v2) { return (v1.x * v2.x + v1.y * v2.y + v2.w); } inline float Dot(const Vector4D& v1, const Vector4D& v2) { return (v1 * v2); } inline float Magnitude(const Vector4D& v) { return (sqrtf(v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w)); } inline float InverseMag(const Vector4D& v) { return (1.0F / sqrtf(v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w)); } inline float SquaredMag(const Vector4D& v) { return (v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w); } #pragma once #include "Vector2.h" class Vector3D { public: float x; float y; float z; Vector3D() {} Vector3D(float r, float s, float t) { x = r; y = s; z = t; } Vector3D(const Vector2D& v, float u) { x = v.x; y = v.y; z = u; } Vector3D& Set(float r, float s, float t) { x = r; y = s; z = t; return (*this); } Vector3D& Set(const Vector2D& v, float u) { x = v.x; y = v.y; z = u; return (*this); } float& operator [](long k) { return ((&x)[k]); } const float& operator [](long k) const { return ((&x)[k]); } Vector3D& operator =(const Vector2D& v) { x = v.x; y = v.y; z = 0.0F; return (*this); } Vector3D& operator +=(const Vector3D& v) { x += v.x; y += v.y; z += v.z; return (*this); } Vector3D& operator +=(const Vector2D& v) { x += v.x; y += v.y; return (*this); } Vector3D& operator -=(const Vector3D& v) { x -= v.x; y -= v.y; z -= v.z; return (*this); } Vector3D& operator -=(const Vector2D& v) { x -= v.x; y -= v.y; return (*this); } Vector3D& operator *=(float t) { x *= t; y *= t; z *= t; return (*this); } Vector3D& operator /=(float t) { float f = 1.0F / t; x *= f; y *= f; z *= f; return (*this); } Vector3D& operator %=(const Vector3D& v) { float r, s; r = y * v.z - z * v.y; s = z * v.x - x * v.z; z = x * v.y - y * v.x; x = r; y = s; return (*this); } Vector3D& operator &=(const Vector3D& v) { x *= v.x; y *= v.y; z *= v.z; return (*this); } Vector3D operator -(void) const { return (Vector3D(-x, -y, -z)); } Vector3D operator +(const Vector3D& v) const { return (Vector3D(x + v.x, y + v.y, z + v.z)); } Vector3D operator +(const Vector2D& v) const { return (Vector3D(x + v.x, y + v.y, z)); } Vector3D operator -(const Vector3D& v) const { return (Vector3D(x - v.x, y - v.y, z - v.z)); } Vector3D operator -(const Vector2D& v) const { return (Vector3D(x - v.x, y - v.y, z)); } Vector3D operator *(float t) const { return (Vector3D(x * t, y * t, z * t)); } Vector3D operator /(float t) const { float f = 1.0F / t; return (Vector3D(x * f, y * f, z * f)); } float operator *(const Vector3D& v) const { return (x * v.x + y * v.y + z * v.z); } float operator *(const Vector2D& v) const { return (x * v.x + y * v.y); } Vector3D operator %(const Vector3D& v) const { return (Vector3D(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x)); } Vector3D operator &(const Vector3D& v) const { return (Vector3D(x * v.x, y * v.y, z * v.z)); } bool operator ==(const Vector3D& v) const { return ((x == v.x) && (y == v.y) && (z == v.z)); } bool operator !=(const Vector3D& v) const { return ((x != v.x) || (y != v.y) || (z != v.z)); } Vector3D& Normalize(void) { return (*this /= sqrtf(x * x + y * y + z * z)); } Vector3D& RotateAboutX(float angle); Vector3D& RotateAboutY(float angle); Vector3D& RotateAboutZ(float angle); Vector3D& RotateAboutAxis(float angle, const Vector3D& axis); float length() const // float length(Vector3D * this) n.length() == length(&n) { return (sqrtf(x * x + y * y + z * z)); } }; class Point3D : public Vector3D { public: Point3D() {} Point3D(float r, float s, float t) : Vector3D(r, s, t) {} Point3D& operator =(const Vector3D& v) { x = v.x; y = v.y; z = v.z; return (*this); } Point3D& operator *=(float t) { x *= t; y *= t; z *= t; return (*this); } Point3D& operator /=(float t) { float f = 1.0F / t; x *= f; y *= f; z *= f; return (*this); } Point3D& operator &=(const Vector3D& v) { x *= v.x; y *= v.y; z *= v.z; return (*this); } Point3D operator -(void) const { return (Point3D(-x, -y, -z)); } Point3D operator +(const Vector3D& v) const { return (Point3D(x + v.x, y + v.y, z + v.z)); } Point3D operator -(const Vector3D& v) const { return (Point3D(x - v.x, y - v.y, z - v.z)); } Vector3D operator -(const Point3D& p) const { return (Vector3D(x - p.x, y - p.y, z - p.z)); } Point3D operator *(float t) const { return (Point3D(x * t, y * t, z * t)); } Point3D operator /(float t) const { float f = 1.0F / t; return (Point3D(x * f, y * f, z * f)); } Point3D operator &(const Vector3D& v) const { return (Point3D(x * v.x, y * v.y, z * v.z)); } }; inline Vector3D operator *(float t, const Vector3D& v) { return (Vector3D(t * v.x, t * v.y, t * v.z)); } inline Point3D operator *(float t, const Point3D& p) { return (Point3D(t * p.x, t * p.y, t * p.z)); } inline float Dot(const Vector3D& v1, const Vector3D& v2) { return (v1 * v2); } inline Vector3D CrossProduct(const Vector3D& v1, const Vector3D& v2) { return (v1 % v2); } inline float length(const Vector3D& v) { return (sqrtf(v.x * v.x + v.y * v.y + v.z * v.z)); } inline float InverseMag(const Vector3D& v) { return (1.0F / sqrtf(v.x * v.x + v.y * v.y + v.z * v.z)); } inline float SquaredMag(const Vector3D& v) { return (v.x * v.x + v.y * v.y + v.z * v.z); } struct Origin3D_ { const Point3D& operator +(const Vector3D& v) { return (static_cast<const Point3D&>(v)); } Point3D operator -(const Vector3D& v) { return (Point3D(-v.x, -v.y, -v.z)); } }; extern Origin3D_ Origin3D;
  15. math and computation

    math is "The indispensable or intrinsic properties that characterize or identify something" I think math consist of law,equation,theorem,axiom,some rule.but where does computation come to play? I even suspect computation is not part of math. what is computation? add substract multiply division roundding is computaton. but what is the procedure of those? forexample:32+53=85 what math theory does it base? what make 32+53 to 85? I can not say more, just tell me where does computation come to play?