Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5982341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:04:25+00:00 2026-05-22T22:04:25+00:00

I am looking at Ogre3D code and WildMagic code and I found that both

  • 0

I am looking at Ogre3D code and WildMagic code and I found that both deal with their core classes a bit differently. Since I am creating my own core, I was wondering which would be better practice and could potentially be better in terms of resources.

In WildMagic, there is a Matrix class which inherits from a Table class (not polymorphic). The table class can have N row and N cols and gets getters and setters for the columns and rows. The Matrix class then has functionality that only makes sense for a Matrix and it conveniently inherits from Table. A vector can then also inherit from Table in this case (although WildMagic does not do it). WildMagic also has a Transform object that stores local and derived transformations for a Node. So a Node will have two Transform objects that contain the necessary transformations (which include position, rotation, scale).

In Ogre3D on the other hand, the Matrix class does not derive from anything and Ogre3D’s node has variables to store the local and derived positions: Vector localPos; Vector derPos; Matrix localRot; Matrix derRot; etc.

Now keep in mind these are core objects that will be used/updated/modified thousands of times per frame and it is quite hard to change them if you realize you have a performance bottleneck down the road when you have a full game relying on these core classes.

So now questions are:

  1. Is there a cost associated with a Matrix class inheriting from a Table class vs a Matrix class doing everything in the first place
  2. Is there a cost associated with having 3 instance of a Transform Object in a Node class vs exposing the underlying datatypes via member variables (I realize that in both cases, it is composition, just that in one case, there a wrapper for transformations while in the other case, the transformations are exposed directly. I guess the question can be rephrased to: Does a wrapper have a cost (considering it is an object that needs to be created and destroyed)?
  3. Let’s assume that I am writing an application where every calculation (even a simple Vector addition) counts. Would you change your choice?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:04:25+00:00Added an answer on May 22, 2026 at 10:04 pm

    Very good, complicated questions with many, many answers. I’ll try to address them as best I can, but at least in my opinion the overall answer is going to do more with what your needs are than what a single individual might do.

    1) There is always a cost to inheritance, though it is very minute. There really isn’t an easy answer to this question so I would probably read:
    http://www.hackcraft.net/cpp/templateInheritance/

    2) Anything that has to be created or destroyed has a cost. Generally wrapping things makes them “safer” for a large number of people on a project, but otherwise I don’t find it useful or worth it. Just like inheritance the cost of wrapping things is very small.

    3) If every calculation matters, than don’t wrap things if you don’t have to. And at least for simple math classes just use templates for ease of use instead of inheritance.

    Overall for basic data structures for matrices and vectors you aren’t going to kill your program if its on PC or a console with either approach. A slow memory manager and memory allocations will kill your game a lot more than inheriting for your vector and matrix classes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for feedback on : http://code.google.com/p/google-perftools/wiki/GooglePerformanceTools
Looking for an example that: Launches an EXE Waits for the EXE to finish.
Looking for a Linux application (or Firefox extension) that will allow me to scrape
Looking at posts like this and others, it seems that the correct way to
Looking on-line I saw that I can write most of the application in Ansi-C
Looking at several posts, I get a feel that many of the questions arise
Looking to pass variables from c# to javascript to use some jquery code. Passing
Looking for help with the following code... package pkgPeople; import java.io.File; import java.io.PrintWriter; import
Looking around SO user profiles and other sites, I have noticed that some high
Looking for a snippet of code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.