Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

21

21.07.2010, 12:51

Eben! ;)

Ambient meinte ich nicht, sondern die Farbe bei Clear.
Kannst du den gesamten Code vielleicht mal irgendwo posten?
fka tm

Harry222

Alter Hase

  • »Harry222« ist der Autor dieses Themas

Beiträge: 864

Beruf: Student

  • Private Nachricht senden

22

21.07.2010, 13:17

1. Welche Auswirkungen hat den die Farbe, die Man bei Clear angeben muss eigentlich?
2. Brauchst du nur die Vollständige Pin- und Intro-Klasse oder auch noch die VierGewinnt-Klasse? (Ich habe das Spiel wie bei Breakanoid aufgebaut!)

23

21.07.2010, 13:25

1. Keine, eigentlich. Hintergrundfarbe halt. ;) Außer, dass du siehst, ob dein Programm auch brav rendert.

2. Eigentlich alles. Hierher zum Beispiel: file-upload.net
fka tm

Harry222

Alter Hase

  • »Harry222« ist der Autor dieses Themas

Beiträge: 864

Beruf: Student

  • Private Nachricht senden

24

21.07.2010, 13:55

Schon mal Danke!
Ich habe mal die Farbe bei Clear auf weiß geändert und man kann tatsächlich am oberen Bildrand einen Pin flimmern sehen. Allerdings flimmert der Pin nur und wenn ich das Levelmodell dann auch noch rendern will startet das Programm wieder nicht richtig!
Deshalb habe ich auch mal die Model.tbm Datei als Zip-Archiv hochgeladen. Versuch mal bitte, ob du sie rendern kannst!
Außerdem bitte ich dich, dir mal meinen vollständigen Code der Pin- und Intro-Klasse anzugucken! Die VierGewinnt Klasse hielt ich jetzt für nich so wichtig, da sie nur ein paar Sachen lädt, die nich für das Intro relevant sind und dann halt in der Nachrichtenschleife die Render und Move Funktionen vom Intro aufruft!

Hier ist der Code:

C-/C++-Quelltext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
//Intro.h

#ifndef _INTRO_INC_
#define _INTRO_INC_

class CIntro{
public:
    CIntro();
    ~CIntro();
    tbResult Init();
    tbResult Load();
    tbResult Unload();
    tbResult Exit();
    tbResult Move(float fTime);
    tbResult Render(float fTime);

    //vergangene Zeit seit Zustandsbeginn
    float m_fTime;

    //Das Levelmodel
    tbModel m_vLevelModel;
};

#endif

//Intro.cpp

#include "VierGewinnt.h"

CIntro::CIntro(){}

CIntro::~CIntro(){}

tbResult CIntro::Init(){
    TB_INFO("Initalisiere das Intro!");

    //Direct3D
    tbDirect3D &D3D = tbDirect3D::Instance();

    //CPin
    CPin &Pin = CPin::Instance();

    //Zeit Variable auf Null setzen
    m_fTimeSEnd = 0.0f;

    //Weltmatrix setzen
    tbMatrix mWorld = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
    D3D.SetTransform(D3DTS_WORLD, mWorld);

    //Sichtmatrix setzen
    tbMatrix mView = tbMatrixTranslation(tbVector3(0.0f, 2.0f, -3.0f));
    D3D.SetTransform(D3DTS_VIEW, mView);

    //Modelle laden
    if(Load()){
        return TB_ERROR;
    }
    
    //Pins initalisieren
    int Pos;
    Pos = CPin::Instance().GetNextFreePlace();
    m_dEndPinPos[0] = Pos;
    Pin.AddPin(Pos,5,1);
    Pin.SetColor(Pos, FALSE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,5,2);
    Pin.SetColor(Pos, FALSE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,5,3);
    Pin.SetColor(Pos, TRUE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,5,4);
    Pin.SetColor(Pos, TRUE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,5,5);
    Pin.SetColor(Pos, TRUE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,5,6);
    Pin.SetColor(Pos, FALSE);
    m_dEndPinPos[1] = Pos;
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,4,2);
    Pin.SetColor(Pos, FALSE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,4,3);
    Pin.SetColor(Pos, TRUE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,4,4);
    Pin.SetColor(Pos, TRUE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,4,5);
    Pin.SetColor(Pos, FALSE);
    m_dEndPinPos[2] = Pos;
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,3,3);
    Pin.SetColor(Pos, FALSE);
    Pos = Pin.GetNextFreePlace();
    Pin.AddPin(Pos,3,4);
    Pin.SetColor(Pos, TRUE);
    m_dStartPinPos = Pin.GetNextFreePlace();
    m_dEndPinPos[3] = Pos;
    Pin.AddPin(m_dStartPinPos,0,0);
    Pin.SetColor(m_dStartPinPos, FALSE);
    Pin.SetPosition(m_dStartPinPos,2,4,FALSE);

    TB_INFO("Initalisierung des Intros beendet!");

    return TB_OK;
}

tbResult CIntro::Load(){
    //Modelle laden
    if(m_vLevelModel.Init("Model.tbm")){
        //Fehler!
        TB_ERROR("Das Levelmodel konnte nicht geladen werden!", TB_ERROR);
    }

    return TB_OK;
}

tbResult CIntro::Unload(){
    //Modelle entladen
    if(m_vLevelModel.Exit()){
        //Fehler!
        TB_ERROR("Das Levelmodel konnte nicht entladen werden!", TB_ERROR);
    }

    return TB_OK;
}

tbResult CIntro::Exit(){
    //Modelle entladen
    return Unload();
}

tbResult CIntro::Move(float fTime){
    m_fTime+=fTime;

    CPin::Instance().Move(fTime);

    return TB_OK;
}

tbResult CIntro::Render(float fTime){
    //Direct3D
    tbDirect3D &D3D = tbDirect3D::Instance();

    //Es Gibt ein Lichter
    D3DLIGHT9 m_pLight;

    //Material
    D3DMATERIAL9 xMaterial;

        D3D->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, tbColor(1.0f), 1.0f, 0);
    D3D->BeginScene();

    //Sichtmatrix setzen
        tbMatrix mView = tbMatrixTranslation(tbVector3(0.0f, 2.0f, -3.0f)) * tbMatrixRotationY(90.0f * m_fTime);
    D3D.SetTransform(D3DTS_VIEW, mView);

    // Die Projektionsmatrix erzeugen und einsetzen.
        tbMatrix mProjection = tbMatrixProjection(TB_DEG_TO_RAD(70.0f), 
        tbDirect3D::Instance().GetAspect(), 0.1f, 100.0f);
        tbDirect3D::Instance()->SetTransform(D3DTS_PROJECTION, (D3DMATRIX*)(&mProjection));

    //Sichtmatrix setzen
    tbMatrix mWorld = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
    D3D.SetTransform(D3DTS_WORLD, mWorld);

    // Render-States
    D3D.SetRS(D3DRS_FILLMODE, D3DFILL_SOLID);
    D3D.SetRS(D3DRS_AMBIENT, tbColor(1.0f, 1.0f, 1.0f));
    D3D.SetRS(D3DRS_LIGHTING, TRUE);
    D3D.SetRS(D3DRS_CULLMODE, D3DCULL_NONE);
    D3D.SetRS(D3DRS_ZENABLE, TRUE);
    D3D.SetRS(D3DRS_ZWRITEENABLE, TRUE);
    D3D.Capture();

    ZeroMemory(&m_pLight, sizeof(D3DLIGHT9));
    m_pLight.Type = D3DLIGHT_POINT;
    m_pLight.Diffuse = tbColor(1.0f, 1.0f, 1.0f);
    m_pLight.Ambient = tbColor(1.0f, 1.0f, 1.0f);
    m_pLight.Specular = tbColor(1.0f, 1.0f, 1.0f);

    m_pLight.Position = tbVector3(0.0f, 2.0f, -3.0f);
    m_pLight.Range = 1000.0f;
    m_pLight.Attenuation0 = 0.0f;
    m_pLight.Attenuation1 = 0.25f;
    m_pLight.Attenuation2 = 0.0f;

    D3D->SetLight(0, &m_pLight);
    D3D->LightEnable(0, TRUE);

    xMaterial.Diffuse = tbColor(0.75f,0.75f,0.75f);
    xMaterial.Ambient = tbColor(0.25f,0.25f,0.25f);
    xMaterial.Emissive = tbColor(0.0f,0.0f,0.0f);
    xMaterial.Specular = tbColor(0.25f,0.25f,0.25f);
    xMaterial.Power = 5.0f;
    D3D->SetMaterial(&xMaterial);

    m_vLevelModel.Render();

    CPin::Instance().Render(fTime);

    D3D->EndScene();

    return TB_OK;
}

