11#include "arcane/IApplication.h"
12#include "arcane/IParallelMng.h"
13#include "arcane/FactoryService.h"
14#include "arcane/ServiceFinder2.h"
15#include "arcane/SharedVariable.h"
16#include "arcane/CommonVariables.h"
17#include "arcane/utils/ScopedPtr.h"
18#include "arcane/AbstractService.h"
20#include "arcane/AbstractService.h"
22#include "arcane/hyoda/HyodaIceT.h"
24#include <IceTConfig.h>
32void ppmWrite(
const char *filename,
33 const unsigned char *image,
34 int width,
int height){
36 const unsigned char *color;
37 fd = fopen(filename,
"wb");
39 fprintf(fd,
"%d %d\n", width, height);
41 for(
int y = height-1; y >= 0; y--) {
42 color = image + y*width*4;
43 for(
int x = 0; x < width; x++) {
44 fwrite(color, 1, 3, fd);
60void HyodaIceT::gluSphere(
float radius,
int slices,
int stacks){
61 GLUquadric *q = gluNewQuadric();
62 gluQuadricNormals(q, GLU_SMOOTH);
63 ::gluSphere(q, radius, slices, stacks);
68void HyodaIceT::gluCone(
float base,
float height,
int slices,
int stacks){
69 GLUquadric *q = gluNewQuadric();
70 gluQuadricDrawStyle(q, GLU_FILL);
71 gluQuadricNormals(q, GLU_SMOOTH);
72 gluCylinder(q, base, 0.0, height, slices, stacks);
77void HyodaIceT::gluTorus(
float innerRadius,
float outerRadius,
int sides,
int rings){
79 GLfloat theta, phi, theta1;
80 GLfloat cosTheta, sinTheta;
81 GLfloat cosTheta1, sinTheta1;
82 const GLfloat ringDelta = 2.0 * M_PI / rings;
83 const GLfloat sideDelta = 2.0 * M_PI / sides;
88 for (i = rings - 1; i >= 0; i--) {
89 theta1 = theta + ringDelta;
90 cosTheta1 = cos(theta1);
91 sinTheta1 = sin(theta1);
92 glBegin(GL_QUAD_STRIP);
94 for (j = sides; j >= 0; j--) {
95 GLfloat cosPhi, sinPhi, dist;
100 dist = outerRadius + innerRadius * cosPhi;
102 glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
103 glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, innerRadius * sinPhi);
104 glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
105 glVertex3f(cosTheta * dist, -sinTheta * dist, innerRadius * sinPhi);
109 cosTheta = cosTheta1;
110 sinTheta = sinTheta1;
115void HyodaIceT::renderSphereConeTorus(
void){
116 GLfloat red_mat[] = { 1.0, 0.2, 0.2, 1.0 };
117 GLfloat green_mat[] = { 0.2, 1.0, 0.2, 1.0 };
118 GLfloat blue_mat[] = { 0.2, 0.2, 1.0, 1.0 };
120 glRotatef(20.0, 1.0, 0.0, 0.0);
123 glTranslatef(-0.75, 0.5, 0.0);
124 glRotatef(90.0, 1.0, 0.0, 0.0);
125 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red_mat );
126 gluTorus(0.275, 0.85, 20, 20);
130 glTranslatef(-0.75, -0.5, 0.0);
131 glRotatef(270.0, 1.0, 0.0, 0.0);
132 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, green_mat );
133 gluCone(1.0, 2.0, 16, 1);
137 glTranslatef(0.75, 0.0, -1.0);
138 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
139 gluSphere(1.0, 20, 20);
150#define ACTIVE_COLOR(x, y) ((((x) & 0xFFFF) | 0x8000) | ((((y) & 0xFFFF) | 0x8000) << 16))
151void HyodaIceT::LowerTriangleImage(
void *img){
152 IceTImage image=*(IceTImage*)(&img);
154 IceTUByte *data = icetImageGetColorub(image);
155 IceTSizeType width = icetImageGetWidth(image);
156 IceTSizeType height = icetImageGetHeight(image);
159 for (y = 0; y < height; y++) {
160 for (x = 0; x < width; x++) {
161 if (x < (height-y)) {
162 data[0] = ACTIVE_COLOR(x, y);
170void HyodaIceT::UpperTriangleImage(
void *img){
171 IceTImage image=*(IceTImage*)(&img);
173 IceTUByte *data = icetImageGetColorub(image);
174 IceTSizeType width = icetImageGetWidth(image);
175 IceTSizeType height = icetImageGetHeight(image);
178 for (y = 0; y < height; y++) {
179 for (x = 0; x < width; x++) {
180 if ((height-y) < x) {
181 data[0] = ACTIVE_COLOR(x, y);
Fichier de configuration d'Arcane.