请.ime是什么文件?

honker110 2006-06-21 10:36:12
注意,不是windows的输入法,而是一个OpenGL程序用到的,*.ime
我觉得应该是程序里一个人物模型相关的文件,想改一下,不知道这个文件怎么编辑,用什么编辑?或是用什么生成的?
请各位高手不吝赐教!
...全文
2106 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
honker110 2006-06-21
  • 打赏
  • 举报
回复
文件开头

00000000h: 69 6D 65 20 0A 00 00 00 15 03 00 00 20 00 00 00 ; ime ........ ...
00000010h: 15 03 00 00 FC B9 00 00 B9 02 00 00 50 C6 00 00 ; ......?..P?.
00000020h: 18 26 F3 BD 45 91 26 BE B5 3E 41 3F F0 94 CD 3E ; .&蠼E?镜>A?饠?
00000030h: 40 CF 01 3F C6 5B 41 3F DD 07 7B 12 4A F5 8A 24 ; @??芠A??{.J鯅$
00000040h: 6D 15 73 F5 B3 3A 99 1D 1A F4 9E 07 E8 12 0F 0A ; m.s醭:?.魹.?..
00000050h: FB 16 E5 11 36 06 B1 2C 8D 18 58 0A EE 06 04 09 ; ??6.??X.?..
00000060h: 8F 35 22 24 F0 08 87 35 CB 3D AB 19 97 29 DF 06 ; ?"$??????
00000070h: F9 17 C4 4A 36 24 7B 1A 05 49 70 43 8E 1B C0 44 ; ?腏6${..IpC?繢
00000080h: 86 07 26 34 6D F3 A4 24 08 43 F5 F9 D1 3A A3 37 ; ?&4m螭$.C貔??
00000090h: AF F7 5E 07 50 39 88 08 FA 16 90 38 48 07 C4 2C ; ^.P9???H.?
000000a0h: 59 2F F4 0B E4 06 67 44 00 37 26 24 46 44 DD 36 ; Y/??gD.7&$FD?
000000b0h: C1 3D E7 38 83 29 E7 06 C9 37 42 4C 4B 24 3F 36 ; ?????BLK$?6
000000c0h: E7 49 CF 44 A6 34 EF 44 20 0C 2C 1D BD D8 44 20 ; 鏘螪?顳 .,.截D
honker110 2006-06-21
  • 打赏
  • 举报
回复
lixiaosan(小三) ( ) 信誉:150 2006-06-21 10:52:00 得分: 0


难道这个ime是某opengl程序自己定义的文件格式,




我也有点这种感觉,希望不是这样
lixiaosan 2006-06-21
  • 打赏
  • 举报
回复
难道这个ime是某opengl程序自己定义的文件格式,
honker110 2006-06-21
  • 打赏
  • 举报
回复
LoadIme.c




/* load ime file (interpolated mesh)
*
* written by Alexander Zaprjagaev
* frustum@public.tsu.ru
* 2:5005/93.15@FidoNet
*/

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

static struct
{
int header;
int num_frame;
int num_vertex;
int offset_vertex;
int num_uvmap;
int offset_uvmap;
int num_face;
int offset_indices;
} header_l;

static void calcnormals(float *vertex,float *normal,short *indices)
{
float a[3],b[3],n[3],length,ilength;
int i,j,k,l;
for(i = 0; i < header_l.num_vertex * 3; i++)
{
normal[i] = 0;
}
for(i = 0; i < header_l.num_face * 3; i += 3)
{
j = indices[i] * 3;
k = indices[i + 1] * 3;
l = indices[i + 2] * 3;
a[0] = vertex[k] - vertex[j];
b[0] = vertex[l] - vertex[j];
a[1] = vertex[k + 1] - vertex[j + 1];
b[1] = vertex[l + 1] - vertex[j + 1];
a[2] = vertex[k + 2] - vertex[j + 2];
b[2] = vertex[l + 2] - vertex[j + 2];
n[0] = a[1] * b[2] - a[2] * b[1];
n[1] = a[2] * b[0] - a[0] * b[2];
n[2] = a[0] * b[1] - a[1] * b[0];
length = sqrt(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
if(length != 0.0)
{
ilength = 1.0 / length;
n[0] *= ilength;
n[1] *= ilength;
n[2] *= ilength;
}
normal[j] += n[0];
normal[k] += n[0];
normal[l] += n[0];
normal[j + 1] += n[1];
normal[k + 1] += n[1];
normal[l + 1] += n[1];
normal[j + 2] += n[2];
normal[k + 2] += n[2];
normal[l + 2] += n[2];
}
for(i = 0, j = 0; i < header_l.num_vertex; i++, j += 3)
{
length = sqrt(normal[j] * normal[j] +
normal[j + 1] * normal[j + 1] +
normal[j + 2] * normal[j + 2]);
if(length != 0.0)
{
ilength = 1.0 / length;
normal[j] *= ilength;
normal[j + 1] *= ilength;
normal[j + 2] *= ilength;
}
}
}

static void createmesh(float *vertex,float *normal,float *uvmap,short *indices,float *object)
{
int i,j,k,l;
for(i = 0; i < header_l.num_face; i++)
for(j = 0; j < 3; j++)
{
k = i * 3 + j;
l = k * 8;
object[l + 0] = vertex[indices[k] * 3 + 0];
object[l + 1] = vertex[indices[k] * 3 + 1];
object[l + 2] = vertex[indices[k] * 3 + 2];
object[l + 3] = normal[indices[k] * 3 + 0];
object[l + 4] = normal[indices[k] * 3 + 1];
object[l + 5] = normal[indices[k] * 3 + 2];
object[l + 6] = uvmap[indices[k] * 2 + 0];
object[l + 7] = uvmap[indices[k] * 2 + 1];
}
}

static void loadime(FILE *file,float **object)
{
int i,j;
float move[3],scale[3];
float *vertex,*normal,*uvmap;
short *buffer,*indices;
vertex = (float*)malloc(sizeof(float) * header_l.num_vertex * 3);
normal = (float*)malloc(sizeof(float) * header_l.num_vertex * 3);
uvmap = (float*)malloc(sizeof(float) * header_l.num_uvmap * 2);
buffer = (short*)malloc(sizeof(short) * header_l.num_face * 3 * 3);
indices = (short*)malloc(sizeof(short) * header_l.num_face * 3);
fseek(file,header_l.offset_indices,SEEK_SET); // load indices
fread(indices,sizeof(short) * header_l.num_face * 3,1,file);
fseek(file,header_l.offset_uvmap,SEEK_SET); // load uvmap
fread(buffer,sizeof(short) * header_l.num_uvmap * 2,1,file);
for(i = 0; i < header_l.num_uvmap * 2; i += 2)
{
uvmap[i + 0] = (float)buffer[i + 0] / 32767.0;
uvmap[i + 1] = (float)buffer[i + 1] / 32767.0;
}
fseek(file,header_l.offset_vertex,SEEK_SET); // load vertex and create mesh
for(i = 0; i < header_l.num_frame; i++)
{
fread(move,sizeof(float),3,file);
fread(scale,sizeof(float),3,file);
fread(buffer,sizeof(short) * header_l.num_vertex * 3,1,file);
for(j = 0; j < header_l.num_vertex * 3; j += 3)
{
vertex[j + 0] = (float)buffer[j + 0] / 32767.0 * scale[0] + move[0];
vertex[j + 1] = (float)buffer[j + 1] / 32767.0 * scale[1] + move[1];
vertex[j + 2] = (float)buffer[j + 2] / 32767.0 * scale[2] + move[2];
}
calcnormals(vertex,normal,indices);
createmesh(vertex,normal,uvmap,indices,object[i]);
}
free(indices);
free(buffer);
free(uvmap);
free(normal);
free(vertex);
}

float **LoadIME(char *name,int *num_vertex,int *num_frame)
{
int i;
float **object;
FILE *file;
file = fopen(name,"rb");
if(!file) return NULL;
fread(&header_l,sizeof(header_l),1,file);
object = (float**)malloc(sizeof(float*) * header_l.num_frame);
if(!object)
{
fclose(file);
return NULL;
}
for(i = 0; i < header_l.num_frame; i++)
{
object[i] = (float*)malloc(sizeof(float) * header_l.num_face * 8 * 3);
if(!object[i])
{
fclose(file);
return NULL;
}
}
loadime(file,object);
fclose(file);
*num_vertex = header_l.num_face * 3;
*num_frame = header_l.num_frame;
return object;
}
honker110 2006-06-21
  • 打赏
  • 举报
回复
LoadIme.h




/* load ime file (interpolated mesh)
*
* written by Alexander Zaprjagaev
* frustum@public.tsu.ru
* 2:5005/93.15@FidoNet
*/

#ifndef __LOADIME_H__
#define __LOADIME_H__

// total 8 floats
// 1,2,3 - vertex
// 3,4,5 - normal
// 6,7 - texture coordinate

float **LoadIME(char *name,int *num_vertex,int *num_frame);

#endif /* __LOADIME_H__ */
wangk 2006-06-21
  • 打赏
  • 举报
回复
应该是OpenGL程序内部使用的数据结构,甚至很难知道数据有没有进过压缩,除非有读写该类型文件的代码,否则是很难分析出文件格式的。

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