• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

149 Neutral

About Veslefrikk

  • Rank
  1. How to render 3D model faster?

    start using VBO's and you get a majot boost in rendering speed, and now im refering to VBO on the GPU wich you can achieve through extensions or opengl 2.0. http://www.ozone3d.net/tutorials/opengl_vbo.php should get you started Stefan
  2. Importing MS3D files, what's next?

    I suggest you make your own internal object format and just convert whatever you are loading to that at run time. These support classes you mention vector/quaternion etc should be the same for whatever format you are loading and should only need to be written once. Thats as specific I can get get based on the information given, if you describe your problem in more detail we might be of further help.
  3. Hi.. Ive been strugling with this all day, so any feedback would be much appriciated. Im trying to have a turret in my 3d scene target the camera in this example. This is my current code wich works fine until I add some X and Z rotation to the source object, then it seems like the target vector dont get transformed into the source orientation. D3DXVECTOR3 A = D3DXVECTOR3( 0.0f, 0.0f, 0.0f ); // camera is always at 0,0,0 D3DXVec3TransformCoord( &A, &A, &ship_entity.matrix ); // transformation matrix D3DXVECTOR3 B = D3DXVECTOR3( 0.0f, 0.0f, -1.0f ); // Source object D3DXVec3TransformCoord( &B, &B, &ship_entity.matrixRot ); // Rotation matrix D3DXVec3Normalize(&A,&A); D3DXVec3Normalize(&B,&B); float Dot = D3DXVec3Dot(&A,&B); float angle = acosf(Dot); D3DXVECTOR3 cross; D3DXVec3Cross(&cross,&A,&B); if( cross.y > 0.0f ) ship_entity.AddYRot(-0.001f); else ship_entity.AddYRot(+0.001f); Stefan
  4. After upgrading to SP1 I get this message then running my little projects. D3D10: WARNING: ID3D10ShaderResourceView1::GetDesc: GetDesc is a legacy API. D3D10_SHADER_RESOURCE_VIEW_DESC cannot expose all the functionality available for D3D10.1. If any part of the application uses CreateShaderResourceView1, GetDesc1 needs to be used in order to reflect all the information used during creation.However, if an application only uses D3D10.0 functionality (ie. the legacy CreateShaderResourceView), the legacy GetDesc is adequate.The legacy GetDesc will provide the closest match of information that the API could determine, ensuring that CreateShaderResourceView will continue to be properly reflected. [ STATE_GETTING WARNING #393: SHADERRESOURCEVIEW_GETDESC_LEGACY ] Ive traced it to coming from the ID3DX10Font class. I havent figured out how to fix it though. Anyone have a clue on this ? Stefan
  5. Full screen exit

    I get these when doing an exit from full screen mode in directx10 D3D10: INFO: ID3D10Device::OMSetRenderTargets: A currently bound DepthStencilView is being deleted; so naturally, will no longer be bound. [ STATE_SETTING INFO #49: OMSETRENDERTARGETS_UNBINDDELETINGOBJECT ] D3D10: INFO: ID3D10Device::OMSetRenderTargets: A currently bound RenderTargetView is being deleted; so naturally, will no longer be bound. [ STATE_SETTING INFO #49: OMSETRENDERTARGETS_UNBINDDELETINGOBJECT ] D3D10: INFO: ID3D10Device::RSSetState: The currently bound RasterizerState is being deleted; so naturally, will no longer be bound. [ STATE_SETTING INFO #46: RSSETSTATE_UNBINDDELETINGOBJECT ] in my debugoutput. Anyone who can give me an uphead on this Stefan
  6. Moving a camera forwards (3D)

    3d rotation is represented by a 3x3 matrix. The 3x3 matrix is made up of 3 vectors wich represent unit vectors representing a xyz axis system. Thus, if you want your camera to move in the new z axis(after rotation) you just use the z vector from the matrix and add that to the camera postion. I'll illustrate [xx, xy, xz] [yx, yy, yz] [zx, zy, zz] 4x4 matrix is no different [xx, xy, xz, xw] [yx, yy, yz, yw] [zx, zy, zz, zw] [wx, wy, wz, ww] delta=speed*time; camera.x += zx * delta; camera.y += zy * delta; camera.z += zz * delta; Stefan
  7. Im making a GUI wrapper for the DXUT gui functions. Now when I put the void CALLBACK GUI::OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext ) into the class and passing the pointers to it with bool GUI::Init() { g_HUD.SetCallback( OnGUIEvent ); } during setup i get this: gui.cpp(14) : error C3867: 'GUI::OnGUIEvent': function call missing argument list; use '&GUI::OnGUIEvent' to create a pointer to member I cant see what the difference is before I put it into a class. Stefan
  8. There are samples with the directx sdk that does exactly that and more. Stefan
  9. writing a graphic engine

    For what reason do you want to make a cpu only graphic engine.? Stefan
  10. Vector3D class, optimization advice

    Thanks for all the replies, there is definatly always something new to learn about this language and how to utilitize it. Vector class i new and improved now from the suggestions, and I should be a bit wiser :D Stefan
  11. Problem in Render in large coordinate

    Quote:Original post by swiftcoder Quote:Original post by Veslefrikk doubles should do the trick though, if you are using doubles then Im pretty sure they get converted to float somewhere during your calculations.Graphics cards don't have doubles, so if you are specifying your vertices in doubles, they will be truncated to floats. They only simple way to work around this is to specify vertices in object-local coordinates, and translate the entire scene by 800000. Kinda what I meant. Im working on a planetary engine and I need to translate every object into camera space before sending the values to the direcx pipeline. So the camera is always at 0,0,0 sorta speak. Stefan
  12. Problem in Render in large coordinate

    doubles should do the trick though, if you are using doubles then Im pretty sure they get converted to float somewhere during your calculations. Stefan
  13. Hi, put together a template Vector class today. This will be utilized alot in my engine so I would love to get some feedback on what can be done better/faster. template <typename T> class Vector3D { private: T x,y,z; protected: public: Vector3D(); Vector3D(T,T,T); Vector3D(Vector3D&); // ~Vector3D(); bool operator==(const Vector3D&) const; Vector3D<T> operator+(const Vector3D&) const; Vector3D<T> operator-(const Vector3D&) const; Vector3D<T> operator-() const; Vector3D<T> operator/(float) const; Vector3D<T> operator*(float) const; Vector3D<T> operator*(const Matrix&) const; void operator+=(const Vector3D&); void operator-=(const Vector3D&); T Dot(const Vector3D&) const; Vector3D<T> Cross(const Vector3D&) const; T Magnitude() const; T Distance(const Vector3D& v) const; void Normalize(); void Set(T,T,T); void Set(Vector3D&); void Print() const; friend ostream& operator<<(ostream& os, const Vector3D&); }; template <typename T> Vector3D<T>::Vector3D() : x(0), y(0), z(0) {} template <typename T> Vector3D<T>::Vector3D(T _x, T _y, T _z) : x(_x), y(_y), z(_z) {} template <typename T> Vector3D<T>::Vector3D(Vector3D& v) : x(v.x), y(v.y), z(v.z) {} template <typename T> bool Vector3D<T>::operator==(const Vector3D& v) const { return (x == v.x && y == v.y && z == v.z); } template <typename T> Vector3D<T> Vector3D<T>::operator+(const Vector3D& v) const { return Vector3D( x + v.x, y + v.y, z + v.z); } template <typename T> Vector3D<T> Vector3D<T>::operator-(const Vector3D& v) const { return Vector3D( x - v.x, y - v.y, z - v.z); } template <typename T> Vector3D<T> Vector3D<T>::operator-() const { return Vector3D( -x, -y, -z); } template <typename T> Vector3D<T> Vector3D<T>::operator/(float s) const { float sInv = 1.0f / s; return Vector3D( x*sInv, y*sInv, z*sInv); } template <typename T> Vector3D<T> Vector3D<T>::operator*(float s) const { return Vector3D( x*s, y*s, z*s); } template <typename T> Vector3D<T> Vector3D<T>::operator*(const Matrix& m) const { return Vector3D(x*m.m11 + y*m.m12 + z*m.m13, x*m.m21 + y*m.m22 + z*m.m23, x*m.m31 + y*m.m32 + z*m.m33 ); } template <typename T> void Vector3D<T>::operator+=(const Vector3D& v) { x+=v.x; y+=v.y; z+=v.z; } template <typename T> void Vector3D<T>::operator-=(const Vector3D& v) { x-=v.x; y-=v.y; z-=v.z; } template <typename T> T Vector3D<T>::Dot(const Vector3D& v) const { return v.x*x + v.y*y + v.z*z; } template <typename T> Vector3D<T> Vector3D<T>::Cross(const Vector3D& v) const { return Vector( y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x ); } template <typename T> T Vector3D<T>::Magnitude() const { return sqrt( x*x + y*y + z*z ); } template <typename T> T Vector3D<T>::Distance(const Vector3D& v) const { return (*this - v).Magnitude(); } template <typename T> void Vector3D<T>::Normalize() { T mag = ( x*x + y*y + z*z ); if (mag == 0) return; T mul = 1/sqrtf((float)mag); x *= mul; y *= mul; z *= mul; return; } template <typename T> void Vector3D<T>::Set(T _x, T _y, T _z) { x=_x; y=_y; z=_z; } template <typename T> void Vector3D<T>::Set(Vector3D& v) { x=v.x; y=v.y; z=v.z; } template <typename T> void Vector3D<T>::Print() const { cout << fixed << "X: " << x << "\tY: " << y << "\tZ: " << z << endl; } ostream& operator<<(ostream& os, const Vector3D<float>& v) { return os<< fixed << "X: " << v.x << "f\tY: " << v.y << "f\tZ: " << v.z << "f" << endl; } Stefan Edit: source formatting works, must have done something wrong the first time around. :) [Edited by - Veslefrikk on December 9, 2008 12:00:44 AM]
  14. Game Development Comic

    I like it already.. Keep us posted :) Stefan
  • Advertisement