Jump to content
  • Advertisement

Jason Jones

Member
  • Content Count

    9
  • Joined

  • Last visited

Posts posted by Jason Jones


  1.  

    Some criticisms:

    • Why is everything public?
    • Getters and Setters are often a code-smell or unnecessary java-ism.
    • Why is everything public and you also have many getters and setters?
    • Your naming conventions are all over the place, I see lowercase-underscore, PascalCase, and camelCase all mixed together.
    • Your naming choices for member functions and member variables are unintuitive and unclear.
    • I don't see 'const' used anywhere -- const-correctness is an integral part of maintaining the invariant state a class is supposed to maintain.
    • I don't see you passing parameters by reference anywhere except where it would be dictated by D3D convention -- I could be wrong about this, as I'm not familiar with all of these data structures you refer to, but my experience says that passing by const reference is usually more prevalent than what I can see here.
    • You have several cases of 'foo1(...)' and 'foo2(...)' that have the same parameter and return types. 1 and 2 doesn't tell me anything -- the function name should tell me what's different about them.
    • You mostly don't name your parameters -- while this is allowed and even sometimes useful, its more-often bad form for a public interface to not describe what its parameters are. When the class members are implemented in a non-header file, clients won't see the names you give them there.
    • It looks like some of your member functions shouldn't be members -- these should probably be non-member-non-friend functions. If they're part of the same logical interface, keep them in the same namespace, otherwise put them in another namespace. For example, 'void createSphere(  LPDIRECT3DDEVICE9&)'

     

    Interesting comments, I shall attend to them.

     

    Thanks for your input.


  2. Hi, I have a couple of classes here, are they okay, how could I improve them,
     
    thanks in advance . ..
     
    class mesh_object
    {
    public:
        LPD3DXMESH              m_Mesh;
        LPD3DXMESH              sub_set;
        LPD3DXMESH              inplace;
        LPD3DXMESH              sub_Surface ;
        LPD3DXMESH              tm_mesh;
        LPD3DXMESH              Quad_Clone;
        LPD3DXMESH              Bounding_Box;
        LPD3DXMESH              m_worldAxisCursor;
        LPD3DXMESH              m_localdAxisCursor;
        LPD3DXMESH              pCursor;
        LPD3DXMESH              LINE_SEG_MID_POINTS ;
        LPD3DXMESH              e_tmp;
        D3DVECTOR*              v_quad_ptr;
        DWORD dw_select;
        DWORD dw_select_II;
        WORD* v_sel;
        DWORD v_num; 
        D3DVECTOR v_Center;
        materials*             mat_ptr;
     
        mesh_object();
        void createSphere(  LPDIRECT3DDEVICE9&  );
        void Build_Cursor(  LPDIRECT3DDEVICE9&  );
        LPD3DXMESH createAxisCursor(  LPDIRECT3DDEVICE9&   );
        void render( HWND,
                     LPDIRECT3DDEVICE9&, 
                     materials*,
                     matrix, 
                     LPD3DXMESH, 
                     LPD3DXMESH,
                     LPD3DXMESH,
                     LPD3DXMESH,
                     LPD3DXMESH,
                     LPD3DXMESH,
                     bool,
                     bool,
                     float 
                    );
     
       LPD3DXMESH Generate_Normals(LPD3DXMESH );
       LPD3DXMESH mesh_x_rotation(LPD3DXMESH, float, DWORD );
       LPD3DXMESH mesh_y_rotation(LPD3DXMESH, float, DWORD );
       LPD3DXMESH mesh_z_rotation(LPD3DXMESH, float, DWORD );
       LPD3DXMESH update_cursor( LPD3DXMESH  );
       D3DVECTOR Zero_Bounding_Center( LPD3DXMESH ); 
       D3DVECTOR Get_Bounds(LPD3DXMESH );
       D3DVECTOR Get_Bounds_1(LPD3DXMESH );
       mesh_object re_initialize( mesh_object );
       LPD3DXMESH update_mesh_cursor( LPD3DXMESH , D3DVECTOR   );
       LPD3DXMESH  Set_Mesh_Color(LPD3DXMESH );
       LPD3DXMESH  Set_Mesh_Color_WHITE(LPD3DXMESH );
       LPD3DXMESH move_mesh( LPD3DXMESH , float , float , float  );
       LPD3DXMESH  inializeColors( LPD3DXMESH p_mesh,
                                     int pointStep );
       bool CheckOrientation( LPD3DXMESH );
       LPD3DXMESH Get_Face( LPD3DXMESH ,  DWORD );
       DWORD Select_face(LPD3DXMESH , HWND, LPDIRECT3DDEVICE9&  );
       DWORD Get_Next_Face( LPD3DXMESH p_mesh,  DWORD dw_index  );
       LPD3DXMESH GetLastVertex( LPD3DXMESH, DWORD, DWORD );
       WORD* mesh_object::GetIndex( LPD3DXMESH p_mesh, WORD* wrd_ptr );
       LPD3DXMESH SetAffineLocators( LPD3DXMESH, WORD* );
       LPD3DXMESH GetAffineCenter(LPDIRECT3DDEVICE9&,
                                   LPD3DXMESH, 
                                   LPD3DXMESH,
                                   WORD* );
     
     
        LPD3DXMESH SetAffineCenter( LPDIRECT3DDEVICE9& p_device,
                                    LPD3DXMESH p_mesh, 
                                    LPD3DXMESH e_mesh,
                                    WORD* w_ptr );
     
        D3DVECTOR GetBounds(LPD3DXMESH, int );
        DWORD PreProcessQuad( LPD3DXMESH p_mesh  );
     
        LPD3DXMESH create_mesh_from_index( LPDIRECT3DDEVICE9& p_device,   
                                           WORD* p_Index,      
                                           LPD3DXMESH p_mesh,      
                                           int n_point );
        FLOAT_QUAD Get_Mid_Point_RC( LPD3DXMESH , DWORD   );
        D3DVECTOR* getLocatorVectors( LPD3DXMESH,
                                       FLOAT_QUAD , 
                                       D3DVECTOR* 
                                     );
     
        D3DVECTOR GetspecificVector( D3DVECTOR, 
                                     LPD3DXMESH ,
                                     int  );
     
        LPD3DXMESH CloneAffineObject( LPDIRECT3DDEVICE9& p_device, 
                                      LPD3DXMESH, 
                                      WORD* );
     
     
     
    };
     
    class arbitrary_transform
    {
    public:
     
        bool b_affine_scale;
        D3DXVECTOR3* v_normal;
        D3DXVECTOR3* v_rotation_normal;
        D3DXVECTOR3* v_rotation_normal_A;
        D3DXVECTOR3* v_normal_II;
        D3DXVECTOR3* v_cursor_normal;
        D3DXVECTOR3* v_edit_object_normal;
        D3DXVECTOR3* Align_Vec;
        D3DXMATRIX arb_transform;
        D3DXMATRIX normal_transform;
        D3DXMATRIX edit_object_transform;
        D3DXMATRIX re_rotation;
        D3DXMATRIX re_rotation_A;
        D3DXMATRIX local_Transform;
        D3DXMATRIX ROTATION_B;
        D3DXMATRIX ROTATION_A;
        D3DXMATRIX  secondary_transform;
        D3DXMATRIX scale_Transform;
        D3DXVECTOR3* aX ;
        D3DXVECTOR3* aY ;
        D3DXVECTOR3* aZ ;
        D3DXVECTOR3*  v1;
        D3DXVECTOR3*   v2;
        bool bdrawAffineSelect ;
        D3DXVECTOR3* local_Normal ;
        DWORD dw_transform_type ;
        D3DXMATRIX arb_transform_A;
        D3DXMATRIX mat_center;
        D3DVECTOR v_mid_point;
        float m_Angle;
     
    public:
     
        arbitrary_transform() ;
     
        ~arbitrary_transform() { }
     
        D3DXVECTOR3* GetAffineMidPointNormal( LPD3DXMESH, D3DXVECTOR3* );
     
        D3DXMATRIX create_arbitary_axis( D3DXVECTOR3*  );
     
        D3DXMATRIX create_non_affine_axis( D3DXVECTOR3*  );
     
        D3DXMATRIX CreateLocalAxis( D3DXVECTOR3* ,
                                    D3DXVECTOR3*,
                                    D3DXVECTOR3* );
     
        LPD3DXMESH Mesh_Transform_ArbObject( LPD3DXMESH, 
                                        D3DXMATRIX 
           );
     
        LPD3DXMESH RotatateSubMeshOrthogonal( LPD3DXMESH, D3DXVECTOR3* );
     
        int GetDotRotationDir( LPD3DXMESH );
     
        float GetDotRotationValue( LPD3DXMESH );
     
        float GetDotRotationValueYW( LPD3DXMESH );
     
        DWORD Get_Quad_Orientation( LPD3DXMESH  );
     
        float GetDotRotationValue_YW_2( LPD3DXMESH );
     
     
     
        LPD3DXMESH Mesh_Transform_Arb( LPD3DXMESH, 
                                        D3DXMATRIX );
     
     
        LPD3DXMESH Mesh_Transform_Arb2( LPD3DXMESH, 
                                        D3DXMATRIX );
     
        LPD3DXMESH TransformVerticesAndNormalsArb( LPD3DXMESH ,
                                                   D3DXMATRIX  ,         
                                                   D3DXMATRIX );
     
        D3DXVECTOR3* Get_Arb_Normal( LPD3DXMESH, WORD*, DWORD );
        D3DVECTOR Get_Arb_Vertex( LPD3DXMESH, WORD*, DWORD );
        D3DXVECTOR3* GetAX( LPD3DXMESH, D3DXVECTOR3* );
        D3DXVECTOR3* GetAY( LPD3DXMESH, D3DXVECTOR3* );
        D3DXVECTOR3* GetAZ( LPD3DXMESH, D3DXVECTOR3* );
        LPD3DXMESH Transform_Coordinate_Plane( LPD3DXMESH,
                                           D3DVECTOR );
     
        D3DXVECTOR3* GetAYCrossAY( D3DXVECTOR3*, D3DXVECTOR3*, D3DXVECTOR3* );
     
       LPD3DXMESH  InsertAffineMidPoint( D3DVECTOR, 
                                         LPD3DXMESH ,
                                         LPDIRECT3DDEVICE9&,
                                         LPD3DXMESH );
     
        D3DVECTOR* GetConstantvectors( WORD*,
                                       LPD3DXMESH,
                                       D3DVECTOR, 
                                       DWORD
                                     );
     
        LPD3DXMESH Set_Arb_Vertex_Color( LPD3DXMESH , WORD* , DWORD  );
        LPD3DXMESH Translate_Arb_Mat( LPD3DXMESH, D3DXMATRIX, D3DVECTOR );
        LPD3DXMESH translate_mesh( LPD3DXMESH , float , float , float  );
     
    };
    
     

  3.  

    Thanks for the advise, I think its a kind of dyslexic thing.


    With respect, this kind of thing is conceptual and nothing to do with dyslexia.

    This is to do with understanding core concepts about when and when not to use dynamically allocated memory.

    My concern is you do yourself no favours by dismissing this kind of misunderstanding as something beyond your control. But none of my business really. Good luck.

     

    Yes, you are 100 % right it is a conceptual thing and pointers took a long time for me to get in c and c++ as the notation is a little confusing. So, there are is a confusion of notation but the notation defines and describes a concept.

     

    your input has been really useful as it has clarified the concept.

     

    Which is good for me, thanks for your help.


  4. I am no C++ / DX API guru or anything, but....

     

    Even for guys that will understand more of your work it would be really helpfull to have at least a short description of what you are trying to achieve with your code. I understand you having difficulties with writing longer texts, still, would help a lot getting a pretext.

     

    Then the code you show is very long and with no breaks in between. More comments would certainly help guide the reader, and might help yourself down the line if you open the same code again in a year.

     

     

    Sadly I cannot really judge the quality of your work when it comes to code, I am not (yet) an expert in what you wrote. I'll leave that to others.

     

     

    Don't worry too much about the dyslexia... for some of us english is a second language and we fight (almost) the same fight as you do with it. I have not seen the usual grammar obsessed person on this forum yet that seem to frequent others, so you should be fine.

    Thanks for your comments, the website itself is very much a product of recruiters not wanting to acknowledge that I am a  software engineer which is very frustrating an I think that comes across in the web site, so it was a case of uploading what I could, code and the result of the code and hope that they would 'get it' but they just do not want to know so the comments on this post are very useful.

     

    Thanks again for your comments.


  5. I won't judge the code itself, I do not consider having enough experience for that but. As Giant-Reto said the formating is confusing I'd recommend :

     

    - The formating (indent for exemple) is totally broken and some part are unreadable. If you don't intend to correct this, at least allow the download of the files.
    - Make smaller chunk of code
    - Use more comment
    - Explain what the code do. ("This code allow the user to do this." "This code draw a white pinguin")

     

    As a "bonus" here is some kind of rude comments on the whole website.

    - No offense but I find your website ugly, the flashy colors, the broken format, etc...
    - On the homepage there is absolutely no explanation. What is this site for? Where do I go to see your work? What the fuck are all these buttons and images?
    - There is only a black square in "Links"

    But well, their seems to be a lot of content.

    Thanks for your comments, I like the'bonus' comments they are useful.

     

    And in a way you and the otter posts have answered a question as to how to  put the web site together and I think the solution is as follows :

    I should create a prettier web site that is easy to navigate that takes the browser through the work on a step by step basis.

     

    So, really some type of use friendly abstraction level between the concepts that are being developed, why they are difficult to achieve and then how to implement a solution

     

    even other developers do not want or have the time to put on another thinking cap just to browse a web site, i guess.

     

    Thanks for your suggestions.


  6. The download section and library section seem to be the same.

    There are a lot of snapshots and place-holders on the site, so it is a bit messy now.

    As for the code, what i suppose you wanted feedback on, not my expertise so i can't say.

     

    I didn't see any typos btw, but i 'm curious, typos in programming are usually a lot less forgiving, how do you handle that ?

    Yes you are absolutely right the dyslexic errors cab be the most expensive as they usually cannot be seen a common one being mistyping a minus in a for loop instead of an equal example : for ( x - i ; x < j; j++), can be a real show stopper.


  7. In VecInterpolateMidPoint, why are you dynamically allocating those vectors? Just use normal stack variables. You can still pass them to the D3DX method using the address-of operator:

    D3DXVECTOR3 vA;
    D3DXVECTOR3 vB;
    D3DXVECTOR3 V_LERP;
    
    /* ... */
    
    D3DXVec3Lerp(V_LERP, &vA, &vB, s);
    

    Or, if the second two params aren't modfiied (i.e. are const D3DXVECTOR3*)

    D3DXVec3Lerp(V_LERP, &p, &p1, s);
    

    I suspect you might be thinking you need to allocate because these methods take pointers. Not so, its just D3DX is a C interface so pointers are used.

     

    Unnecessary dynamic allocation will bite you eventually when you forget to delete it via one of many possible paths out of a function.

    Thanks for the advise, I think its a kind of dyslexic thing.

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!