0

How rotation camera3d and viewer3d worked in Away3d

Posted by admin on Feb 7, 2010 in Flash, Programming

Rotation in Away3D Flash engine

In this blog entry we are going to learn about How the Rotation and camera3d and viewer3d in away3d flash engine.

Red line = x-axis

Blue line = y-axis

Green Line = z-axis

How Rotation works ..?

Rotation in away3d based on the three axis . Those are x.y and z.  the component is rotated take any one of this axis as a center then rotated. In my last post the sphere is rotated along with x axis. In that example the axis is like that (see below )


sphere.rotationX = sphere.x + 1;

The sphere takes x axis as a center and rotate like above…

In this example we add two or more components in the ObjectContainer3D then rotate this objects. In this example we are going to learn about how camera3D and Viewer3D works.

How Camera3D works ..?

Camera3d = real camera

view3d = lens the viewr of the camara

renderer = recording in real cam

scen3d = what we seen

This diagram explained in Papervision3d Essential book.. In this diagram your clearly understood about camera3d.

If we assume Camera 3d is like a real camera . we assume it is with in our application in invisible mode.

The viewerport (view3d) is an lens or what you are view using the camera.

The render engine is recording engine in the real camera. In the real camera If  we start the record then only we can see the changes otherwise not. Like same as in camera3d we called

viewer.render()

method each time if anything changed in the components. In the real camara If any person is not inside the seen they are not come in the flim. Same as in the scene3d if we not add add any components in the scene 3d objects  it is not visible.

How Viewer3D Works ..?

Download the source code click here (compatible for Flashdevelop IDE)

Tags: ,

 
1

My first 3D flash animation

Posted by admin on Feb 4, 2010 in Flash, Programming

3D Animathion

Adobe support for native 3D only in cs4. There are lot of opensource flash 3d engines are there. I tried papervision3d and away3d. Both are quite well. There are lot more tutorials for both online for away3d tutorials  click here , for papervision3d download this book . I got the source code of away3d from the google code http://code.google.com/p/away3d/ and for papervison3d svn http://code.google.com/p/papervision3d/. I generate swc using the command. The red5 says about away3d.

D:\sdk\Away3D>compc -include-sources ./src -source-path ./src -target-player 10 -output Away3d.swc

Initially i got this error when compile away3d “Error: Type was not found or was not a compile-time constant: Vector. in away3d”

Then i added the -target-player 10 in command line is fix that error. I think away3d is better than papervision3d.Here is my first animation here

Iam using away3d here…

If not shown http://sites.google.com/site/arulraj1985/list-of-files/away3d.swf

package
{
	import away3d.cameras.Camera3D;
	import away3d.cameras.HoverCamera3D;
	import away3d.cameras.TargetCamera3D;
	import away3d.containers.ObjectContainer3D;
	import away3d.containers.Scene3D;
	import away3d.containers.View3D;
	import away3d.core.math.Number3D;
	import away3d.materials.BitmapMaterial;
	import away3d.materials.WireColorMaterial;
	import away3d.primitives.Cube;
	import away3d.core.render.Renderer;
	import away3d.primitives.Sphere;
	import away3d.primitives.WireSphere;
	import away3d.core.utils.Cast;
	import away3d.core.utils.CastError;
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	/**
	 * ...
	 * @author Arul
	 */
	public class FirstApplication extends Sprite
	{
		public var viewer:View3D;
		public var scene:Scene3D;
		public var camera:Camera3D;
		public var cube:Cube;
		public var sphere:Sphere;
		public var wiresphere:WireSphere;
		public var group:ObjectContainer3D;
		public var material:WireColorMaterial;
		public var bitmapMaterial:BitmapMaterial;

		[Embed(source = "assets/favicon.jpg")] private var favicon:Class;
		public var image:Bitmap = new favicon();

		[SWF(backgroundColor="#EEE8DA")]

		public function FirstApplication()
		{
			init3D();
		}

		public function init3D():void {
			stage.frameRate = 30;
			camera = new Camera3D({y:400,z:-1000});
			viewer = new View3D({camera:camera,x:250,y:100,z:100});
			scene = new Scene3D();
			cube = new Cube();
			sphere = new Sphere();
			wiresphere = new WireSphere();
			group = new ObjectContainer3D();
			material = new WireColorMaterial();
			bitmapMaterial = new BitmapMaterial(Cast.bitmap(image));

			material.color = 0xA6111D;

			sphere.x = 100;
			sphere.y = 50;
			sphere.z = 100;
			sphere.radius = 75;
			sphere.bothsides = true;
			sphere.material = material;
			group.addChild(sphere);

			wiresphere.x = 270;
			wiresphere.y = 150;
			wiresphere.z = 150;
			wiresphere.radius = 75;
			wiresphere.bothsides = true;
			wiresphere.material = material;
			group.addChild(wiresphere);

			cube.x = 250;
			cube.y = 250;
			cube.z = 400;
			cube.material = bitmapMaterial;
			group.addChild(cube);

			viewer.scene.addChild(group);
			viewer.render();

			addChild(viewer);

			addEventListener(Event.ENTER_FRAME, groupRotation);
			group.addEventListener(Event.ENTER_FRAME, sphereRotation);
			//addEventListener(MouseEvent.MOUSE_DOWN, lookThere);
		}

		public function groupRotation(e:Event):void {
			group.rotationX = group.x + 1;
			group.applyRotations();

			viewer.render();
		}

		public function sphereRotation(e:Event):void {
			sphere.rotationX = sphere.x + 1;
			sphere.applyRotations();

			wiresphere.rotationZ = wiresphere.z + 1;
			wiresphere.applyRotations();
			viewer.render();
		}

		public function lookThere(e:MouseEvent):void {
			var clickpoint:Point = new Point(e.stageX, e.stageY);
			var hypothines:Number = Point.distance(new Point(0, 0), clickpoint);
			var sine:Number = Math.asin(e.stageX/hypothines);
			var cos:Number = Math.acos(e.stageY/hypothines);
			camera.lookAt(new Number3D(e.stageX, e.stageY, hypothines));
			/**
			 * Horizontal angle
			 */
			camera.pan(cos);
			/**
			 * vertical angle
			 */
			camera.tilt(sine);
			viewer.render();
		}

	}

}

Tags: , ,

 
0

How to install mplayer on fedora ..?

Posted by admin on Jan 19, 2010 in Linux

How to install mplayer on fedora

http://www.haifux.org/lectures/134/lecture/images/mplayer.png

When i try to install mplayer-1.0-0.102.20080903svn.fc10.src.rpm in fedora i got this error. i download this file from rpmfusion

[root@localhost Media]# rpm -ivh mplayer-1.0-0.102.20080903svn.fc10.src.rpm
warning: mplayer-1.0-0.102.20080903svn.fc10.src.rpm: Header V3 DSA signature: NOKEY, key ID 49c8885a
1:mplayer                warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
########################################### [100%]

I have the same problem when i try to install wine-1.0.1-1.el4.i386.rpm

I have not internet connection in my home pc. so what to do..?
i goes to “/usr/src/redhat/SOURCES” folder there is a file called mplayer-export-2008-09-03.tar.bz2
Extract the file and configure it then make and make install.
Now i have mplayer in my home pc

[root@localhost Movies]# mplayer 2012.avi
MPlayer dev-SVN-r27514 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 3.00GHz (Family: 15, Model: 4, Stepping: 3)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2

Playing 2012.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: ODML: Building ODML index (2 superindexchunks).
VIDEO:  [XVID]  608x272  12bpp  29.970 fps  674.6 kbps (82.4 kbyte/s)

when i play the avi file using mplayer it does not play the video only play the audio

Now i changed the command

[root@localhost Movies]# mplayer -vo x11 -ao alsa 2012.avi

Now working fine

Tags: ,

 
0

Why i am moving to Linux in my home pc

Posted by admin on Jan 19, 2010 in Linux

Why i am moving to Linux in my home pc


For the past 3 years i have used pirated windows xp os in my home pc. But i have faced lot of problems like system very slow, Blue screen and more hectic thing is virus softwars. So i want to move any red-hat family, because i have some good experience with red-hat family os’s like centOS rather then Ubuntu. I have the CentOS 5.0 dvd that was downloaded before an year. When install using that dvd Testing Disk is not completed some files are corrupted. I have fedora 7 dvd then successfully installed on Intel(R) Pentium(R) 4 CPU 3.00GHz 2 cpu processor Intel 815 motherborad. I have the softwares for windows os only not for redhat rpm files.At that time wine (run Windows programs on Unix) software is help me a lot. I installed Openoffice and vlc using wine those are working fine. The mplayer and ffmpeg are used for my video and audio manipulation and playing. gnome-mplayer gives me the graphical toolbar option for mplayer. I used GIMP for image manipulation. I have the Netbeans distibution dvd it has java6 sdk and netbeans it enable me to develop a jsp pages and other things. Opensource softwares are rocking then why i used that pirated os’s (windows).. Till now i am not face any critical problems on fedora. Thanks to the fedora team.

Tags: , , ,

 
3

Adding Remote JMX for Red5

Posted by admin on Nov 13, 2009 in Flash, Linux, Programming

How to Add JMX for Red5 Server

Here we are going to know, How to managing red5 server remotely using JMX.

what is red5 server ..?

Red5 is an Open Source Flash Server written in Java that supports:

  • Streaming Video (FLV, F4V, MP4)
  • Streaming Audio (MP3, F4A, M4A)
  • Recording Client Streams (FLV only)
  • Shared Objects
  • Live Stream Publishing
  • Remoting

This is developed by Reverse Engineering of Adobe Flash Media server.  Red5 under the GNU Lesser General Public License. You can Modify and redistribute this software.


What is JMX …?

JMX stands for Java Management eXtension . JMX is written in java technology used to monitor and manage a java application or objects.

The configuration of jmx agent in red5.properties file. the properties are

red5.properties

# JMX
jmx.rmi.port.registry=9999
jmx.rmi.port.remoteobjects=
jmx.rmi.host=0.0.0.0
jmx.rmi.ssl=false

jmx.rmi.port.registry – the RMI registry port

jmx.rmi.host – the host value by default 0.0.0.0 . if the host is 127.0.0.1 you can’t access in remote. Normally this is your machine ip address.

you must open the firwall for the port 9999. then only you access from remote. For more information  http://bit.ly/1ACRRY

you can visualize the jvm by using this software https://visualvm.dev.java.net/

After install this Add the remote Host and Add remote JMX connection by adding

service:jmx:rmi://192.168.2.6:9999/jndi/rmi://192.168.2.6:9999/red5

192.168.2.6 – ip address of red5

the default user name for jmx is “red5user” and password is “changeme” .  you can change this bu changing the access.properties and password.properties in red5 conf folder.

Tags: , , ,

 
0

Batch file for building any java application

Posted by admin on Sep 24, 2009 in Programming, Widget

Batch file for building any java application

What is batch file…..?

In DOS, OS/2, and Microsoft Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. Article on wikipedia

This batch file contains the set of instruction to build a any java application. To get the good result you follow the below folder structure..

For example C:\apache-tomcat-6.0.18\webapps contains the many java web application. place this batch file in webapps folder.

  • The java files in webapps\<PROJECT_NAME>\src\  folder. With in the src folder u can follw the java package structure.
  • The jar files for your application in webapps\<PROJECT_HOME>\lib folder.
  • Then run that batch file like

C:\apache-tomcat-6.0.18\webapps>build.bat Library

  • Here the Library is your project Home. you can use this bat file anywhere not only for tomcat webapps folder.

Environment Variable Prequisites:

  1. JAVA_HOME       Must point at your Java Development Kit installation.
  2. JAVA_OPTS       (Optional) Java runtime options.
  3. CATALINA_HOME        (Optional) May point at your Catalina “build” directory.

How to set JAVA_HOME …?

JAVA_HOME basically known as Java Environmental Variable.Refers from web

If you already know the install path for the Java or Software Development Kit,skip this first two steps. Otherwise, find the install path by following these instructions:

  1. Unless you changed the install path for the Java Developement Kit during installation, it will be in a directory under C:\Program Files\Java. Using Explorer, open the directory C:\Program Files\Java
  2. Inside that path will be one or more subdirectories such as jdk1.5.0_08. If you just installed the Java Development Kit, it will be installed to the newest directory, which you can find by sorting by date. For example, it may be installed in C:\Program Files\Java\jdk1.5.0_08. This is the install path.

Once you have identified the JDK install path:

  1. Right click on the My Computer icon on your desktop and select properties
  2. Click the Advanced Tab
  3. Click the Environment Variables button
  4. Under System Variable, click New
  5. Enter the variable name as JAVA_HOME
  6. Enter the variable value as the install path for the Development Kit
  7. Click OK
  8. Click Apply Changes

What is JAVA_OPTS …….?

This JAVA_OPTS may increase your server performance. For example

set JAVA_OPTS=-Xms128 -Xmx512

The two extra parameters specified via JAVA_OPTS are as follows:
-Xms – the amount of memory that the JVM starts with.
-Xmx – the maximum memory that the JVM may have.

List of Java Hotspot Option Here.

What is CATALINA_HOME……?

Set an environment variable CATALINA_HOME to the path of the directory into which you have installed Tomcat.

For example :

set CATALINA_HOME=C:\apache-tomcat-6.0.18

How this Batch File works ……?

Get the all jar files from <PROJECT_HOME>\lib folder and set this as classpath.
Then compile all java files inside the src folder. and build the class files inside the <PROJECT_HOME>\WEB-INF Folder.


How to Download this Batch file ……?

You can download this batch file from Here.

http://arulraj1985.googlepages.com/build.bat

Tags: , ,

 
1

Windows command prompt properties

Posted by admin on Sep 8, 2009 in Uncategorized

Here the new command prompt window. Here you will know how to change the windows command prompt properties.

Now the command prompt look like windows power shell. To run the powershell Run –>type “powershell” –> enter

Press windows key + R. Type cmd in the Run command box. Right Click on the title bar and select the properties.

change the screen buffer size width to 120 and height to 3000.

change the window size width to 120 and height to 50.

change the widow position left 233 and top 169.  That is for 1440 X 900 resolution monitor.

To Change the background color to windows color (blue) . red 1 , green 36 , yellow 86.

The default font setting is.

The options Tap is

now your command prompt screen look like powershell screen.

Tags:

 
1

Secure login using java servlet

Posted by admin on Jul 25, 2009 in Programming

The user authentication is the common task when we create a web application. The servlet have j_security_check  authentication method. This is commonly called as form based authentication. Here the steps for this authentication.

This is in your index.jsp or login page

<form action="j_security_check" method="post"> Username
<input name="j_username" type="text" />
Password
<input name="j_password" type="password" />
<input type="submit" value="Login" />
</form>

Add below code in your web.xml

<login-config>
        <auth-method>FORM</auth-method>
        <realm-name>Real Name</realm-name>
        <form-login-config>
            <form-login-page>LoginPage.jsp</form-login-page>
            <form-error-page>LoginPageError.jsp</form-error-page>
            </form-login-config>
</login-config>

 <security-role>
 <description>view all permissions</description>
 <role-name>admin</role-name>
 </security-role>

 <security-role>
 <description>limited permissions</description>
 <role-name>user</role-name>
 </security-role>

 <resource-ref>
 <description>jdbc:mysql://localhost:3306/databasename</description>
 <res-ref-name>mysql/pooldb</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
 <res-sharing-scope>Shareable</res-sharing-scope>
 </resource-ref>

Add below code in your Tomcat’s \conf\server.xml

<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
	driverName="com.mysql.jdbc.Driver"
	connectionURL="jdbc:mysql://localhost/DBNAME?user=DBUSER&amp;password=DBPASS"
	userTable="USERTABLE" userNameCol="NAMECOLUMN" userCredCol="PASSCOLUMN"
	userRoleTable="ROLETABLE" roleNameCol="ROLECOLUMN"/>

For this you need two tables in your database. One is username table that contains username and password column. And another one is userrole table that contains username and role column.

  • debug —Here, we set the debug level. A higher number generates more detailed output.
  • driverName —The name of our MySQL driver. You need to be sure that the driver’s JAR file is located in Tomcat’s CLASSPATH.
  • connectionURL —The database URL that is used to establish a JDBC connection. In this field, weblogin is the name of our database; user and password are login data with which you are connecting to the database. In MySQL, such a user is created by default, so you can use it. In case you don’t have such a user, you need to create your own user and make it capable of working with your weblogin database.
  • userTable —A table with at least two fields, defined in userNameCol and userCredCol.
  • userNameCol and userCredCol—The fields with the name of login field from the users table and pass.

For more info Realm How to

Tags:

 
0

How to create and use private / public keys

Posted by admin on Jul 23, 2009 in Linux, Programming


Hi all,
Here the document for how to create private and public keys for login. This is more helpful others can login to your machine without disclose the password.

How to create private key for my machine..?
Go to /home/root/.ssh folder. Then run ssh-keygen command. Answer the questions. Then the key and pub files are created.
save this .pub file as authorized_keys.

[root@localhost ~]# cd .ssh/
[root@localhost .ssh]# ls
known_hosts
[root@localhost .ssh]# ssh-key
ssh-keygen ssh-keyscan
[root@localhost .ssh]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): example.ppk
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in example.ppk.
Your public key has been saved in example.pub.
The key fingerprint is:
6e:e4:ff:3b:a6:52:0d:57:ec:d2:f8:dd:e5:08:22:d6 root@localhost
[root@localhost .ssh]# cat example.pub >> authorized_keys
[root@localhost .ssh]# ls
authorized_keys example.ppk example.pub known_hosts

How to use the private keys..?

In putty

  • Open putty and type the ‘Host Name’ (ie root@192.168.1.117)
  • Give a name in ‘Saved Session’
  • Select Connection –> SSH –> Auth –> Browse –> Select the corresponding *.ppk file (ie example.ppk)
  • Now go to ‘Session’ Just click ‘Save Button’

Now you can login to your machine without password in putty. For putty and puttygen download

In Win-SCP

  • Start WinSCP. Under Session, enter the Host name(root@192.168.1.117), User name(root), and Private key file(*.ppk) and click ‘Save’.

Now you can login to your machine without password in WinSCP.

In SCP Command

scp -i example.ppk test.jpg root@192.168.1.117:/home/root/

In SSH Command

ssh -i example.ppk root@192.168.1.117

Tags: ,

 
0

My Farewell and Convocation photos

Posted by admin on Jul 14, 2009 in photos

Tags:

Copyright © 2009 Arul Blog All rights reserved. Theme by Laptop Geek | Download from Wordpress Themes.