mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-22 18:39:18 +00:00
[DEL] in GRRLIB_3D.c All Light functions (uggly way to provide light imho)
[ADD] NEED_GRRLIB_FUNCTION a sample demo code that can be a base to code new functions !! i really need help on this !!
This commit is contained in:
parent
8f7e79ab29
commit
a46deda984
12 changed files with 10761 additions and 46 deletions
|
@ -25,7 +25,7 @@ THE SOFTWARE.
|
|||
#include <grrlib.h>
|
||||
|
||||
// User should not directly modify these
|
||||
static Mtx _GRR_view;
|
||||
Mtx _GRR_view; // Should be static as soon as all light functions needing this var will be in this file ;)
|
||||
static guVector _GRR_cam = {0.0F, 0.0F, 0.0F},
|
||||
_GRR_up = {0.0F, 1.0F, 0.0F},
|
||||
_GRR_look = {0.0F, 0.0F, -100.0F};
|
||||
|
@ -132,6 +132,13 @@ void GRRLIB_2dMode() {
|
|||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
|
||||
GX_SetNumTexGens(1); // One texture exists
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
|
||||
GX_SetNumTevStages(1);
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
|
||||
}
|
||||
|
||||
|
@ -198,48 +205,6 @@ void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep) {
|
|||
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise a diffuse light.
|
||||
* @param id A light ID in libogc style : GX_LIGHT0,..., GX_LIGHT7.
|
||||
* @param lpos A guVector x,y,z position of the light.
|
||||
* @param lcol Color of the light.
|
||||
*/
|
||||
void GRRLIB_InitLight(u8 id, guVector lpos, u32 lcol) {
|
||||
GXLightObj MyLight;
|
||||
guVecMultiply(_GRR_view, &lpos, &lpos);
|
||||
GX_InitLightPos(&MyLight, lpos.x, lpos.y, lpos.z);
|
||||
GX_InitLightColor(&MyLight, (GXColor) { R(lcol), G(lcol), B(lcol), A(lcol) });
|
||||
GX_InitLightAttn(&MyLight, 1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F);
|
||||
GX_LoadLightObj(&MyLight, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* All light off, colors come from the Vertex.
|
||||
*/
|
||||
void GRRLIB_LightOff(void) {
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what light to turn on and some other param.
|
||||
* @param id Light IDs of the desired switched ON lights (ORed) (ie GX_LIGHT0|GX_LIGHT7).
|
||||
* @param ambcol Ambiant color u32 formated
|
||||
* @param matcol Material color u32 formated.
|
||||
* @param colsrc Material color sources comes from the Vertex ???? (True/False)
|
||||
*/
|
||||
void GRRLIB_LightSwitch(u8 id, u32 ambcol, u32 matcol, u8 colsrc) {
|
||||
u8 src;
|
||||
if(colsrc==0) src = GX_SRC_REG;
|
||||
else src = GX_SRC_VTX;
|
||||
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_ENABLE, GX_SRC_REG, src, id, GX_DF_CLAMP, GX_AF_SPOT);
|
||||
GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { R(ambcol), G(ambcol), B(ambcol), A(ambcol)});
|
||||
GX_SetChanMatColor(GX_COLOR0A0, (GXColor) { R(matcol), G(matcol), B(matcol), A(matcol)});
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a torus (with normal).
|
||||
* @param r Radius of the ring.
|
||||
|
|
|
@ -147,9 +147,6 @@ void GRRLIB_3dMode(f32 minDist, f32 maxDist, f32 fov, bool colormode, bool textu
|
|||
void GRRLIB_2dMode();
|
||||
void GRRLIB_ObjectView(f32 posx, f32 posy, f32 posz, f32 angx, f32 angy, f32 angz, f32 scalx, f32 scaly, f32 scalz);
|
||||
void GRRLIB_SetTexture(GRRLIB_texImg *tex, bool rep);
|
||||
void GRRLIB_InitLight(u8 id, guVector lpos, u32 lcol);
|
||||
void GRRLIB_LightOff(void);
|
||||
void GRRLIB_LightSwitch(u8 id, u32 ambcol, u32 matcol, u8 colsrc);
|
||||
void GRRLIB_DrawTorus(f32 r, f32 R, int nsides, int rings, bool filled);
|
||||
void GRRLIB_DrawSphere(f32 r, int lats, int longs, bool filled);
|
||||
void GRRLIB_DrawCube(f32 size, bool filled);
|
||||
|
|
139
examples/NEED_GRRLIB_FUNCTION/Makefile
Normal file
139
examples/NEED_GRRLIB_FUNCTION/Makefile
Normal file
|
@ -0,0 +1,139 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/wii_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source source/gfx
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lgrrlib -l freetype -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(CURDIR)/$(GRRLIB)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
run:
|
||||
psoload $(TARGET).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
reload:
|
||||
psoload -r $(TARGET).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
105
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.c
Normal file
105
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
This file was autogenerated by raw2c.
|
||||
Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
const unsigned char font9x12[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x03, 0x58, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x68, 0x1c,
|
||||
0xd4, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
|
||||
0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7, 0x93,
|
||||
0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13,
|
||||
0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xda, 0x01,
|
||||
0x07, 0x0f, 0x37, 0x1a, 0xb9, 0xff, 0x9a, 0x93, 0x00, 0x00, 0x05, 0x87, 0x49, 0x44, 0x41, 0x54,
|
||||
0x78, 0xda, 0xed, 0x5d, 0x4d, 0xd2, 0xa4, 0x30, 0x08, 0xb5, 0x67, 0xe5, 0x11, 0x5d, 0x7a, 0x34,
|
||||
0x97, 0x1e, 0xd1, 0x5d, 0xcf, 0x2a, 0x55, 0x19, 0x26, 0x84, 0xc7, 0x4f, 0xa2, 0xdd, 0xcd, 0xab,
|
||||
0x9a, 0xaa, 0xf9, 0x34, 0x62, 0x02, 0x84, 0x40, 0xc0, 0xf4, 0xb2, 0x24, 0x12, 0x89, 0x44, 0x22,
|
||||
0x91, 0x48, 0x24, 0x12, 0x89, 0x44, 0xe2, 0x1e, 0x5c, 0xd7, 0xf5, 0xbe, 0xae, 0xeb, 0x8d, 0xdc,
|
||||
0x97, 0xda, 0x7a, 0xde, 0x85, 0x5e, 0x3f, 0x8e, 0x03, 0xea, 0x03, 0xd2, 0xd7, 0x42, 0xab, 0xf7,
|
||||
0xee, 0xeb, 0xba, 0xde, 0xc7, 0x71, 0xbc, 0x7f, 0x41, 0x0f, 0x38, 0xde, 0x70, 0xe3, 0x2f, 0xf7,
|
||||
0x5b, 0x3c, 0xa4, 0xf7, 0x5a, 0xb4, 0xb4, 0x6d, 0xb8, 0x6b, 0x1c, 0x1d, 0xfa, 0x5c, 0x3d, 0x26,
|
||||
0xae, 0x8d, 0xd4, 0x1f, 0x8e, 0x8e, 0xa5, 0xcd, 0x1d, 0xf3, 0x39, 0xca, 0x1e, 0x8c, 0xe6, 0x0f,
|
||||
0xa2, 0x1b, 0x88, 0x4c, 0xa3, 0xe8, 0x44, 0xb5, 0x41, 0xf4, 0x59, 0xba, 0x8e, 0xc8, 0x06, 0xa1,
|
||||
0xab, 0x79, 0x47, 0x94, 0xce, 0x8f, 0x94, 0xfb, 0x48, 0xfd, 0xe1, 0xda, 0x59, 0x6c, 0x54, 0xb4,
|
||||
0xbc, 0xbc, 0xef, 0xea, 0xe9, 0x33, 0xd7, 0xb6, 0xbe, 0x87, 0xd8, 0x35, 0xe9, 0x1d, 0xb4, 0xad,
|
||||
0xd7, 0x56, 0x6a, 0xe7, 0x4e, 0x22, 0x91, 0x78, 0x2e, 0x10, 0xbf, 0x3f, 0xc2, 0xae, 0xd4, 0x34,
|
||||
0xd0, 0x58, 0x63, 0x78, 0x80, 0x45, 0x0d, 0x2e, 0xb2, 0x38, 0xb7, 0x9e, 0x69, 0x19, 0x76, 0x8e,
|
||||
0xc9, 0x08, 0xb3, 0x7b, 0xcc, 0x94, 0x82, 0x2b, 0x4d, 0x90, 0x85, 0xf6, 0xe9, 0x53, 0x82, 0x2b,
|
||||
0x64, 0xd1, 0xd5, 0x38, 0x87, 0x9c, 0x93, 0xa3, 0x6d, 0xe3, 0x71, 0x16, 0x7a, 0x8e, 0x94, 0x14,
|
||||
0x60, 0xd5, 0xfd, 0xe9, 0xd1, 0xd1, 0xb4, 0xd1, 0x06, 0x45, 0x51, 0x6d, 0x22, 0x36, 0x42, 0x66,
|
||||
0xf0, 0x07, 0xd1, 0x0d, 0x44, 0xa6, 0x51, 0x74, 0xa2, 0xda, 0xdc, 0x1d, 0x60, 0x21, 0xf3, 0x0b,
|
||||
0xb5, 0xdf, 0x4f, 0x94, 0xfb, 0x28, 0xfd, 0xc9, 0x00, 0xab, 0xad, 0x23, 0x85, 0x2f, 0x68, 0x40,
|
||||
0x84, 0xac, 0x27, 0x11, 0x41, 0x16, 0xba, 0xbe, 0xdf, 0x11, 0xa0, 0x79, 0x69, 0x7b, 0xc6, 0xe6,
|
||||
0xb5, 0x29, 0x9a, 0x76, 0x9a, 0x77, 0xd1, 0xf9, 0x95, 0x21, 0x45, 0x6e, 0x18, 0x8c, 0x48, 0xaa,
|
||||
0x48, 0x09, 0x03, 0xba, 0x7e, 0x0c, 0xdf, 0xf1, 0xa6, 0x41, 0x0d, 0xed, 0x9c, 0x66, 0x47, 0x57,
|
||||
0xeb, 0xe4, 0x4b, 0x7d, 0x89, 0x88, 0x54, 0x2d, 0x86, 0x43, 0x93, 0x81, 0xfb, 0xe4, 0xcc, 0x15,
|
||||
0x12, 0x64, 0x6a, 0x26, 0x3e, 0xba, 0x7b, 0x19, 0xe5, 0x98, 0x44, 0x18, 0xa8, 0x51, 0xce, 0x54,
|
||||
0x74, 0xf0, 0x64, 0xc9, 0x3c, 0x79, 0xe8, 0x3d, 0xcd, 0x49, 0xf4, 0x2c, 0xfc, 0x51, 0xfa, 0x13,
|
||||
0xd5, 0x9f, 0x51, 0x01, 0x16, 0x9a, 0x21, 0x46, 0xe8, 0xce, 0x94, 0xe9, 0xec, 0x80, 0x46, 0x2b,
|
||||
0xdf, 0x99, 0x01, 0x16, 0x62, 0x9f, 0xad, 0xce, 0x2e, 0x67, 0xe7, 0xa5, 0x67, 0x35, 0x41, 0x96,
|
||||
0x64, 0x07, 0xb5, 0xeb, 0xf8, 0x53, 0x02, 0x91, 0x59, 0xb4, 0x9f, 0x1c, 0x38, 0xce, 0x0a, 0xe6,
|
||||
0x32, 0xc0, 0xfa, 0xcd, 0xb1, 0x47, 0x05, 0x58, 0x1e, 0x1e, 0xfe, 0x89, 0x1e, 0xdc, 0xbe, 0xef,
|
||||
0xaf, 0x75, 0x5d, 0x5f, 0xcb, 0xb2, 0x2c, 0xeb, 0xba, 0xbe, 0xf6, 0x7d, 0x7f, 0xd5, 0xf7, 0xeb,
|
||||
0x7b, 0xf5, 0xff, 0xcb, 0xfd, 0x6d, 0xdb, 0x9a, 0x4a, 0x42, 0x0d, 0x67, 0xfd, 0xcc, 0x75, 0x5d,
|
||||
0xef, 0xfa, 0xef, 0xba, 0x2f, 0xe5, 0xfe, 0x79, 0x9e, 0xac, 0x61, 0x6e, 0xf5, 0x73, 0x86, 0xf0,
|
||||
0x47, 0x4e, 0x00, 0xad, 0x83, 0x8c, 0xd2, 0xa4, 0x7c, 0x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4f, 0x77, 0xce, 0xac, 0x4e, 0x24, 0x67, 0x3c, 0x7a, 0x81, 0x1b, 0x52,
|
||||
0x46, 0x78, 0x47, 0x80, 0xf5, 0x69, 0xdf, 0x60, 0x59, 0x17, 0x04, 0x8d, 0x01, 0xb6, 0x2a, 0xf2,
|
||||
0xa8, 0x52, 0x2c, 0xc4, 0x49, 0xb4, 0xd2, 0xf1, 0xf6, 0xf9, 0xd3, 0x4a, 0x04, 0xad, 0x01, 0xf7,
|
||||
0xac, 0x1d, 0xb7, 0x88, 0x77, 0x45, 0xea, 0xe5, 0x88, 0x6f, 0xb0, 0x2c, 0xe3, 0x42, 0x1d, 0x83,
|
||||
0xa7, 0x04, 0x58, 0xd6, 0x40, 0xd2, 0xe2, 0x48, 0x7a, 0x74, 0x1b, 0x19, 0x97, 0xc5, 0x31, 0xb1,
|
||||
0x3a, 0x38, 0xda, 0x8d, 0xa2, 0xa8, 0xb5, 0x12, 0x09, 0xb2, 0x9e, 0x12, 0x60, 0x45, 0x1c, 0x46,
|
||||
0x33, 0x73, 0x83, 0x67, 0x86, 0xa3, 0x6d, 0xb5, 0xe7, 0x08, 0x5d, 0x8f, 0xaf, 0xf5, 0x89, 0x25,
|
||||
0xca, 0x28, 0xef, 0xd0, 0x8c, 0xe3, 0x1d, 0x6b, 0x81, 0x75, 0x83, 0x07, 0xbd, 0xa6, 0x1d, 0x7b,
|
||||
0x44, 0x2c, 0x33, 0xbd, 0x44, 0x10, 0x49, 0xab, 0x21, 0x69, 0x7d, 0xae, 0x44, 0x90, 0x13, 0x08,
|
||||
0x2d, 0x55, 0xa1, 0xe5, 0x6a, 0xe5, 0x6f, 0x2e, 0x45, 0x58, 0x68, 0x58, 0x99, 0xa5, 0x2d, 0x37,
|
||||
0xe9, 0xb5, 0xe7, 0xc6, 0x7d, 0x57, 0x26, 0x42, 0x72, 0x8e, 0x7b, 0xfd, 0x44, 0x4a, 0x50, 0x10,
|
||||
0x70, 0xa5, 0xa1, 0xd2, 0xc2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|
||||
0x44, 0x22, 0x91, 0xf8, 0x51, 0x47, 0x76, 0xe6, 0xa9, 0x98, 0xdf, 0xe4, 0x3c, 0x67, 0x80, 0x35,
|
||||
0x46, 0x07, 0x33, 0xb8, 0x4a, 0x24, 0x12, 0x89, 0x44, 0x22, 0x91, 0x48, 0x24, 0x12, 0x89, 0xc4,
|
||||
0x3f, 0xf8, 0x0b, 0xea, 0x2a, 0xe7, 0xc4, 0x8d, 0xfe, 0xbd, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x49,
|
||||
0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
|
||||
};
|
||||
const int font9x12_size = sizeof(font9x12);
|
14
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.h
Normal file
14
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
This file was autogenerated by raw2c.
|
||||
Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
#ifndef _font9x12_h_
|
||||
#define _font9x12_h_
|
||||
//---------------------------------------------------------------------------------
|
||||
extern const unsigned char font9x12[];
|
||||
extern const int font9x12_size;
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif //_font9x12_h_
|
||||
//---------------------------------------------------------------------------------
|
BIN
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.png
Normal file
BIN
examples/NEED_GRRLIB_FUNCTION/source/gfx/font9x12.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
9897
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.c
Normal file
9897
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.c
Normal file
File diff suppressed because it is too large
Load diff
14
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.h
Normal file
14
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
This file was autogenerated by raw2c.
|
||||
Visit http://www.devkitpro.org
|
||||
*/
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
#ifndef _room_h_
|
||||
#define _room_h_
|
||||
//---------------------------------------------------------------------------------
|
||||
extern const unsigned char room[];
|
||||
extern const int room_size;
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif //_room_h_
|
||||
//---------------------------------------------------------------------------------
|
BIN
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.jpg
Normal file
BIN
examples/NEED_GRRLIB_FUNCTION/source/gfx/room.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 KiB |
259
examples/NEED_GRRLIB_FUNCTION/source/main.c
Normal file
259
examples/NEED_GRRLIB_FUNCTION/source/main.c
Normal file
|
@ -0,0 +1,259 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Since i cant code all these new function alone,
|
||||
i really need help to find the best way to provide
|
||||
GRRLIB functions to all these new effets in this demo.
|
||||
With the help of the doc you can try also to find how it works,
|
||||
for exemple i didnt succes fully coded a specular position and direction....
|
||||
So i repeat i need HELP !!! ;)
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "gfx/font9x12.h"
|
||||
#include "gfx/room.h"
|
||||
|
||||
extern Mtx _GRR_view;
|
||||
|
||||
int main() {
|
||||
f32 a= 0.0f;
|
||||
GXLightObj MyLight0;
|
||||
GXLightObj MyLight1;
|
||||
int demo=0;
|
||||
|
||||
Mtx mr,mv,rx,ry,rz,m;
|
||||
GXTexObj texObj;
|
||||
|
||||
GRRLIB_Init();
|
||||
WPAD_Init();
|
||||
|
||||
|
||||
GRRLIB_texImg *tex_room = GRRLIB_LoadTexture(room);
|
||||
|
||||
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font9x12);
|
||||
GRRLIB_InitTileSet(tex_font, 9, 12, 32);
|
||||
|
||||
GRRLIB_Settings.antialias = false;
|
||||
|
||||
GRRLIB_SetBackgroundColour(0x40, 0x40, 0x40, 0xFF);
|
||||
|
||||
while(1) {
|
||||
GRRLIB_Camera3dSettings(0.0f,0.0f,10.0f, 0,1,0, 0,0,0);
|
||||
|
||||
GRRLIB_2dMode();
|
||||
WPAD_ScanPads();
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_PLUS) if(demo<5) demo++;
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_MINUS) if(demo>0) demo--;
|
||||
|
||||
GRRLIB_3dMode(0.1,1000,45,0,0,1);
|
||||
|
||||
if(demo==0){
|
||||
/////////////////// DEFINE A DIFUSE LIGHT /////////////////////////////////////////////
|
||||
guVector l0pos={0.0f,20.0f,0.0f};
|
||||
guVecMultiply(_GRR_view, &l0pos, &l0pos);
|
||||
GX_InitLightPos(&MyLight0, l0pos.x, l0pos.y, l0pos.z);
|
||||
GX_InitLightColor(&MyLight0, (GXColor) { 0xFF, 0x00, 0x00, 0xFF });
|
||||
GX_InitLightSpot(&MyLight0, 0.0f, GX_SP_OFF);
|
||||
GX_InitLightDistAttn(&MyLight0, 20.0f, 1.0f, GX_DA_MEDIUM); // DistAttn = 20.0 & Brightness=1.0f (full)
|
||||
GX_LoadLightObj(&MyLight0, GX_LIGHT0);
|
||||
|
||||
/////////////////////// Turn light ON ////////////////////////////////////////////////
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_CLAMP,GX_AF_SPOT); //4th param is where come from the material color (REG(with setChanMatColor or VTX (vertex)) same for ambiant (3th param)
|
||||
|
||||
/////////////////////// Define MAterial and Ambiant color and draw object /////////////////////////////////////
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { 0x33, 0x33, 0x33, 0xFF});
|
||||
GX_SetChanMatColor(GX_COLOR0A0, (GXColor) { 0xFF, 0xFF, 0xFF, 0xFF});
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
//////////////////////////// Turn light off and Write demo name
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo 1 Diffuse Light Source");
|
||||
}
|
||||
|
||||
if(demo==1){
|
||||
/////////////////// DEFINE 2 DIFUSE LIGHTS /////////////////////////////////////////////
|
||||
guVector l0pos={0.0f,20.0f,0.0f};
|
||||
guVecMultiply(_GRR_view, &l0pos, &l0pos);
|
||||
GX_InitLightPos(&MyLight0, l0pos.x, l0pos.y, l0pos.z);
|
||||
GX_InitLightColor(&MyLight0, (GXColor) { 0x00, 0xFF, 0x00, 0xFF });
|
||||
GX_InitLightSpot(&MyLight0, 0.0f, GX_SP_OFF);
|
||||
GX_InitLightDistAttn(&MyLight0, 20.0f, 1.0f, GX_DA_MEDIUM); // DistAttn = 20.0 & Brightness=1.0f (full)
|
||||
GX_LoadLightObj(&MyLight0, GX_LIGHT0);
|
||||
|
||||
guVector l1pos={0.0f,-20.0f,0.0f};
|
||||
guVecMultiply(_GRR_view, &l1pos, &l1pos);
|
||||
GX_InitLightPos(&MyLight1, l1pos.x, l1pos.y, l1pos.z);
|
||||
GX_InitLightColor(&MyLight1, (GXColor) { 0x00, 0x00, 0xFF, 0xFF });
|
||||
GX_InitLightSpot(&MyLight1, 0.0f, GX_SP_OFF);
|
||||
GX_InitLightDistAttn(&MyLight1, 20.0f, 1.0f, GX_DA_MEDIUM); // DistAttn = 20.0 & Brightness=1.0f (full)
|
||||
GX_LoadLightObj(&MyLight1, GX_LIGHT1);
|
||||
|
||||
/////////////////////// Turn lights ON ////////////////////////////////////////////////
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0|GX_LIGHT1, GX_DF_CLAMP,GX_AF_SPOT); //4th param is where come from the material color (REG(with setChanMatColor or VTX (vertex)) same for ambiant (3th param)
|
||||
|
||||
/////////////////////// Define MAterial and Ambiant color and draw object /////////////////////////////////////
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { 0x33, 0x33, 0x33, 0xFF});
|
||||
GX_SetChanMatColor(GX_COLOR0A0, (GXColor) { 0xFF, 0xFF, 0xFF, 0xFF});
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
//////////////////////////// Turn light off and Write demo name
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo 2 Diffuse Light Sources");
|
||||
}
|
||||
|
||||
if(demo==2){
|
||||
/////////////////// DEFINE A DIFUSE LIGHT /////////////////////////////////////////////
|
||||
guVector l0dir={0.0f,0.0f,0.0f};
|
||||
GX_InitSpecularDir(&MyLight0, l0dir.x,l0dir.y,l0dir.z);
|
||||
|
||||
GX_InitLightShininess(&MyLight0, 20); // entre 4 et 255 !!!
|
||||
GX_InitLightColor(&MyLight0, (GXColor){0xFF,0xFF,0xFF,0xFF});
|
||||
GX_LoadLightObj(&MyLight0, GX_LIGHT0);
|
||||
|
||||
/////////////////////// Turn light ON ////////////////////////////////////////////////
|
||||
GX_SetNumChans(2); // use two color channels
|
||||
GX_SetChanCtrl(GX_COLOR0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GX_SetChanCtrl(GX_COLOR1, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_NONE, GX_AF_SPEC);
|
||||
GX_SetChanCtrl(GX_ALPHA0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHTNULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetChanCtrl(GX_ALPHA1, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHTNULL, GX_DF_NONE, GX_AF_NONE);
|
||||
|
||||
GX_SetNumTevStages(2);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0 );
|
||||
GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR1A1 );
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV );
|
||||
GX_SetTevColorIn(GX_TEVSTAGE1, GX_CC_CPREV, GX_CC_ONE, GX_CC_RASC, GX_CC_ZERO );
|
||||
|
||||
/////////////////////// Define MAterial and Ambiant color and draw object /////////////////////////////////////
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GX_SetChanAmbColor(GX_COLOR0, (GXColor) { 0xFF, 0xFF, 0xFF, 0xFF});
|
||||
GX_SetChanMatColor(GX_COLOR0, (GXColor) { 0x00, 0x00, 0x00, 0xFF});
|
||||
GX_SetChanAmbColor(GX_COLOR1, (GXColor){0x00,0x00,0x00,0x00});
|
||||
GX_SetChanMatColor(GX_COLOR1, (GXColor){0xFF,0xFF,0xFF,0xFF});
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
//////////////////////////// Turn light off and Write demo name
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo 1 Specular Source with shininess = 20");
|
||||
}
|
||||
|
||||
if(demo==3){
|
||||
/////////////////// DEFINE A DIFUSE LIGHT /////////////////////////////////////////////
|
||||
guVector l0dir={0.0f,0.0f,0.0f};
|
||||
GX_InitSpecularDir(&MyLight0, l0dir.x,l0dir.y,l0dir.z);
|
||||
|
||||
GX_InitLightShininess(&MyLight0, 200); // entre 4 et 255 !!!
|
||||
GX_InitLightColor(&MyLight0, (GXColor){0xFF,0xFF,0xFF,0xFF});
|
||||
GX_LoadLightObj(&MyLight0, GX_LIGHT0);
|
||||
|
||||
/////////////////////// Turn light ON ////////////////////////////////////////////////
|
||||
GX_SetNumChans(2); // use two color channels
|
||||
GX_SetChanCtrl(GX_COLOR0, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GX_SetChanCtrl(GX_COLOR1, GX_ENABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT0, GX_DF_NONE, GX_AF_SPEC);
|
||||
GX_SetChanCtrl(GX_ALPHA0, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHTNULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetChanCtrl(GX_ALPHA1, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHTNULL, GX_DF_NONE, GX_AF_NONE);
|
||||
|
||||
GX_SetNumTevStages(2);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0 );
|
||||
GX_SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR1A1 );
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GX_SetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_ENABLE, GX_TEVPREV );
|
||||
GX_SetTevColorIn(GX_TEVSTAGE1, GX_CC_CPREV, GX_CC_ONE, GX_CC_RASC, GX_CC_ZERO );
|
||||
|
||||
/////////////////////// Define MAterial and Ambiant color and draw object /////////////////////////////////////
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GX_SetChanAmbColor(GX_COLOR0, (GXColor) { 0xFF, 0xFF, 0xFF, 0xFF});
|
||||
GX_SetChanMatColor(GX_COLOR0, (GXColor) { 0x00, 0x00, 0x00, 0xFF});
|
||||
GX_SetChanAmbColor(GX_COLOR1, (GXColor){0x00,0x00,0x00,0x00});
|
||||
GX_SetChanMatColor(GX_COLOR1, (GXColor){0xFF,0xFF,0xFF,0xFF});
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
//////////////////////////// Turn light off and Write demo name
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_VTX, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo 1 Specular Source with shininess = 200");
|
||||
}
|
||||
if(demo==4){
|
||||
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_NRM, GX_TEXMTX0); // We say we use the Normal coord to map the texture (since there is no textcoord with this torus)
|
||||
guLightFrustum(mv, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, 0.5F, 0.5F, 0.5F, 0.5F); // we are projecting the texture like a light (ie : videoprojector))
|
||||
|
||||
guMtxScale(mr, -2.8f, -2.8f, 0.0f); //here is a little scaling to fit the torus
|
||||
guMtxConcat(mr, mv, mv);
|
||||
|
||||
GX_LoadTexMtxImm(mv, GX_TEXMTX0, GX_MTX3x4);
|
||||
GX_InitTexObj(&texObj, tex_room->data, tex_room->w, tex_room->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_4);
|
||||
GX_SetNumTexGens(1);
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo Mapping Using textgen from normal coord");
|
||||
}
|
||||
if(demo==5){
|
||||
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_NRM, GX_TEXMTX0); // We say we use the Normal coord to map the texture (since there is no textcoord with this torus)
|
||||
guLightFrustum(mv, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, 0.5F, 0.5F, 0.5F, 0.5F); // we are projecting the texture like a light (ie : videoprojector))
|
||||
guMtxRotDeg(rx, 'X', a); // Here i rotate the texture
|
||||
guMtxRotDeg(ry, 'Y', a*2); // in the inverse way
|
||||
guMtxRotDeg(rz, 'Z', a*3); // of the
|
||||
guMtxConcat(ry, rx, m); // rotation of
|
||||
guMtxConcat(m, rz, m); // the object
|
||||
guMtxConcat(mv, m, mv); // make it show the texture not moving.... ;)
|
||||
|
||||
guMtxScale(mr, -2.8f, -2.8f, 0.0f); //here is a little scaling to fit the torus
|
||||
guMtxConcat(mr, mv, mv);
|
||||
|
||||
GX_LoadTexMtxImm(mv, GX_TEXMTX0, GX_MTX3x4);
|
||||
GX_InitTexObj(&texObj, tex_room->data, tex_room->w, tex_room->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GX_InitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_4);
|
||||
GX_SetNumTexGens(1);
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GX_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 1.0f,1.0f,1.0f);
|
||||
GRRLIB_DrawTorus(0.6f, 2.0f, 60, 60,true);
|
||||
a+=0.8f;
|
||||
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf(20, 30, tex_font, 0xFFFFFFFF, 1, "Simple Demo Environmental Mapping");
|
||||
}
|
||||
|
||||
|
||||
GRRLIB_Render();
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
GRRLIB_FreeTexture(tex_font);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
178
examples/NEED_GRRLIB_FUNCTION/source/main.c.nice.working
Normal file
178
examples/NEED_GRRLIB_FUNCTION/source/main.c.nice.working
Normal file
|
@ -0,0 +1,178 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Flat 3D cube
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "gfx/font.h"
|
||||
|
||||
extern Mtx _GRR_view;
|
||||
|
||||
int main() {
|
||||
float a=0;
|
||||
u32 col[3] = {0xFF0000FF, 0x00FF00FF, 0x0000FFFF};
|
||||
GXLightObj MyLight;
|
||||
u8 Amb=0;
|
||||
f32 zlight=6.0f;
|
||||
|
||||
GRRLIB_Init();
|
||||
WPAD_Init();
|
||||
|
||||
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font);
|
||||
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
|
||||
|
||||
GRRLIB_Settings.antialias = true;
|
||||
|
||||
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||
GRRLIB_Camera3dSettings(0.0f,0.0f,6.0f, 0,1,0, 0,0,0);
|
||||
|
||||
while(1) {
|
||||
GRRLIB_2dMode();
|
||||
WPAD_ScanPads();
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS){if(Amb<255) Amb++; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS){if(Amb>0) Amb--; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A){zlight++; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B){zlight--; }
|
||||
|
||||
|
||||
GRRLIB_3dMode(0.1,1000,45,1,0,0);
|
||||
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GX_SetVtxDesc(GX_VA_NRM, GX_DIRECT);
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
|
||||
////////////////////////////////////////
|
||||
guVector lpos ={0.0f,0.0f,zlight};
|
||||
guVecMultiply(_GRR_view, &lpos, &lpos);
|
||||
GX_InitLightPos(&MyLight, lpos.x, lpos.y, lpos.z);
|
||||
GX_InitLightColor(&MyLight, (GXColor) { 255, 255, 255, 255 });
|
||||
GX_InitLightAttn(&MyLight, 1.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F );
|
||||
GX_LoadLightObj(&MyLight, GX_LIGHT0);
|
||||
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(GX_COLOR0A0, GX_ENABLE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT0, GX_DF_CLAMP, GX_AF_SPOT);
|
||||
GX_SetChanAmbColor(GX_COLOR0A0, (GXColor) { Amb, Amb, Amb, 255 });
|
||||
////////////////////////////////////////
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3);
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
|
||||
GX_End();
|
||||
a+=0.5f;
|
||||
|
||||
///////////////// DISABLE LIGHT/////////////////////////////
|
||||
GX_SetNumChans(1);
|
||||
GX_SetChanCtrl(
|
||||
GX_COLOR0A0,
|
||||
GX_DISABLE, // disable channel
|
||||
GX_SRC_VTX, // amb source
|
||||
GX_SRC_VTX, // mat source
|
||||
0, // light mask
|
||||
GX_DF_NONE, // diffuse function
|
||||
GX_AF_NONE);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
// Switch To 2D Mode to display text
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf((640-(16*40))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS PLUS OR MINUS TO PLAY WITH AMBIENT");
|
||||
GRRLIB_Printf((640-(16*15))/2, 36, tex_font, 0xFFFFFFFF, 1, "AMBIENT = 0X%02X%02X%02XFF",Amb,Amb,Amb,Amb);
|
||||
GRRLIB_Printf((640-(16*15))/2, 52, tex_font, 0xFFFFFFFF, 1, "ZLIGHT = %f",zlight);
|
||||
|
||||
GRRLIB_Render();
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
GRRLIB_FreeTexture(tex_font);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
147
examples/NEED_GRRLIB_FUNCTION/source/main.c.working.2
Normal file
147
examples/NEED_GRRLIB_FUNCTION/source/main.c.working.2
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*===========================================
|
||||
NoNameNo
|
||||
Simple Flat 3D cube
|
||||
============================================*/
|
||||
#include <grrlib.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <malloc.h>
|
||||
#include <wiiuse/wpad.h>
|
||||
|
||||
#include "gfx/font.h"
|
||||
|
||||
extern Mtx _GRR_view;
|
||||
|
||||
int main() {
|
||||
u32 col[3] = {0xFF0000FF, 0x00FF00FF, 0x0000FFFF};
|
||||
float a=0;
|
||||
u8 Amb=0x80;
|
||||
f32 zlight=0.0f;
|
||||
|
||||
GRRLIB_Init();
|
||||
WPAD_Init();
|
||||
|
||||
GRRLIB_texImg *tex_font = GRRLIB_LoadTexture(font);
|
||||
GRRLIB_InitTileSet(tex_font, 16, 16, 32);
|
||||
|
||||
GRRLIB_Settings.antialias = true;
|
||||
|
||||
GRRLIB_SetBackgroundColour(0x00, 0x00, 0x00, 0xFF);
|
||||
GRRLIB_Camera3dSettings(0.0f,0.0f,13.0f, 0,1,0, 0,0,0);
|
||||
|
||||
while(1) {
|
||||
GRRLIB_2dMode();
|
||||
WPAD_ScanPads();
|
||||
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) exit(0);
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_PLUS){if(Amb<255) Amb++; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_MINUS){if(Amb>0) Amb--; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_A){zlight++; }
|
||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_B){zlight--; }
|
||||
|
||||
|
||||
GRRLIB_3dMode(0.1,1000,45,1,0,1);
|
||||
GRRLIB_ObjectView(0,0,0, a,a*2,a*3, 3,3,3);
|
||||
|
||||
GRRLIB_InitLight(GX_LIGHT0, (guVector){-zlight, 0, 0}, 0xFF0000FF);
|
||||
GRRLIB_InitLight(GX_LIGHT1, (guVector){zlight, 0, 0}, 0x00FF00FF);
|
||||
GRRLIB_InitLight(GX_LIGHT2, (guVector){0, -zlight, 0}, 0x0000FFFF);
|
||||
|
||||
GRRLIB_LightSwitch(GX_LIGHT0|GX_LIGHT1|GX_LIGHT2,RGBA(Amb,Amb,Amb,0xFF),0x808080FF,0);
|
||||
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,0.0f,-1.0f);
|
||||
GX_Color1u32(col[0]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(0.0f,-1.0f,0.0f);
|
||||
GX_Color1u32(col[1]);
|
||||
|
||||
GX_Position3f32(-1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(-1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(-1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
|
||||
GX_Position3f32(1.0f,1.0f,-1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,1.0f,1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,-1.0f,1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_Position3f32(1.0f,-1.0f,-1.0f);
|
||||
GX_Normal3f32(1.0f,0.0f,0.0f);
|
||||
GX_Color1u32(col[2]);
|
||||
GX_End();
|
||||
a+=0.5f;
|
||||
|
||||
GRRLIB_LightOff();
|
||||
// Switch To 2D Mode to display text
|
||||
GRRLIB_2dMode();
|
||||
GRRLIB_Printf((640-(16*40))/2, 20, tex_font, 0xFFFFFFFF, 1, "PRESS PLUS OR MINUS TO PLAY WITH AMBIENT");
|
||||
GRRLIB_Printf((640-(16*15))/2, 36, tex_font, 0xFFFFFFFF, 1, "AMBIENT = 0X%02X%02X%02XFF",Amb,Amb,Amb,Amb);
|
||||
GRRLIB_Printf((640-(16*15))/2, 52, tex_font, 0xFFFFFFFF, 1, "ZLIGHT = %f",zlight);
|
||||
|
||||
GRRLIB_Render();
|
||||
}
|
||||
GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB
|
||||
GRRLIB_FreeTexture(tex_font);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
Loading…
Reference in a new issue