OpenCores
URL https://opencores.org/ocsvn/wf3d/wf3d/trunk

Subversion Repositories wf3d

[/] [wf3d/] [trunk/] [demo_app/] [main_hand.c] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 specular
//=======================================================================
2
// Project Monophony
3
//   Wire-Frame 3D Graphics Accelerator IP Core
4
//
5
// File:
6
//   main_hand.c
7
//
8
// Abstract:
9
//   Hand animation sample (without skinning).
10
//
11
// Author:
12 4 specular
//   Kenji Ishimaru (info.wf3d@gmail.com)
13 2 specular
//
14
//======================================================================
15
//
16
// Copyright (c) 2015, Kenji Ishimaru
17
// All rights reserved.
18
//
19
// Redistribution and use in source and binary forms, with or without
20
// modification, are permitted provided that the following conditions are met:
21
//
22
//  -Redistributions of source code must retain the above copyright notice,
23
//   this list of conditions and the following disclaimer.
24
//  -Redistributions in binary form must reproduce the above copyright notice,
25
//   this list of conditions and the following disclaimer in the documentation
26
//   and/or other materials provided with the distribution.
27
//
28
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
//
40
// Revision History
41
 
42 4 specular
#include "mp_hwdep.h"
43
#include "mp_lib.h"
44 2 specular
#include <stdio.h>
45
 
46
#include "hand_full.h"
47
 
48
void mp_loop() {
49
  static float transY = 0.0f;
50
  static int cframe = 1;
51
  static float cScale = 4.0;
52
  int i,j;
53
  int frame  = 0;
54
  int mat_index = 0;
55
  mpClearColor(0.0, 0.25, 0.5);
56
  mpViewport(640, 480);
57
  mpMatrixMode(MP_PROJECTION);
58
  mpLoadIdentity();
59
  mpPerspective(30.0, 4.0 / 3.0, 1, 100);
60
  mpMatrixMode(MP_MODELVIEW);
61
  mpLoadIdentity();
62
  mpLookAt(0, 0, 1, 0, 0, -100, 0, 1, 0);
63
  mpTranslate(0.0,0.0,-10);
64
  mpTranslate(-1.0,2.0,0.0);
65
  mpScale(10.0,10.0,10.0);
66
  //mpRotatef(180.0,1,0,0);
67
  while(1) {
68
    printf("frame %d\n",frame++);
69
    mpClear();
70
    mpRenderColor(1.0,0.85,0.85);
71
    for (j=0; j<num_of_draws;j++) {
72
      mpMatrixMode(MP_MODELVIEW);
73
      mpPushMatrix();
74
      mat_index = weight_matrix_reference[j][0];
75
      mpMultMatrix ((matrix_index[mat_index])[cframe]);
76
      mpVertexPointer(vtx_array_index[j]);
77
      mpDrawArrays(num_of_tri_array_index[j]*3);
78
      mpPopMatrix();
79
    }
80
    cframe++;
81
    if (cframe >= num_of_frames) cframe = 1;
82
    mpSwapBuffers();
83
  }
84
}
85
 
86
int main()
87
{
88
 
89 4 specular
  printf("Hand Demo\n");
90 5 specular
  mpInit();
91 2 specular
  buffer_clear(0x00000000,0);
92
  buffer_clear(0x00000000,1);
93
  mp_loop();
94
  return 0;
95
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.