• Welcome to Dark Bit Factory & Gravity.
 

Tiny 1k grail

Started by taj, November 03, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Shockwave

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:

Rbz

Thx Shockie!


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

I'm just following the tutorial  :)
;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:

taj

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:

    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:

   ...
    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:

Rbz

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:

taj

The .com doesnt run here :-(...do you have an unpacked safe version?
Challenge Trophies Won:

taj

Quote from: Rbraz 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:

taj

Quote from: taj on November 13, 2006
Quote from: Rbraz 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 :-)

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