ActionScript 3.0 :: Molehill : VertexBuffer3D's Vector From CopyPixels?

Mar 18, 2011

I am working on my own Molehill 2D painting classes. I took a look at Ely Greenfield's M2D stuff but I found it a tad overkill for what I am looking for. So I want to do my own. I have been working off of Polygonal's example. You can check out my code here - http:[url]..........Assume I want to paint one entity that is a rectangular bitmap image using two triangles (essentially a quad). Basically I am having a hard time understanding how to translate this:

Code:
bitmapData.copyPixels( sourceBitmapData, sourceRectangle, destinationPt.. );
to this (assuming I am using a x, y, u, v vector pairing):[code]...

Specifically if the source rectangle doesn't contain the same values of the sourceBitmapData.rect. What if I want to paint only a portion of a bitmap onto a quad? Or stretch a portion of the image across a quad.

View 1 Replies


Similar Posts:


Flash - Should A New VertexBuffer3D & IndexBuffer3D Be Created For Each Program3D Used

Jan 18, 2012

If I have a few Program3D objects (each with it's own Vertex-Shader and Fragment-Shader responsible for it's own rendering task), do I need to instantiate a new VertexBuffer3D and IndexBuffer3D so that they store the data only relevant to the vertex-data format used by their corresponding Program3D?

For example, if I was planning to define Quads in different vertex-data formats, such as:

