Ejemplo n.º 1
0
void make_player(game_s *game)
{
    actor_s *actor = make_actor();
    game_register_actor(game, actor);

    transform_s *transform = make_transform(game, actor);
    sprite_s *sprite = make_sprite(game, actor, transform);
    (void)sprite;
}
Ejemplo n.º 2
0
/* V_LENS -> V_FILTER -> V_TRANSFORM */
static struct value *xform_transform(struct info *info, struct value *l,
                                     struct value *f) {
    assert(l->tag == V_LENS);
    assert(f->tag == V_FILTER);
    if (l->lens->value || l->lens->key) {
        return make_exn_value(ref(info), "Can not build a transform "
                              "from a lens that leaves a %s behind",
                              l->lens->key ? "key" : "value");
    }
    struct value *v = make_value(V_TRANSFORM, ref(info));
    v->transform = make_transform(ref(l->lens), ref(f->filter));
    return v;
}
Ejemplo n.º 3
0
static Transform blender_camera_matrix(const Transform& tfm,
                                       const CameraType type,
                                       const PanoramaType panorama_type)
{
	Transform result;

	if(type == CAMERA_PANORAMA) {
		if(panorama_type == PANORAMA_MIRRORBALL) {
			/* Mirror ball camera is looking into the negative Y direction
			 * which matches texture mirror ball mapping.
			 */
			result = tfm *
				make_transform(1.0f, 0.0f, 0.0f, 0.0f,
				               0.0f, 0.0f, 1.0f, 0.0f,
				               0.0f, 1.0f, 0.0f, 0.0f,
				               0.0f, 0.0f, 0.0f, 1.0f);
		}
		else {
			/* Make it so environment camera needs to be pointed in the direction
			 * of the positive x-axis to match an environment texture, this way
			 * it is looking at the center of the texture
			 */
			result = tfm *
				make_transform( 0.0f, -1.0f, 0.0f, 0.0f,
				                0.0f,  0.0f, 1.0f, 0.0f,
				               -1.0f,  0.0f, 0.0f, 0.0f,
				                0.0f,  0.0f, 0.0f, 1.0f);
		}
	}
	else {
		/* note the blender camera points along the negative z-axis */
		result = tfm * transform_scale(1.0f, 1.0f, -1.0f);
	}

	return transform_clear_scale(result);
}
Ejemplo n.º 4
0
static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
{
	Transform result;

	if(type == CAMERA_PANORAMA) {
		/* make it so environment camera needs to be pointed in the direction
		 * of the positive x-axis to match an environment texture, this way
		 * it is looking at the center of the texture */
		result = tfm *
			make_transform( 0.0f, -1.0f, 0.0f, 0.0f,
			                0.0f,  0.0f, 1.0f, 0.0f,
			               -1.0f,  0.0f, 0.0f, 0.0f,
			                0.0f,  0.0f, 0.0f, 1.0f);
	}
	else {
		/* note the blender camera points along the negative z-axis */
		result = tfm * transform_scale(1.0f, 1.0f, -1.0f);
	}

	return transform_clear_scale(result);
}