//Pin.h

#ifndef _PIN_INC_
#define _PIN_INC_

class CPin{
public:
    CPin();
    ~CPin();

    static CPin& Instance();

    tbResult Init();
    tbResult Load();
    tbResult Unload();
    tbResult Exit();
    int GetNextFreePlace();
    tbResult AddPin(int Place, int Zeile, int Spalte);
    tbResult SetColor(int Place, BOOL Color);
    tbResult SetRotation(int Place, BOOL Rotate);
    tbResult SetPosition(int Place, int Zeile, int Spalte,BOOL Sofort);
    tbResult Move(float fTime);
    tbResult Render(float fTime);

    //Ist Initalisiert?
    BOOL m_bInitialized;

    //Positionen der Pins
    tbVector3 m_vPosition[35];

    //Matrizen für die Pin-Modelle
    tbMatrix m_vPin1Matrix[35];
    tbMatrix m_vPin2Matrix[35];

    //Weerden die Position von den Pins gewechselt?
    BOOL m_bPosChange[35];
    float m_fTimeSinceStart[35];
    tbVector3 m_vEndPos[35];
    tbVector2 m_vWay[35];

    //Erxisitieren die Pins
    BOOL m_bExist[35];

    //Rotieren die Pins gerade?
    BOOL m_bRotate[35];

    //Wie lange rotieren sie schon?
    float m_fRotationTime[35];

    //Farbe - FALSE = SCHWARZ ; TRUE = WEIS
    BOOL m_bColor[35];

    //Pin Modelle
    tbModel m_vPinModelWhite1;
    tbModel m_vPinModelWhite2;
    tbModel m_vPinModelBlack1;
    tbModel m_vPinModelBlack2;
};

#endif

//Pin.cpp

#include "VierGewinnt.h"

CPin& CPin::Instance(){
    static CPin TheOneAndOnly;
    return TheOneAndOnly;
}

CPin::CPin(){}

CPin::~CPin(){
    if(m_bInitialized){
        CPin::Instance().Exit();
    }
}

tbResult CPin::Init(){
    TB_INFO("CPin wird initalisiert!");

    //Modelle laden
    if(Load()){
        return TB_ERROR;
    }

    for(int i=0;i<=34;i++){
        m_vPosition[i] = tbVector3(0.0f, 0.0f, 0.0f);
        m_vPin1Matrix[i] = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
        m_vPin2Matrix[i] = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
        m_bPosChange[i] = FALSE;
        m_fTimeSinceStart[i] = 0.0f;
        m_vEndPos[i] = tbVector3(0.0f, 0.0f, 0.0f);
        m_vWay[i] = tbVector2(0.0f, 0.0f);
        m_bExist[i] = FALSE;
        m_bRotate[i] = FALSE;
        m_fRotationTime[i] = 0.0f;
    }

    //Ist Initalisiert?
    BOOL m_bInitialized = TRUE;

    TB_INFO("CPin initalisiert!");

    return TB_OK;
}

