<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hey Olee,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>No, and I am guessing it would slow it down
drastically, especially as my texture is already 1000x3000px</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I would ideally like to be able to map several
images around the cylinder.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I actually found a workaround which involves
creating a partial cylinder instead of a full cylinder, it works for what I need
it for.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here's the modified Cylinder.as class which now
accepts an angle between 0 and 1 to create a cylinder segment:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>package org.papervision3d.objects.primitives
{<BR> import org.papervision3d.Papervision3D;<BR> import
org.papervision3d.core.geom.*;<BR> import
org.papervision3d.core.geom.renderables.Triangle3D;<BR> import
org.papervision3d.core.geom.renderables.Vertex3D;<BR> import
org.papervision3d.core.math.NumberUV;<BR> import
org.papervision3d.core.proto.*; </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> /**<BR> * The Cylinder class lets you
create and display Cylinders.<BR> * <p/><BR> * The Cylinder is
divided in vertical and horizontal segment, the smallest combination is two
vertical and three horizontal segments.<BR> */<BR> public class
Cylinder extends TriangleMesh3D<BR> {<BR> /**<BR> *
Number of segments horizontally. Defaults to
8.<BR> */<BR> public var segmentsW
:Number;<BR> <BR> /**<BR> * Number of segments
vertically. Defaults to 6.<BR> */<BR> public var segmentsH
:Number;<BR> <BR> /**<BR> * Default radius of
Cylinder if not defined.<BR> */<BR> static public const
DEFAULT_RADIUS :Number = 100;<BR> <BR> /**<BR> *
Default height if not defined.<BR> */<BR> static public
const DEFAULT_HEIGHT :Number =
100;<BR> <BR> /**<BR> * Default scale of Cylinder
texture if not defined.<BR> */<BR> static public const
DEFAULT_SCALE :Number = 1;<BR> <BR> /**<BR> * Default
value of gridX if not defined.<BR> */<BR> static public
const DEFAULT_SEGMENTSW :Number =
8;<BR> <BR> /**<BR> * Default value of gridY if not
defined.<BR> */<BR> static public const DEFAULT_SEGMENTSH
:Number = 6;<BR> <BR> /**<BR> * Minimum value of
gridX.<BR> */<BR> static public const MIN_SEGMENTSW
:Number = 3;<BR> <BR> /**<BR> * Minimum value of
gridY.<BR> */<BR> static public const MIN_SEGMENTSH
:Number = 1;<BR> <BR> <BR> //
___________________________________________________________________________________________________<BR> //
N E W<BR> // NN NN EEEEEE WW
WW<BR> // NNN NN EE WW WW
WW<BR> // NNNNNN EEEE WWWWWWWW<BR> // NN NNN
EE WWW WWW<BR> // NN NN EEEEEE
WW WW<BR> <BR> /**<BR> * Create a
new Cylinder object.<BR> * <p/><BR> *
@param material A MaterialObject3D object that contains the material
properties of the object.<BR> * <p/><BR> *
@param radius [optional] - Desired radius.<BR> *
<p/><BR> * @param segmentsW [optional] - Number of
segments horizontally. Defaults to 8.<BR> *
<p/><BR> * @param segmentsH [optional] - Number of
segments vertically. Defaults to 6.<BR> * <p/><BR> *
@param topRadius [optional] - An optional parameter for con- or
diverging cylinders.<BR> * <p/><BR> *
@param topFace [optional] - An optional parameter specifying if
the top face of the cylinder should be drawn.<BR> *
<p/><BR> * @param bottomFace [optional] - An optional
parameter specifying if the bottom face of the cylinder should be
drawn.<BR> * <p/><BR> */<BR> public
function Cylinder( material:MaterialObject3D=null, angle : Number = 0.25,
radius:Number=100, height:Number=100, segmentsW:int=8, segmentsH:int=6,
topRadius:Number=-1, topFace:Boolean=true, bottomFace:Boolean=true
)<BR> {<BR> super( material, new Array(), new
Array(), null );<BR> <BR> this.segmentsW = Math.max(
MIN_SEGMENTSW, segmentsW || DEFAULT_SEGMENTSW); // Defaults to
8<BR> this.segmentsH = Math.max( MIN_SEGMENTSH, segmentsH ||
DEFAULT_SEGMENTSH); // Defaults to 6<BR> if (radius==0) radius
= DEFAULT_RADIUS; // Defaults to 100<BR> if (height==0) height
= DEFAULT_HEIGHT; // Defaults to 100<BR> if (topRadius==-1)
topRadius = radius;<BR> <BR> var scale :Number =
DEFAULT_SCALE;<BR> <BR> angle = angle > 1 ?
1 : angle < 0 ? 0 :
angle;<BR> <BR> buildCylinder(angle, radius, height,
topRadius, topFace, bottomFace
);<BR> }<BR> <BR> private function buildCylinder(
fAngle : Number, fRadius:Number, fHeight:Number, fTopRadius:Number,
fTopFace:Boolean, fBottomFace:Boolean
):void<BR> {<BR> var matInstance:MaterialObject3D =
material;<BR> <BR> var i:Number, j:Number,
k:Number;<BR> <BR> var iHor:Number =
Math.max(MIN_SEGMENTSW, this.segmentsW);<BR> var iVer:Number =
Math.max(MIN_SEGMENTSH, this.segmentsH);<BR> var aVertice:Array
= this.geometry.vertices;<BR> var aFace:Array =
this.geometry.faces;<BR> var aVtc:Array = new
Array();<BR> for (j=0;j<(iVer+1);j++) { //
vertical<BR> var fRad1:Number =
Number(j/iVer);<BR> var fZ:Number =
fHeight*(j/(iVer+0))-fHeight/2;//-fRadius*Math.cos(fRad1*Math.PI);<BR> var
fRds:Number =
fTopRadius+(fRadius-fTopRadius)*(1-j/(iVer));//*Math.sin(fRad1*Math.PI);<BR> var
aRow:Array = new Array();<BR> var
oVtx:Vertex3D;<BR> for (i=0;i<iHor;i++) { //
horizontal<BR> var fRad2:Number =
Number(2*i/iHor);<BR> var fX:Number =
fRds*Math.sin(fRad2*Math.PI * fAngle);<BR> var
fY:Number = fRds*Math.cos(fRad2*Math.PI *
fAngle);<BR> //if
(!((j==0||j==iVer)&&i>0)) { // top||bottom = 1
vertex<BR> oVtx = new
Vertex3D(fY,fZ,fX);<BR> aVertice.push(oVtx);<BR> //}<BR> aRow.push(oVtx);<BR> }<BR> oVtx
= new Vertex3D(0, fZ,
0);<BR> aVertice.push(oVtx);<BR> aRow.push(oVtx);<BR> <BR> aVtc.push(aRow);<BR> }<BR> var
iVerNum:int = aVtc.length;<BR> <BR> var aP4uv:NumberUV,
aP1uv:NumberUV, aP2uv:NumberUV, aP3uv:NumberUV;<BR> var
aP1:Vertex3D, aP2:Vertex3D, aP3:Vertex3D,
aP4:Vertex3D;<BR> <BR> for (j=0;j<iVerNum;j++)
{<BR> var iHorNum:int =
aVtc[j].length;<BR> for (i=0;i<iHorNum;i++)
{<BR> if (j>0&&i>=0)
{<BR> // select
vertices<BR> var bEnd:Boolean =
i==(iHorNum-0);<BR> aP1 =
aVtc[j][bEnd?0:i];<BR> aP2 =
aVtc[j][(i==0?iHorNum:i)-1];<BR> aP3 =
aVtc[j-1][(i==0?iHorNum:i)-1];<BR> aP4 =
aVtc[j-1][bEnd?0:i];<BR> //
uv<BR> var fJ0:Number = j /
iVerNum;<BR> var fJ1:Number = (j-1) /
iVerNum;<BR> var fI0:Number = (i+1) /
iHorNum;<BR> var fI1:Number = i /
iHorNum;<BR> aP4uv = new
NumberUV(fI0,fJ1);<BR> aP1uv = new
NumberUV(fI0,fJ0);<BR> aP2uv = new
NumberUV(fI1,fJ0);<BR> aP3uv = new
NumberUV(fI1,fJ1);<BR> // 2
faces<BR> aFace.push( new Triangle3D(this,
[aP1,aP2,aP3], matInstance, [aP1uv,aP2uv,aP3uv])
);<BR> aFace.push( new Triangle3D(this,
[aP1,aP3,aP4], matInstance, [aP1uv,aP3uv,aP4uv])
);<BR> }<BR> }<BR> if
(j==0||j==(iVerNum-1)) {<BR> for
(i=0;i<(iHorNum-2);i++) {<BR> //
uv<BR> var iI:int =
Math.floor(i/2);<BR> aP1 =
aVtc[j][iI];<BR> aP2 = (i%2==0)?
(aVtc[j][iHorNum-2-iI]) :
(aVtc[j][iI+1]);<BR> aP3 = (i%2==0)?
(aVtc[j][iHorNum-1-iI]) :
(aVtc[j][iHorNum-2-iI]);<BR> <BR> var
bTop:Boolean = j==0;<BR> aP1uv = new
NumberUV( (bTop?1:0)+(bTop?-1:1)*(aP1.x/fRadius/2+.5), aP1.z/fRadius/2+.5
);<BR> aP2uv = new NumberUV(
(bTop?1:0)+(bTop?-1:1)*(aP2.x/fRadius/2+.5), aP2.z/fRadius/2+.5
);<BR> aP3uv = new NumberUV(
(bTop?1:0)+(bTop?-1:1)*(aP3.x/fRadius/2+.5), aP3.z/fRadius/2+.5
);<BR> <BR> //
face<BR> if (j == 0)
{<BR> if (fBottomFace) aFace.push( new
Triangle3D(this, [aP1, aP3, aP2], matInstance, [aP1uv, aP3uv, aP2uv])
);<BR> }<BR> else
{<BR> if (fTopFace) aFace.push( new
Triangle3D(this, [aP1, aP2, aP3], matInstance, [aP1uv, aP2uv, aP3uv])
);<BR> }<BR> }<BR> }<BR> }<BR> this.geometry.ready
=
true;<BR> <BR> if(Papervision3D.useRIGHTHANDED)<BR> this.geometry.flipFaces();<BR> }<BR> }<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>Regards,</DIV>
<DIV> </DIV>
<DIV>Dan Carter</DIV>
<DIV> </DIV>
<DIV>MonoByte Web Development<BR>------------------------------<BR>t:
07792 635287<BR>e: <A
href="mailto:dan@monobyte.co.uk">dan@monobyte.co.uk</A></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=renkster@gmail.com href="mailto:renkster@gmail.com">o renken</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=papervision3d@osflash.org
href="mailto:papervision3d@osflash.org">papervision3d@osflash.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, September 01, 2008 2:52
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Papervision3D] Partial
cylinder mapping</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>Hey Dan,<BR><BR>did you try to work with a transparent PNG?
<BR><BR>olee<BR><BR>
<DIV class=gmail_quote>2008/9/1 Dan Carter <SPAN dir=ltr><<A
href="mailto:dan@monobyte.co.uk">dan@monobyte.co.uk</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can anyone help me, I am a bit stuck on this
one.</FONT></DIV>
<DIV><FONT face=Arial size=2>I have a panoramic image that I am trying to
map to part a Cylinder primitive, but I can only work out how to have it
wrap around the whole cylinder.</FONT></DIV>
<DIV><FONT face=Arial size=2>Does anyone know how to make the
image mapping go from say 30% to say 70% of the cylinder?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help very greatly
appreciated!!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Dan Carter</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>MonoByte Web
Development<BR>------------------------------<BR>t: 07792 635287<BR>e:
<A>dan@monobyte.co.uk</A></FONT></DIV></FONT></DIV></DIV><BR>_______________________________________________<BR>Papervision3D
mailing list<BR><A
href="mailto:Papervision3D@osflash.org">Papervision3D@osflash.org</A><BR><A
href="http://osflash.org/mailman/listinfo/papervision3d_osflash.org"
target=_blank>http://osflash.org/mailman/listinfo/papervision3d_osflash.org</A><BR><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR><A
href="http://www.renkster.de/">http://www.renkster.de/</A><BR></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Papervision3D
mailing
list<BR>Papervision3D@osflash.org<BR>http://osflash.org/mailman/listinfo/papervision3d_osflash.org<BR>
<P>
<HR>
<P></P>No virus found in this incoming message.<BR>Checked by AVG.
<BR>Version: 7.5.526 / Virus Database: 270.6.14/1644 - Release Date:
31/08/2008 16:59<BR></BLOCKQUOTE></BODY></HTML>