cinecam.patch

tdev, 02/22/2010 11:52 am

Download (4.6 kB)

Beam.cpp (working copy)
5836 5836
	if (dt>1.0/20.0)
5837 5837
	{
5838 5838
		dt=1.0/20.0;
5839
		debugText="NOT real time - Fasttrack: "+StringConverter::toString(fasted*100/(fasted+slowed))+"% "+StringConverter::toString(steps)+" steps";
5839
		debugText="RT - Fasttrack: "+StringConverter::toString(fasted*100/(fasted+slowed))+"% "+StringConverter::toString(steps)+" steps";
5840 5840
	}
5841 5841
	else
5842 5842
	{
5843
		debugText="___ Real time - Fasttrack: "+StringConverter::toString(fasted*100/(fasted+slowed))+"% "+StringConverter::toString(steps)+" steps";
5843
		debugText="SL - Fasttrack: "+StringConverter::toString(fasted*100/(fasted+slowed))+"% "+StringConverter::toString(steps)+" steps";
5844 5844
	};
5845 5845
	//update visual - antishaking
5846 5846
	//	int t;
......
5952 5952
				if (trucks[t]->state!=SLEEPING && trucks[t]->state!=NETWORKED && trucks[t]->state!=RECYCLE)
5953 5953
				{
5954 5954
					// calculate average position
5955
					Vector3 aposition=Vector3::ZERO;
5956
					int nodesnum=0;
5957
					for (int n=0; n<trucks[t]->free_node; n++)
5955
					if(trucks[t]->freecinecamera > 0)
5958 5956
					{
5959
//							trucks[t]->nodes[n].smoothpos=trucks[t]->nodes[n].tsmooth/steps;
5960
							trucks[t]->nodes[n].smoothpos = trucks[t]->nodes[n].AbsPosition;
5961
							if((trucks[t]->nodes[n].AbsPosition - trucks[t]->nodes[0].AbsPosition).squaredLength() > trucks[t]->nodes[n].iDistance * 25)
5962
							{
5963
								// loose node, ignore ...
5964
							} else
5965
							{
5966
								// valid node
5967
								aposition += trucks[t]->nodes[n].smoothpos;
5968
								nodesnum++;
5969
							}
5970
//							trucks[t]->nodes[n].tsmooth=Vector3::ZERO;
5957
						trucks[t]->position = trucks[t]->nodes[cinecameranodepos[0]].AbsPosition - Vector3(0, 0.5f, 0);
5958
					} else
5959
					{
5960
						Vector3 aposition=Vector3::ZERO;
5961
						int nodesnum=0;
5962
						for (int n=0; n<trucks[t]->free_node; n++)
5963
						{
5964
	//							trucks[t]->nodes[n].smoothpos=trucks[t]->nodes[n].tsmooth/steps;
5965
								trucks[t]->nodes[n].smoothpos = trucks[t]->nodes[n].AbsPosition;
5966
								if((trucks[t]->nodes[n].AbsPosition - trucks[t]->nodes[0].AbsPosition).squaredLength() > trucks[t]->nodes[n].iDistance * 25)
5967
								{
5968
									// loose node, ignore ...
5969
								} else
5970
								{
5971
									// valid node
5972
									aposition += trucks[t]->nodes[n].smoothpos;
5973
									nodesnum++;
5974
								}
5975
	//							trucks[t]->nodes[n].tsmooth=Vector3::ZERO;
5976
						}
5977
						trucks[t]->position = aposition / nodesnum;
5971 5978
					}
5972
					trucks[t]->position = aposition / nodesnum;
5973 5979
				}
5974 5980
				if (floating_origin_enable && trucks[t]->nodes[0].RelPosition.length()>100.0)
5975 5981
				{
......
6004 6010
				if (trucks[t]->state!=SLEEPING && trucks[t]->state!=NETWORKED && trucks[t]->state!=RECYCLE)
6005 6011
				{
6006 6012
					// average position
6007
					Vector3 aposition=Vector3::ZERO;
6008
					int nodesnum=0;
6009
					for (int n=0; n<trucks[t]->free_node; n++)
6013
					if(trucks[t]->freecinecamera > 0)
6010 6014
					{
6011
						trucks[t]->nodes[n].smoothpos=trucks[t]->nodes[n].AbsPosition;
6012
						aposition += trucks[t]->nodes[n].smoothpos;
6015
						// set average position
6016
						trucks[t]->position = trucks[t]->nodes[cinecameranodepos[0]].AbsPosition - Vector3(0, 0.5f, 0);
6017
						// smooth
6018
						for (int n=0; n<trucks[t]->free_node; n++)
6019
							trucks[t]->nodes[n].smoothpos=trucks[t]->nodes[n].AbsPosition;
6020
					} else
6021
					{
6022
						// smooth and average in one step
6023
						Vector3 aposition=Vector3::ZERO;
6024
						int nodesnum=0;
6025
						for (int n=0; n<trucks[t]->free_node; n++)
6026
						{
6027
							trucks[t]->nodes[n].smoothpos=trucks[t]->nodes[n].AbsPosition;
6028
							aposition += trucks[t]->nodes[n].smoothpos;
6029
						}
6030
						trucks[t]->position = aposition / free_node;
6013 6031
					}
6014
					trucks[t]->position = aposition / free_node;
6015 6032
				}
6016 6033
				if (floating_origin_enable && trucks[t]->nodes[0].RelPosition.length()>100.0)
6017 6034
				{
......
6045 6062
			if (state!=SLEEPING && state!=NETWORKED && state!=RECYCLE)
6046 6063
			{
6047 6064
				// average position
6048
				Vector3 aposition=Vector3::ZERO;
6049
				int nodesnum=0;
6050
				for (int n=0; n<free_node; n++)
6065
				if(freecinecamera > 0)
6051 6066
				{
6052
					nodes[n].smoothpos=nodes[n].AbsPosition;
6053
					aposition += nodes[n].smoothpos;
6067
					position = nodes[cinecameranodepos[0]].AbsPosition - Vector3(0, 0.5f, 0);
6068
				} else
6069
				{
6070
					Vector3 aposition=Vector3::ZERO;
6071
					int nodesnum=0;
6072
					for (int n=0; n<free_node; n++)
6073
					{
6074
						nodes[n].smoothpos=nodes[n].AbsPosition;
6075
						aposition += nodes[n].smoothpos;
6076
					}
6077
					position = aposition / free_node;
6054 6078
				}
6055
				position = aposition / free_node;
6056 6079
			}
6057 6080
			if (floating_origin_enable && nodes[0].RelPosition.length()>100.0)
6058 6081
			{