#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "def.h"
#include "draw.h"
#include "struct.h"
#include "analyser_struct.h"
#include "palette.h"
#include "draw_low_level.h"
#include "projection.h"
extern int resx, resy, xres2, yres2,video;
extern struct conteur_struct conteur;
extern struct analyser_struct lys;
/*******************************************************************/
/**************** ANALYSER *****************************************/
/*******************************************************************/
void analyser(unsigned char * buffer)
{
int i ;
droite (buffer, -xres2, 0, -xres2+10, 0, 30);
for (i = -xres2 ; i<-xres2+5 ; i++)
{
droite (buffer, i, 0, i,(int)(lys.E_moyen*2000) , 250);
droite (buffer, i+5, 0, i+5, (int)(lys.dEdt_moyen*25000) , 230);
droite (buffer, i+10, 0, i+10, (int)(lys.dEdt*25000) , 200);
}
}
/*******************************************************************/
/**************** FUSEES *******************************************/
/*******************************************************************/
void fusee(unsigned char * buffer, int new)
{
int i;
int x=0,y=0;
static int xi[FUSEE_MAX], yi[FUSEE_MAX];
static float life[FUSEE_MAX];
float factor ;
if (new == NEW) /* on creer une nouvelle fusee*/
{
i=0;
while (life[i] > 0)
{
i++;
if (i == FUSEE_MAX+1)
goto quit; /* pas de place desole */
}
xi[i] = rand()%resx - xres2;
yi[i] = -rand()%yres2;
life[i] = FUSEE_VIE; /* on donne la vie max*/
}
else /* on gere les autres */
{
for(i = 0 ; i< FUSEE_MAX; i++)
if (life[i] > 0) /* si elle est vivante */
{
factor = life[i] / FUSEE_VIE;
x = xi[i] * factor;
y = yi[i] * factor;
life[i]--;
ball (buffer, x, y, (int) FUSEE_RAYON * factor, FUSEE_COLOR);
}
}
quit:;
}
/*******************************************************************/
/**************** SUPER SPECTRAL ***********************************/
/*******************************************************************/
void super_spectral_balls(unsigned char * buffer)
{
int i,j;
static float life[256][LINE_MAX];
static float x[256][LINE_MAX],y[256][LINE_MAX];
static float vx[256][LINE_MAX],vy[256][LINE_MAX];
float dt = conteur.dt;
for(i=0; i < 256 ;i++) /* pour chaque frequence */
{
if (lys.dbeat[i] == NEW) /*creation d'une nouvelle ligne */
{
lys.dbeat[i] = MANAGE;
j=0;
while (life[i][j] > 0)
{
j++;
if (j == LINE_MAX+1)
goto quit; /* pas de place desole */
}
/* initialisation de la ligne */
life[i][j] = LINE_VIE;
vx[i][j] = RESFACTXF( 0.025*((float) i - 128.0) * 32 +0*(1-(float)rand()/RAND_MAX) );
vy[i][j] = RESFACTYF( (10+i)*i*lys.Ed_moyen[i]*5000*( (float)j+1)/4);
x[i][j] = RESFACTXF( 2*(i - 128) ) +((float)j*(i-128))/2;
y[i][j] = 0*RESFACTXF( yres2/2-(float)((i-128)*(i-128))/256) -20*j ;
}
quit:; /* pas de nouvelle ligne */
for (j=0 ; j < LINE_MAX ; j++)
if (life[i][j] > 0)
{
vy[i][j] += -0.5*dt*1024;
x[i][j] += vx[i][j] * dt;
y[i][j] += vy[i][j] * dt;
boule(buffer, (int) x[i][j], (int) y[i][j],5, 250*(LINE_VIE-life[i][j])/LINE_VIE);
if ((y[i][j] < resy) &&(y[i][j] > -resy) ) /*oui !*/
{
/* droite (buffer,0 ,(int) 0*y[i][j]/8, (int) x[i][j], (int) y[i][j], 50*(LINE_VIE-life[i][j])/LINE_VIE); */
if (i>128)
droite (buffer,xres2 ,(int) y[i][j]/32, (int) x[i][j], (int) y[i][j], 50*(LINE_VIE-life[i][j])/LINE_VIE);
else
droite (buffer,-xres2 ,(int) y[i][j]/32, (int) x[i][j], (int) y[i][j], 50*(LINE_VIE-life[i][j])/LINE_VIE);
}
life[i][j]--;
}
}
}
/*******************************************************************/
/**************** SUPER SPECTRAL ***********************************/
/*******************************************************************/
void super_spectral(unsigned char * buffer)
{
int i,j;
static float life[256][LINE_MAX];
static float x[256][LINE_MAX],y[256][LINE_MAX];
static float vx[256][LINE_MAX],vy[256][LINE_MAX];
static float theta[256][LINE_MAX],omega[256][LINE_MAX];
/* float dt = 1/conteur.fps; */
float nx,ny;
float taille,dt = conteur.dt;
for(i=0; i < 256 ;i++) /* pour chaque frequence */
{
if (lys.dbeat[i] == NEW) /*creation d'une nouvelle ligne */
{
lys.dbeat[i] = MANAGE;
j=0;
while (life[i][j] > 0)
{
j++;
if (j == LINE_MAX+1)
goto quit; /* pas de place desole */
}
/* initialisation de la ligne */
life[i][j] = LINE_VIE;
vx[i][j] = 0*RESFACTXF( 0.025*((float) i - 128.0) * 32 +(float)rand()/RAND_MAX*60 );
vy[i][j] = 0*RESFACTYF( 64 +(float)rand()/RAND_MAX*64);
x[i][j] = RESFACTXF( 2*(i - 128) ) +((float)j*(i-128))/2;
y[i][j] = 0*RESFACTXF( yres2/2-(float)((i-128)*(i-128))/256) -20*j+60 ;
theta[i][j] = 0;
omega[i][j] = (10+i)*i*lys.Ed_moyen[i]*32;
}
quit:; /* pas de nouvelle ligne */
for (j=0 ; j < LINE_MAX ; j++)
if (life[i][j] > 0)
{
theta[i][j] += omega[i][j]*dt;
vy[i][j] += -0.5*dt*1024*0;
x[i][j] += vx[i][j] * dt;
y[i][j] += vy[i][j] * dt;
taille = RESFACTXF(70) * (0+2*(LINE_VIE-life[i][j]))/LINE_VIE*(j+1)/6;
nx = taille*sin(theta[i][j]);
ny = taille*cos(theta[i][j]);
/* droite (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny, (int) x[i][j]-0*nx, (int) y[i][j]-0*ny, 50*(life[i][j])/LINE_VIE); */
/* cercle_32 (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny,(int) ( (float) 5*(life[i][j]) / LINE_VIE), 150*(life[i][j])/LINE_VIE); */
/* cercle_32 (buffer, (int) x[i][j]-0*nx, (int) y[i][j]-0*ny,(int) ( (float) 5*(life[i][j]) / LINE_VIE) , 150*(life[i][j])/LINE_VIE); */
/* droite (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny, (int) x[i][j]-0*nx, (int) y[i][j]-0*ny, 50*(LINE_VIE-life[i][j])/LINE_VIE); */
/* cercle_32 (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny,(int) ( (float) 5*(LINE_VIE-life[i][j]) / LINE_VIE), 150*(LINE_VIE-life[i][j])/LINE_VIE); */
/* cercle_32 (buffer, (int) x[i][j]-0*nx, (int) y[i][j]-0*ny,(int) ( (float) 5*(LINE_VIE-life[i][j]) / LINE_VIE) , 150*(LINE_VIE-life[i][j])/LINE_VIE); */
droite (buffer, (int) x[i][j]+nx , (int) y[i][j]+ny, (int) x[i][j], (int) y[i][j], 50*(LINE_VIE-life[i][j])/LINE_VIE);
if (video ==8)
cercle (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny, 3*j, 150*(LINE_VIE-life[i][j])/LINE_VIE);
else
cercle_32 (buffer, (int) x[i][j]+nx, (int) y[i][j]+ny, 3*j, 150*(LINE_VIE-life[i][j])/LINE_VIE);
/* cercle_32 (buffer, (int) x[i][j], (int) y[i][j], 3*j , 150*(LINE_VIE-life[i][j])/LINE_VIE); */
life[i][j]--;
}
}
}
/*******************************************************************/
/**************** GRANDE GRILLE ************************************/
/*******************************************************************/
void grille_3d (unsigned char * buffer, gint16 data[2][512], float alpha, float beta,
float gamma, int persp, int dist_cam)
{
float x, y, z, xres2 = (float) (resx >> 1), yres2 = (float) (resy >> 1);
gint16 ax = 0, ay = 0, ix, iy, i, j, nb_x, nb_y;
/* int tx[32][32], ty[32][32]; */
unsigned char color/* [32][32] */;
nb_x = 32;
nb_y = 32;
for (i = 0; i < nb_x; i++)
{
/* Optimisation par Karl Soulabaille. Factorisation et expressions communes. */
for (j = 0; j < nb_y; j++)
{
x = RESFACTXF ((i - ((float) nb_x) / 2) * 10);
y = RESFACTYF ((j - ((float) nb_y) / 2) * 10);
if (j >= 16)
{
z = RESFACTXF ((float) (data[0][i + nb_x * (j - 16)]) / 256);
color/* [i][j] */ = data[0][i + nb_x * (j - 16)] / 512 + 100;
}
else
{
z = RESFACTXF ((float) (data[1][i + nb_x * j]) / 256);
color/* [i][j] */ = (data[1][i + nb_x * j]) / 512 + 100;
}
rotation_3d (&x, &y, &z, alpha, beta, gamma);
perspective (&x, &y, &z, persp,
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JESS-2.9.1.tar.gz (39个子文件)
JESS-2.9.1
missing 9KB
distorsion.h 467B
ltmain.sh 135KB
COPYING 18KB
renderer.c 11KB
aclocal.m4 144KB
draw_low_level.h 955B
INSTALL 8KB
projection.h 157B
draw.h 867B
draw.c 22KB
mkinstalldirs 722B
palette.c 3KB
renderer.h 339B
configure 200KB
projection.c 587B
analyser.h 279B
ChangeLog 1B
struct.h 469B
install-sh 5KB
Makefile.in 12KB
depcomp 12KB
configure.in 705B
AUTHORS 48B
analyser.c 3KB
misc.h 21B
config.guess 38KB
distorsion.c 3KB
README 2KB
config.sub 27KB
palette.h 90B
NEWS 958B
draw_low_level.c 9KB
analyser_struct.h 620B
def.h 779B
jess.h 144B
jess.c 8KB
Makefile.am 465B
misc.c 4KB
共 39 条
- 1
资源评论
- starwishzl2012-10-05经验证可用啊,多谢分享,刚开始用不了,后来不知道怎么的就可以了。还是推荐一个
- 张杰52572012-06-06Jess安装包,网上资源不多的,可以用于SWRL的推理,不错
gzc040882
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功