View Single Post
  #537  
Old 20th September 2009, 10:31 PM
cooliscool's Avatar
cooliscool cooliscool is offline
Dingpot
 
Join Date: Aug 2007
Location: SC, USA
Total Awards: 2
You're Appreciated! INFECTED - B1K1 
Nope, I handle both TRI1 (0xBF), and TRI2 (0xB1). If I didn't handle them both, most models would look incorrect. The files I was referring to completely lack any display list commands at all, nor a pointer to one. It's really odd. I theorize that since they seem to be very simple geometry, there's some sort of interpolation algorithm that builds a dlist on the fly.

Code:
    Private Sub TRI1()
                If Game = 0 Then
                    V1 = ((n64dlist(0).Commands(curCMD).CMDDword(5)) \ 2)
                    V2 = ((n64dlist(0).Commands(curCMD).CMDDword(6)) \ 2)
                    V3 = ((n64dlist(0).Commands(curCMD).CMDDword(7)) \ 2)
                Else
                    V1 = ((n64dlist(0).Commands(curCMD).CMDDword(1)) \ 2)
                    V2 = ((n64dlist(0).Commands(curCMD).CMDDword(2)) \ 2)
                    V3 = ((n64dlist(0).Commands(curCMD).CMDDword(3)) \ 2)
                End If
                If OBJMode Then
                    V1 += vtxbegin
                    V2 += vtxbegin
                    V3 += vtxbegin
                    With OBJData
                        .vt(V1) = "vt " & CSng(Vertices.u(V1) * TextureWRatio) & " " & -CSng(Vertices.v(V1) * TextureHRatio)
                        .vt(V2) = "vt " & CSng(Vertices.u(V2) * TextureWRatio) & " " & -CSng(Vertices.v(V2) * TextureHRatio)
                        .vt(V3) = "vt " & CSng(Vertices.u(V3) * TextureWRatio) & " " & -CSng(Vertices.v(V3) * TextureHRatio)
                    End With
                    V1 += 1
                    V2 += 1
                    V3 += 1
                    With OBJData
                        .g.Add("f " & V1 & "/" & _
                                          V1 & " " _
                                          & V2 & "/" & V2 & _
                                          " " & V3 & "/" & V3)
                    End With
                    Exit Sub
                End If

                If EnableLighting Or Not EnableCC Then
                    Gl.glBegin(Gl.GL_TRIANGLES)
                    Gl.glColor3f(1, 1, 1)
                    Gl.glNormal3f(VertCache.r(V1), VertCache.g(V1), VertCache.b(V1))
                    Gl.glTexCoord2f(VertCache.u(V1) * TextureWRatio, VertCache.v(V1) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V1), VertCache.y(V1), VertCache.z(V1))

                    Gl.glNormal3f(VertCache.r(V2), VertCache.g(V2), VertCache.b(V2))
                    Gl.glTexCoord2f(VertCache.u(V2) * TextureWRatio, VertCache.v(V2) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V2), VertCache.y(V2), VertCache.z(V2))

                    Gl.glNormal3f(VertCache.r(V3), VertCache.g(V3), VertCache.b(V3))
                    Gl.glTexCoord2f(VertCache.u(V3) * TextureWRatio, VertCache.v(V3) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V3), VertCache.y(V3), VertCache.z(V3))
                    Gl.glEnd()
                Else
                    Gl.glBegin(Gl.GL_TRIANGLES)
                    Gl.glColor4f(VertCache.r(V1), VertCache.g(V1), VertCache.b(V1), VertCache.a(V1))
                    Gl.glTexCoord2f(VertCache.u(V1) * TextureWRatio, VertCache.v(V1) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V1), VertCache.y(V1), VertCache.z(V1))

                    Gl.glColor4f(VertCache.r(V2), VertCache.g(V2), VertCache.b(V2), VertCache.a(V2))
                    Gl.glTexCoord2f(VertCache.u(V2) * TextureWRatio, VertCache.v(V2) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V2), VertCache.y(V2), VertCache.z(V2))

                    Gl.glColor4f(VertCache.r(V3), VertCache.g(V3), VertCache.b(V3), VertCache.a(V3))
                    Gl.glTexCoord2f(VertCache.u(V3) * TextureWRatio, VertCache.v(V3) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V3), VertCache.y(V3), VertCache.z(V3))
                    Gl.glEnd()
                End If
    End Sub


    Private Sub TRI2()
                V1 = (n64dlist(0).Commands(curCMD).CMDDword(1) \ 2)
                V2 = (n64dlist(0).Commands(curCMD).CMDDword(2) \ 2)
                V3 = (n64dlist(0).Commands(curCMD).CMDDword(3) \ 2)
                V4 = (n64dlist(0).Commands(curCMD).CMDDword(5) \ 2)
                V5 = (n64dlist(0).Commands(curCMD).CMDDword(6) \ 2)
                V6 = (n64dlist(0).Commands(curCMD).CMDDword(7) \ 2)
                If OBJMode Then
                    V1 += vtxbegin
                    V2 += vtxbegin
                    V3 += vtxbegin
                    V4 += vtxbegin
                    V5 += vtxbegin
                    V6 += vtxbegin
                    With OBJData
                        .vt(V1) = "vt " & CSng(Vertices.u(V1) * TextureWRatio) & " " & -CSng(Vertices.v(V1) * TextureHRatio)
                        .vt(V2) = "vt " & CSng(Vertices.u(V2) * TextureWRatio) & " " & -CSng(Vertices.v(V2) * TextureHRatio)
                        .vt(V3) = "vt " & CSng(Vertices.u(V3) * TextureWRatio) & " " & -CSng(Vertices.v(V3) * TextureHRatio)
                        .vt(V4) = "vt " & CSng(Vertices.u(V4) * TextureWRatio) & " " & -CSng(Vertices.v(V4) * TextureHRatio)
                        .vt(V5) = "vt " & CSng(Vertices.u(V5) * TextureWRatio) & " " & -CSng(Vertices.v(V5) * TextureHRatio)
                        .vt(V6) = "vt " & CSng(Vertices.u(V6) * TextureWRatio) & " " & -CSng(Vertices.v(V6) * TextureHRatio)
                    End With
                    V1 += 1
                    V2 += 1
                    V3 += 1
                    V4 += 1
                    V5 += 1
                    V6 += 1
                    With OBJData

                        .g.Add("f " & V1 & "/" & _
                                          V1 & " " _
                                          & V2 & "/" & V2 & _
                                          " " & V3 & "/" & V3)

                        .g.Add("f " & V4 & "/" & _
                                          V4 & " " _
                                          & V5 & "/" & V5 & _
                                          " " & V6 & "/" & V6)
                    End With
                    Exit Sub
                End If
                If EnableLighting Or Not EnableCC Then
                    Gl.glBegin(Gl.GL_TRIANGLES)

                    Gl.glColor3f(1, 1, 1)
                    Gl.glNormal3f(VertCache.r(V1), VertCache.g(V1), VertCache.b(V1))
                    Gl.glTexCoord2f(VertCache.u(V1) * TextureWRatio, VertCache.v(V1) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V1), VertCache.y(V1), VertCache.z(V1))

                    Gl.glNormal3f(VertCache.r(V2), VertCache.g(V2), VertCache.b(V2))
                    Gl.glTexCoord2f(VertCache.u(V2) * TextureWRatio, VertCache.v(V2) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V2), VertCache.y(V2), VertCache.z(V2))

                    Gl.glNormal3f(VertCache.r(V3), VertCache.g(V3), VertCache.b(V3))
                    Gl.glTexCoord2f(VertCache.u(V3) * TextureWRatio, VertCache.v(V3) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V3), VertCache.y(V3), VertCache.z(V3))

                    Gl.glNormal3f(VertCache.r(V4), VertCache.g(V4), VertCache.b(V4))
                    Gl.glTexCoord2f(VertCache.u(V4) * TextureWRatio, VertCache.v(V4) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V4), VertCache.y(V4), VertCache.z(V4))

                    Gl.glNormal3f(VertCache.r(V5), VertCache.g(V5), VertCache.b(V5))
                    Gl.glTexCoord2f(VertCache.u(V5) * TextureWRatio, VertCache.v(V5) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V5), VertCache.y(V5), VertCache.z(V5))

                    Gl.glNormal3f(VertCache.r(V6), VertCache.g(V6), VertCache.b(V6))
                    Gl.glTexCoord2f(VertCache.u(V6) * TextureWRatio, VertCache.v(V6) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V6), VertCache.y(V6), VertCache.z(V6))

                    Gl.glEnd()
                Else
                    Gl.glBegin(Gl.GL_TRIANGLES)

                    Gl.glColor4f(VertCache.r(V1), VertCache.g(V1), VertCache.b(V1), VertCache.a(V1))
                    Gl.glTexCoord2f(VertCache.u(V1) * TextureWRatio, VertCache.v(V1) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V1), VertCache.y(V1), VertCache.z(V1))

                    Gl.glColor4f(VertCache.r(V2), VertCache.g(V2), VertCache.b(V2), VertCache.a(V2))
                    Gl.glTexCoord2f(VertCache.u(V2) * TextureWRatio, VertCache.v(V2) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V2), VertCache.y(V2), VertCache.z(V2))

                    Gl.glColor4f(VertCache.r(V3), VertCache.g(V3), VertCache.b(V3), VertCache.a(V3))
                    Gl.glTexCoord2f(VertCache.u(V3) * TextureWRatio, VertCache.v(V3) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V3), VertCache.y(V3), VertCache.z(V3))

                    Gl.glColor4f(VertCache.r(V4), VertCache.g(V4), VertCache.b(V4), VertCache.a(V4))
                    Gl.glTexCoord2f(VertCache.u(V4) * TextureWRatio, VertCache.v(V4) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V4), VertCache.y(V4), VertCache.z(V4))

                    Gl.glColor4f(VertCache.r(V5), VertCache.g(V5), VertCache.b(V5), VertCache.a(V5))
                    Gl.glTexCoord2f(VertCache.u(V5) * TextureWRatio, VertCache.v(V5) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V5), VertCache.y(V5), VertCache.z(V5))

                    Gl.glColor4f(VertCache.r(V6), VertCache.g(V6), VertCache.b(V6), VertCache.a(V6))
                    Gl.glTexCoord2f(VertCache.u(V6) * TextureWRatio, VertCache.v(V6) * TextureHRatio)
                    Gl.glVertex3f(VertCache.x(V6), VertCache.y(V6), VertCache.z(V6))

                    Gl.glEnd()
                End If
    End Sub

Last edited by cooliscool; 20th September 2009 at 10:42 PM.
Reply With Quote