Author Topic: Tiny 1k grail  (Read 17774 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Tiny 1k grail
« Reply #40 on: November 12, 2006 »
That looks really nifty Rbraz :) All it needs is a nice marbled texture and you'll be on your way to building some Greek architecture.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Tiny 1k grail
« Reply #41 on: November 13, 2006 »
Thx Shockie!


Quote
Thats really spooky to see that exact pillar (the one I was using to debug) being duplicated!

I'm just following the tutorial  :)
Code: [Select]
;Define Pillar = six points
;         ----1---  ----2---  ----3---  ---4----  ---5----  ---6---- 
pillar dd 0.0, 0.0, 3.0, 0.0, 2.0, 1.0, 1.0, 7.0, 3.0, 8.0, 0.0, 8.0

Btw, I have corrected the method to draw the object, I was using a vertex array (big code), now I just compute points and draw the triangle strip.

@Taj:  I didn't have any luck with interpolator code until now, and I'm wondering if could explain it with psedo code again, plz  ? :)


Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny 1k grail
« Reply #42 on: November 13, 2006 »
OK the curved interpolation...

Assuming you know the following how to smoothly go around the object and generate triangle strips I think the only question is how to get a curve between the (x,y) coordinates right?

I personally split the code into two routines:
a) a double loop from 0..360 degrees (up and around), steps passed into the routine
b) a routine that takes a model, an up and an around and emits the vertex using opengl calls.

So routine a) looks like:
Code: [Select]
    up=0
    do {                       
       around =0
       glBegin(GL_TRIANGLE_STRIP)
   do {                                            // must go all the way to 360 degrees
              sorPoint (modelpointer, around, up)             // lower point of pair
              sorPoint (modelpointer, around, up+vang)    // upper point of pair
              around+=hang;
   } while (around<=360)                                     
glEnd()
up+=vang
    } while (up<360)                                               // note less than...

here is the ciritcal part of the sorPoint, routine b:
Code: [Select]
   ...
    t = up/360 * numverticesinmodel -1    //get a t value smoothly between 0.0..numvert-1
    lowerindex = floor(t)                          //This is the index of the vertex below t position
    upperindex = roof (t)                        // and above t position
    interpval = fractionalpart(t)                // we need to interpolate using a number between 0..1
    vertexy = linearinterpolate (vertex[lowerindex].y, vertex[upperindex].y, interpval)
    vertexx = [b]linearinterpolate[/b] (vertex[lowerindex].y, vertex[upperindex].y, [b]interpval*interpval[/b])
    ...generate s too (vertexx is the radius, so you know how to do this bit
   ...glVertex,normal,texture calls



sore point :-) get it :-). OK well no guarantees on that exact pseudo-code but it should help you...
Yes I do know it does a lot of unnecessary calculation, but my version is very very small in the 1k. Also I'm not certain this is the minimum code way. All those floor, roof etc I have written in as few bytes as possible (obviously not using the actual floor function) but its still costly. There are other ways to write this which might be 20-30 bytes less.

Good luck
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Tiny 1k grail
« Reply #43 on: November 13, 2006 »
Yeah, I got it working  :||

Oh well, my cosine interpolator was broken and I forgot to add the linear interpolate for xz  :whack:
Without any optimization, the code to produce this object is 317 bytes packed, so, there's a lot of work to do to make it smaller, but I'm glad with what I have :)

@Taj: The method that I have used is (a little bit) different that you did, and when I got the C version running I'll PM you, just to take a look, maybe there's something useful for you...

Many thanks for this wonderful tutorial  O0

++Karma!
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny 1k grail
« Reply #44 on: November 13, 2006 »
The .com doesnt run here :-(...do you have an unpacked safe version?
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny 1k grail
« Reply #45 on: November 13, 2006 »

@Taj: The method that I have used is (a little bit) different that you did, and when I got the C version running I'll PM you, just to take a look, maybe there's something useful for you...


I was hoping you would say that :-)
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Tiny 1k grail
« Reply #46 on: November 14, 2006 »

@Taj: The method that I have used is (a little bit) different that you did, and when I got the C version running I'll PM you, just to take a look, maybe there's something useful for you...


I was hoping you would say that :-)

I'm still hoping :-)
Challenge Trophies Won: