Ose command tutorial:


 Brive introduction

    In ose, i create abstract dir according to script structor
    eg: 
       ParticleSystemDir    //represent basic info of particle system
       ---EmitterDir        //represent particle emitter in particle system
       ---AffectorDir       //represent particle affector in particle system
       ---RenderDir         //represent particle renderer in particle system

    As ogre use a lot of '/' in script name, I use '\' as dir delimiter.
    There are some predefined dir:

        \                          \\root dir
        \materialRoot              \\as the name
        \particleRoot              \\as the name
        \gpuProgramRoot            \\as the name
        \system                    \\system setting, you can also manage scene light here         
        .                          \\current dir
        ..                         \\parent dir


    I create a command system to edit dir, just like manage file in os.
    You can get manual of specific command by execute:
       
       man cmdName

	
   I use orbit_mode cameraMan which comes with ogre sdk, you can control it like this:
       ctrl + left mouse button + drag   :  rotate camera
       ctrl + mid mouse button scroll    :  zoom
       ctrl + right mouse button + drag  :  zoom

  Following examples will help you understand how to use ose:
	You can copy command line one by one to console.
	Or you can type by your self, don't be scared of typing, 
	it's actually much much more fast then copy and paste.
	I build prompt for almost every string type text, just press 'tab' while typing.

	---------------------------------------------------------------------
	How to add a material to to an existing material script file (sample.material)
	This material must has a pixed pipline sine scroll animation.
	And i want to see the realtime effect on specific mesh.

	A little tip: always press "tab" to get prompt whiling typing

	  lm plane.mesh                    //load your mesh
	  cd \materialRoot                 //you must go to here to add material 
	  add MaterialSystem sineScroll sample.material //create material

	  cd sineScroll\technique0\pass0   
	  add Tus                  //add texture, "Tus" is casesensitive
	  cd tus0                  //as you don't give Tus a name, tus0 is named by system
	  set texture dk.jpg        

	                     //if you can't see  the texture, execute following 3 command:
	                                  cd \system
	                     			  set autoAttatchMaterial true
	                     			  cd \sineScroll\technique0\pass0	

	  set wave_xform scroll_x sine 0 1 0 1

	  At last, remember to use "ctrl + s" to save your work
	  You should see the animation now.
	  By the way, material is automatically used to entity when you enter into that material.
	  In this  case   "cd sineScroll\technique0\pass0" do this job.
    
	  ---------------------------------------------------------------------
	  How to create a firework particle system to a new script file(firework.particle).
	  
	  A little tip: combine ctrl, shift and backspace, arrow to help edit command

	  um         //unload mesh
	  cd \particleRoot               //you can only add particle here
	  add ParticleSystem firework firework.particle //you must type firework.particle by yourself here
	  cd firework
	  add Emitter Point

	                     //if you can't see some gray square, execute following 3 command:
	                                  cd \system
	                     			  set autoAttatchParticle true
	                     			  cd \particleRoot\firework
									
	  set quota 500
	  set particle_width 2
	  set particle_height 2
	  set material PE/Lensflare      //remember to use 'tab'	
	  cd pointEmitter0               
	  set direction 0 1 0
	  set angle 10
	  set velocity_min 10
	  set velocity_max 25
	  set emission_rate 200

	  //there are two ways to set color  
	  1. use command:
	      set colour_range_start 0 0 0
	   
	  2. use dialog:
	      press "ctrl + p" after typing colour_range_start (dont forget the tailing space)
		  chose colour from colour dialog, then press return twice time

	  Next, let's add some gravity effect

	  cd ..
	  add Affector LinearForce
	  cd linearForceAffector0
	  set force_vector 0 -5 0

	  At last, remember to  use "ctrl + s" to save your work
	---------------------------------------------------------------------
	
    How to create a shader program and material

	A little tip:
	   use "ctrl + b" to enable ui background , use "ctrl + =" or "ctrl + -" to change ui alpha

	cd \gpuProgramRoot
	add GpuProgram fragment_program hlsl phongSample_ps_hlsl sample.program
	cd phongSample_ps_hlsl
	set source specular.hlsl
	set entry_point phongPS    //just tab, i already extract mether name
	set target ps_2_0
	loadGpg      //ths will create parameter for gpu program, you should see default_param now

	   //for a lot of time, you loadGpg, you get nothing. Mostly because your hlsl file is wrong
	   // or you forget to set preprocessor_defines

	cd default_params
	set param_named_auto gAmbient ambient_light_colour
	set param_named_auto gDiffuse light_diffuse_colour 0   //you must type 0, it can not be ignored
	set param_named_auto gSpecular light_specular_colour 0 
	set param_named gSpecShine float1 20

	//next let's create a material and use it to ogrehead
	                  //if you finished last tutorial, you might want to detath paricle system. If so:

							detach ParticleSystem sceneNode  //this will detatch particle system
    
	
	lm ogrehead.mesh
	add MaterialSystem phongSample sample.material
	cd phongSample\technique0\pass0
	add GpuProgramRef vertex_program_ref hlsl specular_vs_hlsl   //specular_vs_hlsl comes with ose
	add GpuProgramRef fragment_program_ref hlsl phongSample_ps_hlsl 

	 At last, remember to  use "ctrl + s" to save your work
	---------------------------------------------------------------------
	a little tip:
	    If you 'tab', you get nothing, and you are pretty sure next text is string type,
		that must because your command line is already wrong, for example:
		   cmd text0 text1 text2 text3
		If your typing for text1 is wrong, you won't get any more prompt for text2 or text3.

	   
     How to copy a shader program and put it in sample.program:

       cp phong_ps_hlsl . bling_ps_hlsl sample.program
       unloadGpg             //you must unload gpu program, so you can change source and something else
       set source specular.hlsl
       set entry_point blingPS
       loadGpg
   
    If you have a good naming convention, the bling_ps_hlsl will copy default_param 
    setting from phong_ps_hlsl as much as possible.
	---------------------------------------------------------------------
	
	How to remove a pass
	
	cd /yourMaterial/yourTechnique
	rm pass0 

	in fact, you can remove anything like this.
	---------------------------------------------------------------------
	How to edit light

    Light is also represented by a dir, it resides in \system\
    You can edit it just like you edit any other dir.

	---------------------------------------------------------------------

	 How to export or load scene

	 ls fireSinbad.scene
	 pa Dance

	 Fow now, load scene will load light, entity and particle system attatched to bone

	 ls defaul   //remember to do this for following tutorial

	 you can change default scene by exporting you own scene to default.scene like this
	 es default.scene

	 ---------------------------------------------------------------------
	 How to attatch particle to bone

	 A little tip:
	   you can use upper or down arrow to roll through command history
	   you will need a lot 'tab' and ctrl to do this tutorial

	 let's create a fire sinbad the same as fireSinbad.scene

	 lm Sinbad.mesh
	 attatch ParticleSystem bone Head ose/fireLimb exclusive
	 attatch ParticleSystem bone Hand.L ose/fireLimb exclusive
	 attatch ParticleSystem bone Hand.R ose/fireLimb exclusive
	 attatch ParticleSystem bone Foot.L ose/fireLimb exclusive
	 attatch ParticleSystem bone Foot.R ose/fireLimb exclusive
	 attatch ParticleSystem bone Waist ose/fireBody exclusive
	 attatch ParticleSystem bone Waist ose/fireExplotion additive
	 attatch ParticleSystem bone Waist ose/fireRain additive
	 attatch ParticleSystem bone Hand.L ose/firework additive
	 attatch ParticleSystem bone Hand.R ose/firework additive

	 pa Dance


	 By the way, you can still edit particle system after attatching to bone

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

system shortcut list:

tab                 :  get prompt for current typing
ctrl + backspace    :  delete previous word in command line
ctrl + delete       :  delete next word in command line
shift + backspace   :  clean command line
ctrl + left arror   :  move caret to previous word in command line
ctrl + right arror  :  move caret to next word in command line
ctrl + c            :  copy selected text from command line
ctrl + v            :  paste text to command line
ctrl + d            :  show all parameters of current string interface
ctrl + s            :  save
ctrl + n            :  switch 3dAxes visibility
up arrow            :  previous command
down arrow          :  next command
esc                 :  hide cmd ui or leave system
ctrl + e            :  show cmd ui
ctrl + left mouse button + drag   :  rotate camera
ctrl + mid mouse button scroll    :  zoom
ctrl + right mouse button + drag  :  zoom
ctrl + p            :  colour select window
ctrl + b            :  switch ui background visibility
ctrl + =            :  turn up alpha of ui background
ctrl + -            :  turn down alpha of ui background

