Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding camera matricies to JSON #8

Open
el3ment opened this issue Aug 23, 2018 · 0 comments
Open

Adding camera matricies to JSON #8

el3ment opened this issue Aug 23, 2018 · 0 comments

Comments

@el3ment
Copy link

el3ment commented Aug 23, 2018

I'm trying to add avg_world, avg_world_view, and avg_world_view_proj to the JSON output. I've created a new function:

std::string toJSON(float4x4 & f) {
	std::stringstream s;
	s << "[ [" << f.d[0][0] << ", " << f.d[0][1] << ", " << f.d[0][2] << ", " << f.d[0][3] << "], ["
		<< f.d[1][0] << ", " << f.d[1][1] << ", " << f.d[1][2] << ", " << f.d[1][3] << "], ["
		<< f.d[2][0] << ", " << f.d[2][1] << ", " << f.d[2][2] << ", " << f.d[2][3] << "], ["
		<< f.d[3][0] << ", " << f.d[3][1] << ", " << f.d[3][2] << ", " << f.d[3][3] << "] ]";
	return s.str();
}

And added members to the GameInfo:

struct GameInfo {
	int time_since_player_hit_vehicle;
	int time_since_player_hit_ped;
	int time_since_player_drove_on_pavement;
	int time_since_player_drove_against_traffic;
	int dead;
	Vec3f position, forward_vector;
	float heading;
	int on_foot, in_vehicle, on_bike, money;
	float4x4 avg_world;
	float4x4 avg_world_view;
	float4x4 avg_world_view_projection;
};

And added the members to the TOJSON macro:

TOJSON(GameInfo, time_since_player_hit_vehicle, time_since_player_hit_ped, time_since_player_drove_on_pavement, time_since_player_drove_against_traffic, dead, position, forward_vector, heading, on_foot, in_vehicle, on_bike, money, avg_world, avg_world_view, avg_world_view_projection)

But, the output returns just a "1":
{"time_since_player_hit_vehicle":-1,"time_since_player_hit_ped":-1,"time_since_player_drove_on_pavement":-1,"time_since_player_drove_against_traffic":-1,"dead":0,"position":[-14.380300,-1438.514282,31.101547],"forward_vector":[0.222740,-0.974878,0.000000],"heading":192.870010,"on_foot":1,"in_vehicle":0,"on_bike":0,"money":11,"avg_world":1,"avg_world_view":1,"avg_world_view_projection":1,"timestamp": 1534989424.864456}

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant