Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 15

Thread: [something fun] vector class, what do I need??

Hybrid View

  1. #1
    Junior Member Newbie Tcll5850's Avatar
    Join Date
    Feb 2014
    Posts
    20

    [something fun] vector class, what do I need??

    so this is a little thing I'm doing for a rebuild of a project in the Python27 language.
    I'm worried more about quality than performance.

    so what I'm trying to do is design a vector class for 1D to 4D vectors and quaternions,
    and have the class be able to easily convert between their representative values.
    NOTE: this is a single class, not multiple classes for each vector type

    the class supports 4D:
    vertices - [X,Y,Z,W] (or quaternions)
    normals - [I,J,K,H]
    texCoords - [S,T,R,Q] (where Q is used for the 3D texCoord angle (sent to GL as [S,T,Q]))
    colors - [R,G,B,A]

    what and all do I to perform the proper conversions??
    _________________________________________________

    also...
    I've tried looking a few times, with no luck other than what I know above, excluding how [S,T,R] can also be [U,V,W].
    (but [U,V,W] can also be curve-surface representation)

    what exactly do vector letters stand for and what do they mean??
    I'm tired of finding bits and pieces of their meanings... google sucks >.<
    (we need a wiki on this or something)

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    I do not know what you are asking. If you are asking how to create this class in Python you best ask on a Python forum

  3. #3
    Junior Member Newbie Tcll5850's Avatar
    Join Date
    Feb 2014
    Posts
    20
    oh I was only trying to hint at the code needing to be in python...

    I know nothing about proper vector methods, and I want to build a single vector class that can hold any type of 1D to 4D data and convert the properly.
    (such as converting a 4D quaternion to a 2D vertex)

    also note:
    I use the term "Vertex" standing for an XYZW position.
    where "FacePoint" is the combined weights,vert,normal,colors,UV's,NBTs,etc...

    anyways... what I'm asking is...
    what do I need to put into a class like this??
    and how would I go about building the methods??

    I'm currently trying to follow about 6 high-end to mid-end game-engine src's from engines such as CryEngine3 to Unity...
    I'm asking here because there's an quite overwhelming amount of src to look at,
    and it could take quite alot longer to figure out than from asking experienced developers.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    First you have to ask yourself do I really need to do this when there are a lot of vector libraries out there like glm and the functions they have tend to cover what your need in practice.

    But if you think you want to write one then start small. Have a base class with some basic function then add more as you have needs.

    Libraries are best developed with a purpose in mind, ie, you have a need so you write it rather that writing it and trying to find where to use it.

  5. #5
    Junior Member Newbie Tcll5850's Avatar
    Join Date
    Feb 2014
    Posts
    20
    ok... the need is for an interface for converting data...
    and yes I do need to write it because it converts data types.

    for example, you store a vector as a bs24 (3-byte signed int) and want to convert it to a bf(5) (5-byte float)
    my data interface is already fully capable of this.

    I'm not mentioning the needs... I'm supporting future development...
    but now I need to know all of the things applied between vectors and quaternions to convert them appropriately.
    (this is for the scripting interface which handles the model data you're converting)
    ^ say... *.MDL0 >>> *.BLEND --- *.BLEND >>> *.DAT
    (Wii >>> Blender24 --- Blender26 >>> GCN)

    I basically need to convert between all vector types here, and need an interface that can do it.

    I WILL however take a look into a python translation of your GLM recommendation.
    thanks.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    ^ say... *.MDL0 >>> *.BLEND --- *.BLEND >>> *.DAT

    This is data conversion. It is not really relevant to this forum.
    know all of the things applied between vectors and quaternions

    vectors and quaternions aren't directly related; one is a direction and length, the other is a method of storing a rotation around an axis. (among other uses)
    I basically need to convert between all vector types

    How long is a piece of string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •