Minor cleanup.
This commit is contained in:
		
							parent
							
								
									c173707a18
								
							
						
					
					
						commit
						3b5537fc9d
					
				| @ -129,7 +129,7 @@ struct AnimGraphBlendTree : public AnimNode { | ||||
|    * | ||||
|    * @tparam T Type of the Socket. | ||||
|    * @param name Name of the Socket. | ||||
|    * @param value_ptr Pointer where the graph output output is written to at the end of evaluation. | ||||
|    * @param value_ptr Pointer where the graph output is written to at the end of evaluation. | ||||
|    */ | ||||
|   template <typename T> | ||||
|   void SetOutput(const char* name, T* value_ptr) { | ||||
|  | ||||
| @ -380,11 +380,6 @@ struct NodeDescriptorBase { | ||||
|     *socket->m_reference.ptr_ptr = value_ptr; | ||||
|   } | ||||
| 
 | ||||
|   void SetOutputUnchecked(const char* name, void* value_ptr) { | ||||
|     Socket* socket = FindSocket(name, m_outputs); | ||||
|     *socket->m_reference.ptr_ptr = value_ptr; | ||||
|   } | ||||
| 
 | ||||
|   Socket* GetOutputSocket(const char* name) const { | ||||
|     return FindSocket(name, m_outputs); | ||||
|   } | ||||
|  | ||||
							
								
								
									
										41
									
								
								src/Camera.c
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								src/Camera.c
									
									
									
									
									
								
							| @ -42,8 +42,8 @@ inline void Camera_Init(Camera* camera) { | ||||
|   camera->pitch = 10 * M_PI / 180.0f; | ||||
| 
 | ||||
|   memcpy(&camera->mtxView, &mtx_identity, sizeof(camera->mtxView)); | ||||
|   Camera_CalcToMatrix(camera, &camera->mtxView); | ||||
|   Camera_CalcFromMatrix(camera, &camera->mtxView); | ||||
|   Camera_CalcToMatrix(camera, &camera->mtxView[0]); | ||||
|   Camera_CalcFromMatrix(camera, &camera->mtxView[0]); | ||||
| } | ||||
| 
 | ||||
| void Camera_CalcFromMatrix(Camera* camera, float* mat) { | ||||
| @ -72,11 +72,11 @@ void Camera_CalcFromMatrix(Camera* camera, float* mat) { | ||||
|   camera->pos[1] = -simd4f_get_y(eye); | ||||
|   camera->pos[2] = -simd4f_get_z(eye); | ||||
| 
 | ||||
| //  gLog ("ViewMat");
 | ||||
| //  gLog ("%f, %f, %f, %f", mtx->x[0], mtx->x[1], mtx->x[2], mtx->x[3]);
 | ||||
| //  gLog ("%f, %f, %f, %f", mtx->y[0], mtx->y[1], mtx->y[2], mtx->y[3]);
 | ||||
| //  gLog ("%f, %f, %f, %f", mtx->z[0], mtx->z[1], mtx->z[2], mtx->z[3]);
 | ||||
| //  gLog ("%f, %f, %f, %f", mtx->w[0], mtx->w[1], mtx->w[2], mtx->w[3]);
 | ||||
|   //  gLog ("ViewMat");
 | ||||
|   //  gLog ("%f, %f, %f, %f", mtx->x[0], mtx->x[1], mtx->x[2], mtx->x[3]);
 | ||||
|   //  gLog ("%f, %f, %f, %f", mtx->y[0], mtx->y[1], mtx->y[2], mtx->y[3]);
 | ||||
|   //  gLog ("%f, %f, %f, %f", mtx->z[0], mtx->z[1], mtx->z[2], mtx->z[3]);
 | ||||
|   //  gLog ("%f, %f, %f, %f", mtx->w[0], mtx->w[1], mtx->w[2], mtx->w[3]);
 | ||||
| } | ||||
| 
 | ||||
| void Camera_CalcToMatrix(Camera* camera, float* mat) { | ||||
| @ -87,9 +87,10 @@ void Camera_CalcToMatrix(Camera* camera, float* mat) { | ||||
| 
 | ||||
|   const float d = 10.0f; | ||||
| 
 | ||||
|   simd4f eye = simd4f_create (camera->pos[0], camera->pos[1], camera->pos[2], 1.f); | ||||
|   simd4f forward = simd4f_create (-cp * ch, -sp, cp * sh, 0.f); | ||||
|   simd4f right = simd4f_cross3 (forward, simd4f_create (0.f, 1.f, 0.f, 1.f)); | ||||
|   simd4f eye = | ||||
|       simd4f_create(camera->pos[0], camera->pos[1], camera->pos[2], 1.f); | ||||
|   simd4f forward = simd4f_create(-cp * ch, -sp, cp * sh, 0.f); | ||||
|   simd4f right = simd4f_cross3(forward, simd4f_create(0.f, 1.f, 0.f, 1.f)); | ||||
|   simd4f up = simd4f_cross3(right, forward); | ||||
|   simd4f center = simd4f_add(simd4f_mul(forward, simd4f_splat(d)), eye); | ||||
| 
 | ||||
| @ -105,9 +106,9 @@ void Camera_CalcToMatrix(Camera* camera, float* mat) { | ||||
|   simd4x4f_lookat(&mtx, eye, center, up); | ||||
| 
 | ||||
|   simd4f_ustore4(mtx.x, mat); | ||||
|   simd4f_ustore4(mtx.y, mat +4); | ||||
|   simd4f_ustore4(mtx.z, mat +8); | ||||
|   simd4f_ustore4(mtx.w, mat +12); | ||||
|   simd4f_ustore4(mtx.y, mat + 4); | ||||
|   simd4f_ustore4(mtx.z, mat + 8); | ||||
|   simd4f_ustore4(mtx.w, mat + 12); | ||||
| } | ||||
| 
 | ||||
| inline void Camera_Update( | ||||
| @ -120,14 +121,14 @@ inline void Camera_Update( | ||||
|     float accel[3]) { | ||||
|   assert(camera); | ||||
|   assert((width > 0) && (height > 0)); | ||||
|   const float w = (float) width; | ||||
|   const float h = (float) height; | ||||
|   const float w = (float)width; | ||||
|   const float h = (float)height; | ||||
|   simd4x4f proj; | ||||
|   simd4x4f_perspective(&proj, camera->fov, w/h, camera->near, camera->far); | ||||
|   simd4x4f_perspective(&proj, camera->fov, w / h, camera->near, camera->far); | ||||
|   simd4f_ustore4(proj.x, camera->mtxProj); | ||||
|   simd4f_ustore4(proj.y, camera->mtxProj +4); | ||||
|   simd4f_ustore4(proj.z, camera->mtxProj +8); | ||||
|   simd4f_ustore4(proj.w, camera->mtxProj +12); | ||||
|   simd4f_ustore4(proj.y, camera->mtxProj + 4); | ||||
|   simd4f_ustore4(proj.z, camera->mtxProj + 8); | ||||
|   simd4f_ustore4(proj.w, camera->mtxProj + 12); | ||||
| 
 | ||||
|   if (mouse_dx != 0.f || mouse_dy != 0.f || accel != NULL) { | ||||
|     const float mouse_sensitivity = 20.0f; | ||||
| @ -153,6 +154,6 @@ inline void Camera_Update( | ||||
|       camera->vel[i] = camera->vel[i] * 0.1; | ||||
|     } | ||||
| 
 | ||||
|     Camera_CalcToMatrix(camera, &camera->mtxView); | ||||
|     Camera_CalcToMatrix(camera, &camera->mtxView[0]); | ||||
|   } | ||||
| } | ||||
| @ -175,10 +175,6 @@ TEST_CASE_METHOD( | ||||
|   AnimNodeResource* blend_node = blend_tree_resource->GetNode(blend_node_index); | ||||
|   blend_node->m_name = "BlendWalkRun"; | ||||
| 
 | ||||
|   // Setup graph outputs and inputs
 | ||||
|   AnimNodeResource* graph_output_node = | ||||
|       blend_tree_resource->GetGraphOutputNode(); | ||||
| 
 | ||||
|   blend_tree_resource->RegisterBlendTreeInputSocket<float>("GraphFloatInput"); | ||||
| 
 | ||||
|   // Wire up nodes
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Martin Felis
						Martin Felis