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 5 of 5

Thread: HL BSP texcoords

  1. #1
    Junior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    Sofia,None,Bulgaria
    Posts
    107

    HL BSP texcoords

    Well i've noticed that some of you have done Half-Life BSP loading so can someone please tell me how to calculate them.The deal is this:

    each tex_info has this little thingy:

    float vecs[2][4];

    and i should use this to calculate the texture coords for the current vertex.Can anybody tell me how exactly to do this???

    10x a lot!
    The pain is coming...THIS SUMMER!

  2. #2
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: HL BSP texcoords

    vecs[0] and vecs[1] are two vectors defining a base + 2 offsets. Just take the dot product of the vertex position and each vecs, adding the proper offset, to get the texture coordinates:

    u = x*vecs[0][0] + y*vecs[0][1] + z*vecs[0][2] + vecs[0][3];
    v = x*vecs[1][0] + y*vecs[1][1] + z*vecs[1][2] + vecs[1][3];

  3. #3
    Junior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    Sofia,None,Bulgaria
    Posts
    107

    Re: HL BSP texcoords

    Hey,10x!!!I also found a that i must divide the texcoords by the the width and height of the used image.
    The pain is coming...THIS SUMMER!

  4. #4
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    345

    Re: HL BSP texcoords

    Of course, as OpenGL tex coords are in the range [0;1], whereas quake/halflife coords are in the range [0;texsize]

  5. #5
    Junior Member Regular Contributor
    Join Date
    Nov 2002
    Location
    Sofia,None,Bulgaria
    Posts
    107

    Re: HL BSP texcoords

    Ok!You seem to know a lot about the BSP stuff.Can you tell me your mail so we can discuss a lot of things without pissing the moderators because of the multiply HL BSP posts!
    The pain is coming...THIS SUMMER!

Posting Permissions

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