File:Texture smiley.png

Don't mind the mess!

We're currently in the process of migrating the Panda3D Manual to a new service. This is a temporary layout in the meantime.

Top
Python C++
Texture_smiley.png(400 × 300 pixels, file size: 30 KB, MIME type: image/png)

Illustration of (u, v) assignment to vertices

This image was generated with the following program:

from direct.directbase.DirectStart import *
from pandac.PandaModules import *
import math

base.setBackgroundColor(1, 1, 1, 1)

smiley = loader.loadModel('smiley.egg')
smiley.reparentTo(render)

dl = DirectionalLight('dl')
dlnp = base.camera.attachNewNode(dl)
smiley.setLight(dlnp)

def drawArrow(fromAngle, toAngle, numSteps = 100):
    arrow = NodePath('arrowRoot')
    ls = LineSegs('arc')
    ls.setColor(0.4, 0.5, 1, 1)

    for i in range(numSteps):
        t = float(i) / float(numSteps - 1)
        a = deg2Rad(fromAngle + (toAngle - fromAngle) * t)
        
        c = math.cos(a)
        s = math.sin(a)
        ls.drawTo(c, s, 0)

    arrow.attachNewNode(ls.create())

    ls = LineSegs('h2')
    ls.setColor(0.4, 0.5, 1, 1)
    ls.moveTo(-0.03, 0, -0.07)
    ls.drawTo(0, 0, 0)
    ls.drawTo(0.03, 0, -0.07)
    h1 = arrow.attachNewNode('h1')
    h2 = h1.attachNewNode(ls.create())
    h2.setBillboardAxis()
    h1.setPos(c, s, 0)
    h1.setHpr(toAngle - 180, 90, 0)
    
    return arrow

ua = drawArrow(0, 200)
ua.reparentTo(render)
ua.setScale(1.2)
ua.setHpr(90, 0, 0)

va = drawArrow(0, 180)
va.reparentTo(render)
va.setScale(1.2)
va.setHpr(270, 0, 90)

tn = TextNode('label')
tn.setTextColor(0.4, 0.5, 1, 1)
tn.setAlign(TextNode.ACenter)
tn.setSlant(0.2)
tn.setText('u')
tnpU = aspect2d.attachNewNode(tn.generate())
tnpU.setPos(-0.9, 0, -0.14)
tnpU.setScale(0.1)

tn.setText('v')
tnpV = aspect2d.attachNewNode(tn.generate())
tnpV.setPos(0.9, 0, -0.4)
tnpV.setScale(0.1)

base.disableMouse()
camera.setPos(1, -5, 1)
camera.setHpr(12, -10, 0)

base.graphicsEngine.renderFrame()
base.screenshot('texture_smiley.png', defaultFilename = 0)

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current14:25, 4 October 2005Thumbnail for version as of 14:25, 4 October 2005400 × 300 (30 KB)Drwr (Talk | contribs)Illustration of (u, v) assignment to vertices

The following page links to this file:

Top