tbResult CPin::Load(){
    //Modelle laden
    if(m_vPinModelWhite1.Init("PinWhite1.tbm")){
        //Fehler!
        TB_ERROR("Das weiße Pinmodel 1 konnte nicht geladen werden!", 
TB_ERROR);
        return TB_ERROR;
    }
    if(m_vPinModelWhite2.Init("PinWhite2.tbm")){
        //Fehler!
        TB_ERROR("Das weiße Pinmodel 2 konnte nicht geladen werden!", 
TB_ERROR);
        return TB_ERROR;
    }
    if(m_vPinModelBlack1.Init("PinBlack1.tbm")){
        //Fehler!
        TB_ERROR("Das schwarze Pinmodel 1 konnte nicht geladen werden!", 
TB_ERROR);
        return TB_ERROR;
    }
    if(m_vPinModelBlack2.Init("PinBlack2.tbm")){
        //Fehler!
        TB_ERROR("Das schwarze Pinmodel 2 konnte nicht geladen werden!", 
TB_ERROR);
        return TB_ERROR;
    }

    return TB_OK;
}

tbResult CPin::Unload(){
    //Pin Modelle entladen
    if(m_vPinModelWhite1.Exit()){
        TB_ERROR("Das weiße Pinmodel 1 konnte nicht entladen werden!", 
TB_ERROR);
    }
    if(m_vPinModelWhite2.Exit()){
        TB_ERROR("Das weiße Pinmodel 1 konnte nicht entladen werden!", 
TB_ERROR);
    }
    if(m_vPinModelBlack1.Exit()){
        TB_ERROR("Das schwarze Pinmodel 1 konnte nicht entladen werden!", 
TB_ERROR);
    }
    if(m_vPinModelBlack2.Exit()){
        TB_ERROR("Das schwarze Pinmodel 1 konnte nicht entladen werden!", 
TB_ERROR);
    }

    return TB_OK;
}

tbResult CPin::Exit(){
    TB_INFO("CPin wird heruntergefahren!");

    //Alles entladen
    if(Unload()){
        return TB_ERROR;
    }

    //CPin heruntergefahren
    m_bInitialized = FALSE;

    TB_INFO("CPin ist heruntergefahren!");

    return TB_OK;
}

int CPin::GetNextFreePlace(){
    for(int i=0;i<=34;i++){
        if(m_bExist[i] == FALSE){
            return i;
        }
    }
    return TB_ERROR;
}

tbResult CPin::AddPin(int Place, int Zeile, int Spalte){
    //Position ist nicht ausserhalb des Feldes!
    if(Zeile>5||Spalte>6){
        return TB_ERROR;
    }

    //Position 0/0
    float x = -1.5;
    float y = 3.25;
    float z = 0.0f;

    //Übergebene Position hinzuberechenen
    x+=(float)(Zeile*0.5);
    y+=(float)(Spalte*0.5);

    m_vPosition[Place] = tbVector3(x, y, z);
    m_vPin1Matrix[Place] = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
    m_vPin2Matrix[Place] = tbMatrixTranslation(tbVector3(0.0f, 0.0f, 0.0f));
    m_bPosChange[Place] = FALSE;
    m_fTimeSinceStart[Place] = 0.0f;
    m_vEndPos[Place] = tbVector3(0.0f, 0.0f, 0.0f);
    m_vWay[Place] = tbVector2(0.0f, 0.0f);
    m_bExist[Place] = TRUE;
    m_bRotate[Place] = FALSE;
    m_fRotationTime[Place] = 0.0f;
    return TB_OK;
}

tbResult CPin::SetColor(int Place, BOOL Color){
    //Farbe wird geändert
    m_bColor[Place] = Color;
    return TB_OK;
}

tbResult CPin::SetRotation(int Place, BOOL Rotate){
    if(m_bRotate[Place] == Rotate){
        //Es brauchen keine Änderungen vorgenommen werden!
        return TB_OK;
    }

    //Zeit der Rotation wird zurückgesetzt
    m_fRotationTime[Place] = 0.0f;

    //Neue Rotation setzen
    m_bRotate[Place] = Rotate;
    return TB_OK;
}