var vertexData:Vector.<Number>;
//Vertex-Format A:
vertexData = new <Number>[

[code]....

Would I need to create one VertexBuffer3D and IndexBuffer3D to store format A, another one for format B, and yet another one for format C? Or can the various formats be mixed inside the same VertexBuffer3D and then make some clever (or confusing!) use of a single IndexBuffer3D to draw the triangles?

View 1 Replies

Flash :: Use VertexBuffer3D To Manipulate Objects In A Hierarchical Display Structure?

Dec 25, 2011

Scenario 1: Within some 3D container object, I would like to add two Cubes: one without any transformation, and one with small position, rotation and scale adjustments. After adding those two cubes, I would like to also transform the container's position, rotation and scale.

Scenario 2: In a 3D character's body, it consists of many hierarchical children (and subchildren), each having various transformations over the course of an animation.

How do I calculate these individual 3D object transformations efficiently? Can it even be possible to do this with only one VertexBuffer3D? Or do I need several VertexBuffer3D to keep track of each objects? Using multiple VertexBuffer3D seems like it could hit a limit (but I haven't read enough of the Stage3D / Context3D documentation to know for sure).

View 1 Replies

ActionScript 3.0 :: Flash 3D API (Molehill)

Mar 14, 2011

[URL]

1920x1080 @ 60fps == Really exciting stuff!

More sweet demos here:

[URL]

This is all runnig in the Flash Player and uses OpenGL on OS/X and Linux, and DirectX on Windows.

View 4 Replies

Flash :: Download Molehill API / Library?

Mar 22, 2011

Where can I download the Molehill API / library from and what else do I need to get it running?

View 2 Replies

Flash :: Backface Culling With Molehill

Oct 2, 2011

Using Flash 11 RC1 with the new Molehill API, I would like to enable backface culling. The beta documentation is pretty vague, but the example implies Molehill wants front-facing triangles to wind counter-clockwise, which is pretty normal. But when my polygons wind counter-clockwise, I get the exact opposite behavior - in other words, it's as if contrary to its own examples Molehill expects front-facing triangles to wind clockwise. Since the documentation never explicitly states which winding is correct, I am stumped.

I don't want to just flip all my triangles around until it looks right before I am 100% on what Molehill actually wants, since that has a fair chance of hiding a fundamental misunderstanding. I am using simple perspective projection (a note regarding .transpose() below: because copyRawDataFrom expects data in column-major order, and I hated the way that looked in code, I decided to just enter it row-major and transpose the matrix afterwards

[Code]....

View 1 Replies

Actionscript 3 :: Get Working Engine For Molehill 2D?

Nov 2, 2011

Where can I get working engine for Molehill 2D?I checked ND2D and M2D and none of them work on Flash Player 11.Not even the Demos.

View 2 Replies

ActionScript 3.0 :: Load A Molehill MovieClip With A Loader?

Mar 9, 2012

Flash has bacome a complete stranger to me since I last used it 11 years ago.[code]...

If that Main.swf is some "normal" swf I made, everything is ok. But when it is the Main.swf from here[url]...

View 8 Replies

Actionscript 3 :: Draw A Line With Adobe Molehill?

Mar 28, 2011

how can i draw a line with adobe molehill. If i was using opengl i would use GL_LINES, but i seems molehill can only draw triangles.

View 2 Replies

Flash :: Morphing In MoleHill Using A Vertex Shader?

Feb 5, 2012

Using the Molehill with Flash I wish to create a vertiex shader, to have one mesh transform into another, I have seen that it is possible with Flare, However I am unsure if that was using Stage3D, Can anyone give me any pointers in the use of shaders in AGAL as to how this might be done.

View 2 Replies

ActionScript 3.0 :: Vector Of A Superclass Hold A Reference To A Vector Of A Subclass?

Sep 13, 2011

I'm getting

ActionScript Code:
1067: Implicit coercion of a value of type
__AS3__.vec:Vector.ie.aro.floorplanviewer.model.buildingVOs:ConfigurationVO>[code]....

which surprises me as ConfigurationVO inherits from NodeVO.Is the compiler really not able to figure out that a Vector of a superclass should be able to hold a reference to a Vector of a subclass?

View 7 Replies

ActionScript 3.0 :: Write A Phong Shader For Molehill Project?

May 2, 2011

I've been struggling to write a Phong shader for my Molehill project. The problem is that the light seems to shift or move when the camera rotates. So I've been investigating what could possibly be wrong, by basically comparing my shader with the Phong shader written in GLSL. There's one thing I found that is kind of weird. In GLSL the output position in the vertex shader is ModelViewProjectionMatrix * Vertex, ok that is just fine.

HOWEVER, in Molehill the ModelViewProjectionMatrix has to be transposed so that it will render the vertex correctly to the screen. In GLSL that is not necessary.

How did I find that out? I created the Matrix3D modelViewProjection, I applied the ModelView to that matrix and then the Projection matrix. I tried to give the vertex shader that matrix and it displayed nothing until I transposed the modelViewProjection.

In GLSL this is not necessary, I could just say output.position = projection * modelview * vertex and it would be displayed correctly, I don't need to do transpose(projection * modelview * vertex).

So.. I'm wondering if there's something that I am not seeing here or is this a special part of Molehill that we just have to follow? Or could it be a bug in Molehill? I will create a new post tonight with my Phong shader and hope that someone sees what I may be doing wrong. But this is confusing me a lot at the moment and would like to know why the matrix has to be transposed.

View 1 Replies

Professional :: Import Photoshop Vector And/or Vector Styles?

May 7, 2010

I need to import a bunch of vector work from Photoshop into Flash. Is there a trick to it. So far, on import, it's converting the layer styles into black.

View 5 Replies

ActionScript 3.0 :: Vector Of Objects - Pass In A Vector To A Function?

Jul 23, 2011

If I want to pass in a vector to a function, a vector of any object specifed would it be someVetor:Vetor.<T>? beause FB 4.5 sais T is undefined.

View 10 Replies

Actionscript 3 :: Increase Vector Length To 200 After New Vector.<String>(100)?

Dec 24, 2010

Created Vector with the initial length of 100.

var v:Vector. = new Vector.(100);

v[90] = "Ninety"

v[190] ="oneninety" //RangeError: Error #1125: The index 110 is out of range 100.

//How to change the length from 100 to 200 to store a value at index 190

View 1 Replies

Actionscript 3 :: Vector Number Does Not Extend Vector

Nov 16, 2011

I am currently being confused by the Vector class.I wrote a beautiful XML to TypedClass parser. Works beautifully and without fault. UNTIL a co-worker noticed we got a Conversion Error for Vector.<Number> to Vector.<*>.

Every Vector I've ever tested all extend Vector.<*>.

Vector.<Sprite>, Vector.<String>, Vector.<Point>, Vector.<Boolean>, Vector.<TextField>, Vector.<CustomObject>, etc etc etc. ALL of them.
<type name="__AS3__.vec::Vector.<String>" base="__AS3__.vec::Vector.<*>" isDynamic="true" isFinal="false" isStatic="false">
<extendsClass type="__AS3__.vec::Vector.<*>"/>

[code]...

But then when I use describeType on Vector.<Number>, Vector.<uint> and Vector.<int>.

<type name="__AS3__.vec::Vector.<Number>" base="Object" isDynamic="true" isFinal="true" isStatic="false">
<extendsClass type="Object"/>
<constructor>

[code]....

Now I have accounted for these 3 vectors individually as even uint and int does not extend Vector.<Number> as I would have expected.
And my parsing function works for all types correctly again. But my confusion comes as to WHY this is the case, and why I couldn't find any documentation on the subject.

View 1 Replies

IDE :: Can't Get CopyPixels() To Work?

Sep 26, 2009

I did a function for blit scrolling successfully using Draw(), but then I heard that copyPixels is faster. Unfortunately, I'm not having the same success with that as I had with draw();

Specifically, no matter what I try to use for the source image, it keeps saying that it can't be coerced into a bitmapData object:

Code:

TypeError: Error #1034: Type Coercion failed: cannot convert SourceBitmap_bm$ to flash.display.BitmapData.

I tried referencing the bitmap in my Library (That's how I'd prefer to do it, copy from an item already sitting in my library) that has base class "flash.display.BitmapData", yet I get the error. I tried putting the bitmap into a movieclip and copying from that, same error. I tried copying from an offscreen instance of the mc (which worked fine with draw()), same error.

It's a mess by now because i've tried so many things, but this is my code:

[Code]...

I see are for copying pixels after loading in an external file. Does anyone know of an example that works with items already in library?

View 2 Replies

AS3 :: CopyPixels From A Huge BitmapData?

Sep 5, 2010

I need to load a very big image on AS3 (currently sized at 8192x8192). I am aware that it does not fit any of the limits imposed by Flash regarding drawing to screen or creating a BitmapData of that size. I just want to load the image so I can copyPixels() some parts of it here and there.The thing is, I'm loading the .jpg file of that size with no problems. The size is recognized correctly from my Loader object. I load it like this:[code]But I am greeted with the #2015 "Invalid BitmapData" error usually reserved for BitmapDatas that are too big. The error also happens if I try to do a copyPixels(), which is what I need to do.Is there any workaround I can use so I can get data from an image this big on AS3?

View 1 Replies

ActionScript 2.0 :: Using CopyPixels On A Isometric Map?

Aug 4, 2009

How would I go about using CopyPixels to build an isometric map? CopyPixels takes a specific rectangle and copies that onto a bitmap.. But how would one use that to build a seamless isometric map?Building a square top-down tiled map would be very simple as copypixels pastes each tile next to one another.. But for Isometric Maps, this would be different as some parts of the CopyPixels rectangle is over lapped into other tiles.. and this would 'erase' the bitmap of the other tiles currently on the bitmap..[URL]Fig2, is what happens when you try to do a copyPixel over an existing bitmap, assuming the white is transparent space.

View 0 Replies

ActionScript 3.0 :: CopyPixels Flip Or Rotate 90?

Nov 12, 2010

Traditionally, when blitting in old 2d games, flips and 90 degree rotations could be achieved with almost no performance hit. The reason for this is that the effect an be achieved by simply changing the order that pixels are copied.

I'm using copyPixels in Flash to get maximum performance. Is there any way to do a flip or 90 degree rotation using copyPixels? (Without pre-calculating and storing the flip/rotate). I couldn't find a way to do it, but it seems like it should be possible, because it is a very common technique in 2d games (well, not so much now that modern 2d games use 3d hardware acceleration... but Flash doesn't let us do that, so we need to use the traditional 2d techniques)

View 2 Replies

ActionScript 3.0 :: Memory Leak During CopyPixels?

Mar 1, 2012

I am making a custom renderer using the copyPixels function for my Haxe/Flash game. So I have this kind of code :

buffer.bitmapData.copyPixels(m_CurrentSkin, RECT3, POINT, null, null,true);

where :

-buffer is the bitmap where all my scene's objects are drawn

-m_CurrentSkinis the BitmapData that contains the current frame of the object to be drawn

Every time m_CurrentSkin contains a BitmapData that have never been drawn (the first time that an animation frame is drawn for example),I have a memory leak that is not garbage. However if m_CurrentSkin contains a BitmapData that have already been drawn (when the animation is played a second time for example), there isn't any memory leak.If I comment this line there is no leak so the problem comes from there.It seems that a copy of the BitmapData is cached in memory but I have checked in my code and there is no cacheAsBitmap explicitely set to true.

View 3 Replies

ActionScript 2.0 :: CopyPixels With Irregular Shape

Jan 19, 2009

Can anyone tell me if I can copyPixels with an irregular shape instead of just a rectangle?

View 0 Replies

ActionScript 2.0 :: Bitmap CopyPixels Not Copying?

Oct 1, 2009

I am playing around with an old Zelda: Link's Awakening tile set, and was trying to make an application that will display the current selected tile.

I am well versed in as2 but have never had need for the bitmap classes until now. I have found examples of the copyPixel() function that work but could not get it to work in my code.

I have attached the .fla file I saved it as a CS2 (Flash 8) file. (I use CS3 and/or CS4 depending on which computer that I am currently using. This one is in CS3)

ActionScript Code:
// -----
// ----- Author: Nathan Sepulveda
// ----- Date:   Oct 1, 2009

[Code]....

View 6 Replies

ActionScript 3.0 :: Rotating Bitmap Then Doing Copypixels?

May 8, 2011

I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer as follows:

ActionScript Code:
public override function copyToBackBuffer(db:BitmapData):void
{

[code]........

View 0 Replies

ActionScript 3.0 :: CopyPixels On MovieClip With Children?

Jun 14, 2009

I'm working on my second flash game and have been stopped in my tracks trying to cache MovieClip Animations into arrays of BitmapData frames. To capture the frames I have set up a loop which runs through the frames in the MovieClip and use copyPixels to get a snapshot of the graphic.This works fine if the MovieClip to cache does not contain any child MovieClips, but if it does, these MovieClips are frozen on their first frames. I've been looking at MovieClip.getChildAt(index) in attempt to navigate their time lines but because that returns a DisplayObject it seems impossible.

So, my question is: Is it possible it to use copyPixes on a MovieClip and also step through child time lines, or should I be using sprite sheets?

View 2 Replies

ActionScript 3.0 :: Flash CopyPixels For MovieClip?

Aug 4, 2011

I'm not much of a scripter. I get by editing scripts similar to my needs. I learned a few things about blitting and I'm trying to get a rectangle area of a MovieClip to blit to a location on the stage. But I run into the error "Invalid BitmapData" which makes sense because I'm referencing a MovieClip and not an image. Is there a different AS3 command other then copyPixels that would work for a MC?

I know VCam would seem an obvious solution, however VCam scales to fill the entire stage. I only want to fill a small rectangle on the stage. I've already attempted to edit VCam with no success. Its probably not the same principle, but would it be possible to blit the matrix VCam uses?

View 2 Replies

ActionScript 3.0 :: Use CopyPixels To Copy Part Of Stage?

Dec 3, 2009

Is it possible to use copyPixels to capture part of the stage directly into a bitmapData object?

Just wondering because in my situation using captureBitmapData.draw(stage, matrix); is causing performance problems, even without the matrix. I read that copyPixels is fast so I was wondering if there's a trick to use that directly on the stage without the draw part.

What I'm essentially doing is screen capturing a part of the stage and putting it in a a window, using a loop to update it over time since it contains animation. Works great in one of my FLAs, but chugs in the other so looking to optimize the code to a bare minimum.

View 1 Replies

Flash :: Set CopyPixels To Ignore Transparent Pixels?

Mar 17, 2011

I have a BitmapData object with transparency (the sourceBitmapData parameter). Every time I use copyPixels() to copy it onto another BitmapData object the transparent pixels replace whatever is beneath them. I would like the copyPixels() function to simply ignore these fully transparent pixels (0x00) and NOT copy themBTW, I've tried setting the alphaMerge to true but that doesn't solve the issue - the whole source object just goes black and ignores ALL transparency.EDIT:

Here are the code snippets;
var b:UIComponent = new UIComponent();
b.graphics.beginFill(color, opacity);

[code].....

View 3 Replies

ActionScript 3.0 :: CopyPixels And Alpha Channel Of An Image

Jan 21, 2010

I am having problems dealing with the alpha channel of an image. Basically I do this:

1. I load an image (.png) and keep it in a bitmap:...

[Code]...

View 4 Replies

ActionScript 3.0 :: Dynamic Coordinates For CopyPixels Rectangle

May 6, 2010

I believe this is esentially a math problem that may be easy for most of the programmers out there, but I am stuck. I have a fixed rectangle width = 50 height = 50 centered in the middle of the stage. I am using this rectangle to copyPixels of a bitmap that is also centered on the stage. The bitmap is draggable. I can define the initial x,y of the rectangle used for copyPixels with

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved