Example 3 : motion blur And Shade(Shadow)

下面是main.c

#include <stdio.h>
#include <math.h>

#include <il/il.h>
#pragma comment(lib,"DevIL.lib")
#pragma comment(lib,"ILU.lib")
#pragma comment(lib,"ILUT.lib")



#include "vec3.h"
#include "sample.h"
#include "shapes.h"

#define IMAGE_WIDTH		512
#define IMAGE_HEIGHT	384
#define NUM_SAMPLES		16

shape_t shapes[4];
light_t lights[1];

unsigned char floattochar(float c)
{
	int i = (int)c;
	if (i <= 0)
		return 0;
	if (i >= 255)
		return 255;
	else
		return (unsigned char)(c);
}

int main(int argc, int argv)
{
	int r, c, s;
	float x_samples[NUM_SAMPLES];
	float y_samples[NUM_SAMPLES];
	float t_samples[NUM_SAMPLES];
	unsigned char image[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
	float aspect;
	vec3 total, color, hitpos;

	vec3 start, dir;
	hit_t hit;

	ILuint iname;

	ilInit();
	ilEnable(IL_FILE_OVERWRITE);

	aspect = (float) IMAGE_HEIGHT / (float)IMAGE_WIDTH;
	VectorSet(dir, 0, 0, -1);

	shapes[0].type = SHAPE_SPHERE;
	VectorSet(shapes[0].sphere.center, -0.3f, 0.3f, -2);
	shapes[0].sphere.radius = 0.25f;
	VectorSet(shapes[0].move_velocity, 0, -0.05f, 0);
	VectorSet(shapes[0].color, 1, 0, 0);

	shapes[1].type = SHAPE_SPHERE;
	VectorSet(shapes[1].sphere.center, 0.3f, 0.3f, -4);
	shapes[1].sphere.radius = 0.25f;
	VectorSet(shapes[1].move_velocity, 0.1f, 0, 0);
	VectorSet(shapes[1].color, 0, 1, 0);

	shapes[2].type = SHAPE_TRI;
	VectorSet(shapes[2].tri.verts[0], -0.9f, -0.5f,0);
	VectorSet(shapes[2].tri.verts[1], 0, 0, -6
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值