tbResult CPin::SetPosition(int Place, int Zeile, int Spalte,BOOL Sofort){
    //Position ist nicht ausserhalb des Feldes!
    if(Zeile>5||Spalte>6){
        return TB_ERROR;
    }

    //Position 0/0
    float x = -1.5;
    float y = 3.25;
    float z = 0.0f;

    //Übergebene Position hinzuberechenen
    x+=(float)(Zeile*0.5);
    y+=(float)(Spalte*0.5);

    //Soll es einen Positionsübergang geben?
    if(Sofort==FALSE){
        //Position setzen
        m_vEndPos[Place] = tbVector3(x,y,z);

        //In der Move Funktion muss der Positionsübergang berechnet werden!
        m_bPosChange[Place] = TRUE;

        //Zeit Variable zurücksetzen
        m_fTimeSinceStart[Place] = 0.0f;

        //Weg berechnen
        m_vWay[Place].x = m_vEndPos[Place].x-m_vPosition[Place].x;
        m_vWay[Place].y = m_vEndPos[Place].y-m_vPosition[Place].y;
    }
    else{
        //Position setzen
        m_vPosition[Place] = tbVector3(x,y,z);

        //Die Position wurde sofort geändert
        //Es muss kein Übergang berechnet werden
        m_bPosChange[Place] = FALSE;
    }

    return TB_OK;
}

tbResult CPin::Move(float fTime){
    //Alle Pins durchgehen
    for(int i=0;i<=34;i++){
        //Findet gerade ein Positionsübergang statt?
        if(m_bPosChange[i] == TRUE){
            m_fTimeSinceStart[i]+=fTime;
            if(m_fTimeSinceStart[i] > 1.0f){
                m_bPosChange[i] = FALSE;
                m_vPosition[i] = m_vEndPos[i];
            }
            else{
                m_vPosition[i].x += (m_vWay[i].x * m_fTimeSinceStart[i]);
                m_vPosition[i].y += (m_vWay[i].y * m_fTimeSinceStart[i]);
            }
        }
        if(m_bRotate[i] == TRUE){
            //Matrizen für die Pinbewegung berechnen
            m_vPin1Matrix[i] = tbMatrixRotationX(90.0f * m_fRotationTime[i]);
            m_vPin2Matrix[i] = tbMatrixRotationY(30.0f * m_fRotationTime[i]);
        }
        else{
            //Matrizen für die Pinbewegung berechnen
            m_vPin1Matrix[i] = tbMatrixRotationX(0);
            m_vPin2Matrix[i] = tbMatrixRotationY(0);
        }
    }

    return TB_OK;
}

tbResult CPin::Render(float fTime){
    //Direct3D
    tbDirect3D &D3D = tbDirect3D::Instance();

    //Variablen
    tbMatrix mOldWorld;
    tbMatrix mWorld;

    //Alte Weltmatrix speichern
    mOldWorld = D3D.GetTransform(D3DTS_WORLD);

    for(int i=0;i<=34;i++){
        //Neue Weltmatrix einsetzen
        mWorld = tbMatrixTranslation(m_vPosition[i]) * m_vPin1Matrix[i];
        D3D.SetTransform(D3DTS_WORLD, mWorld);

        //Pin zeichnen
        if(m_bColor[i] == TRUE){
            m_vPinModelWhite1.Render();
        }
        else{
            m_vPinModelBlack1.Render();
        }

        //Neue Weltmatrix einsetzen
        mWorld = tbMatrixTranslation(m_vPosition[i]) * m_vPin2Matrix[i];
        D3D.SetTransform(D3DTS_WORLD, mWorld);

        //Pin zeichnen
        if(m_bColor[i] == TRUE){
            m_vPinModelWhite2.Render();
        }
        else{
            m_vPinModelBlack2.Render();
        }
    }

    //Alte Weltmatrix einsetzen
    D3D.SetTransform(D3DTS_WORLD, mOldWorld);
    return TB_OK;
}


Außerdem ist noch zu beachten, dass das Modell, das ich hochgeladen habe keine materialeinstellungen im Effekt enthält!

PS: Ich glaube ich lag mit meiner Schätzung von 300 Zeilen Falsch!!!
»Harry222« hat folgende Datei angehängt:
  • Model.tbm.zip (12,57 kB - 47 mal heruntergeladen - zuletzt: 21.05.2024, 14:38)

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Harry222« (21.07.2010, 14:14)


CBenni::O

1x Contest-Sieger

Beiträge: 1 145

Wohnort: Stuttgart

  • Private Nachricht senden

25

21.07.2010, 14:05

Warum rotiert deine Kamera?

Und Clear wird immer noch nicht aufgerufen...

Beachte BITTE mal unsere Vorschläge!

mfg CBenni::O
Ein Mitglied der VEGeiCoUndGraSonMaWiGeS Bewegung.
42!
Aufräumen kann jeder, nur das Genie überblickt das Chaos!
Metal will never die!
1. Sppro Gamecontest - mein Beitrag

Harry222

Alter Hase

  • »Harry222« ist der Autor dieses Themas

Beiträge: 864

Beruf: Student

  • Private Nachricht senden

26

21.07.2010, 14:13

Ich muss hier sagen, dass Clear aufgerufen WIRD! Ich habe das in der Kopie, die ich gestern vom Quellcode gemacht habe und jetzt gerade wider benutzt habe nur noch nicht geändert, was mir ehrlich leid tut! Aber ich ACHTE schon auf eure Tipps und habe den Code jetzt nochmal verbessert!
Die Kamera routiert übrigens, weil ich wollte, dass man im Intro das Levelmodell, mit ein paar reingeworfenen Pins sieht und die Kamera sich um die ganze Szenerie drehen soll! Ich glaube übrigens, dass da das Flimmern von den Pins herkommt. Ich MUSS da irgendetwas falsch gemacht haben!

27

21.07.2010, 14:44

Kann die Modelldatei momentan nicht testen.
Vielleicht liegts auch "nur" an der?
Interessieren würde mich noch die Initialisierung des Device, Erstellung des Fensters und die komplette Clear-Methode (Codezeile).


Tipp:
Etwas sparsamer mit Ausrufezeichen umgehen :!: :!: :!: ;)
fka tm

Harry222

Alter Hase

  • »Harry222« ist der Autor dieses Themas

Beiträge: 864

Beruf: Student

  • Private Nachricht senden

28

21.07.2010, 15:00

Zuerst einmal ist hier die Codezeile, in der das Fenster erstellt wird:

C-/C++-Quelltext

1
2
3
4
5
// Direct3D initialisieren
if(tbDirect3D::Instance().Init(&m_Config, "Vier gewinnt", NULL, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)))){
    // Fehler!
       TB_ERROR("Fehler beim Initialisieren von Direct3D!", TB_ERROR);
}


Ich initalisiere einfach tbDirect3D. Das Fenster wird ja in dieser Funktion erstellt.

Die Clear-Funktion ist übrigens zwischen dem ganzen Quelltext, den ich oben eingetragen habe, aber ich führe sie trotzdem nochmal auf:

C-/C++-Quelltext

1
D3D->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, tbColor(1.0f), 1.0f, 0);


Mfg Harry222!

29

21.07.2010, 15:15

Würde das Modell noch mal neu erstellen bzw. ins TBM-Format konvertieren.

Kannst du mal die 3ds-Datei hochladen?
fka tm

Harry222

Alter Hase

  • »Harry222« ist der Autor dieses Themas

Beiträge: 864

Beruf: Student

  • Private Nachricht senden

30

21.07.2010, 15:28

Ich habe das Modell nochmal konvertiert. Funktioniert trotzdem nicht!
Aber das liegt irgendwie am Modell. Vielleicht hat es ja zu viele Vertizes.
Ich werde das Modell auf jeden Fall nochmal neu bauen.
Aber was ist den nun mit den Flimmernden Pins? Ich meine, sie werden ja ganz offensichtlich gerendert, aber flimmern so komisch.
Ich habe noch nicht herausgefunden wie ich das hinbekomme.

Okay, die 3ds ist jetzt auch hochgeladen! Habe sie übrigens mit Blender erstellt!

PS: Gibt es irgendwo eine Übersicht der Smilies?
»Harry222« hat folgende Datei angehängt:
  • Model.3ds.zip (10,28 kB - 47 mal heruntergeladen - zuletzt: 15.05.2024, 12:02)

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Harry222« (21.07.2010, 15:36)


Werbeanzeige